summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-05-17 18:38:35 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-05-17 18:38:35 +0000
commit62770bea4b0bd203c7ad09f57cf68bfc16a58612 (patch)
tree4b5f7b8171e65861e90237aaf0842e9ca0f548e7 /clang/tools/libclang/CIndex.cpp
parent858885578d6bdf82527c2d895368fc0140536b83 (diff)
downloadbcm5719-llvm-62770bea4b0bd203c7ad09f57cf68bfc16a58612.tar.gz
bcm5719-llvm-62770bea4b0bd203c7ad09f57cf68bfc16a58612.zip
libclang: add a function to check whether a member function is pure virtual
Patch by Seth Fowler. llvm-svn: 182139
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index db7faabbee3..bd20800993b 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -6118,6 +6118,20 @@ CXFile clang_Module_getTopLevelHeader(CXTranslationUnit TU,
//===----------------------------------------------------------------------===//
extern "C" {
+unsigned clang_CXXMethod_isPureVirtual(CXCursor C) {
+ if (!clang_isDeclaration(C.kind))
+ return 0;
+
+ const CXXMethodDecl *Method = 0;
+ const Decl *D = cxcursor::getCursorDecl(C);
+ if (const FunctionTemplateDecl *FunTmpl =
+ dyn_cast_or_null<FunctionTemplateDecl>(D))
+ Method = dyn_cast<CXXMethodDecl>(FunTmpl->getTemplatedDecl());
+ else
+ Method = dyn_cast_or_null<CXXMethodDecl>(D);
+ return (Method && Method->isVirtual() && Method->isPure()) ? 1 : 0;
+}
+
unsigned clang_CXXMethod_isStatic(CXCursor C) {
if (!clang_isDeclaration(C.kind))
return 0;
OpenPOWER on IntegriCloud