[cfe-commits] r131230 - in /cfe/trunk: include/clang-c/Index.h tools/libclang/CIndex.cpp tools/libclang/libclang.darwin.exports tools/libclang/libclang.exports
Douglas Gregor
dgregor at apple.com
Thu May 12 08:17:24 PDT 2011
Author: dgregor
Date: Thu May 12 10:17:24 2011
New Revision: 131230
URL: http://llvm.org/viewvc/llvm-project?rev=131230&view=rev
Log:
Add clang_CXXMethod_isVirtual() to libclang, from Erik Verbruggen!
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/libclang.darwin.exports
cfe/trunk/tools/libclang/libclang.exports
Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=131230&r1=131229&r2=131230&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Thu May 12 10:17:24 2011
@@ -2267,6 +2267,13 @@
CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
/**
+ * \brief Determine if a C++ member function or member function template is
+ * explicitly declared 'virtual' or if it overrides a virtual method from
+ * one of the base classes.
+ */
+CINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C);
+
+/**
* \brief Given a cursor that represents a template, determine
* the cursor kind of the specializations would be generated by instantiating
* the template.
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=131230&r1=131229&r2=131230&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu May 12 10:17:24 2011
@@ -5192,6 +5192,19 @@
return (Method && Method->isStatic()) ? 1 : 0;
}
+unsigned clang_CXXMethod_isVirtual(CXCursor C) {
+ if (!clang_isDeclaration(C.kind))
+ return 0;
+
+ CXXMethodDecl *Method = 0;
+ Decl *D = cxcursor::getCursorDecl(C);
+ if (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()) ? 1 : 0;
+}
+
} // end: extern "C"
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/tools/libclang/libclang.darwin.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.darwin.exports?rev=131230&r1=131229&r2=131230&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.darwin.exports (original)
+++ cfe/trunk/tools/libclang/libclang.darwin.exports Thu May 12 10:17:24 2011
@@ -1,6 +1,7 @@
_clang_CXCursorSet_contains
_clang_CXCursorSet_insert
_clang_CXXMethod_isStatic
+_clang_CXXMethod_isVirtual
_clang_annotateTokens
_clang_codeCompleteAt
_clang_codeCompleteGetDiagnostic
Modified: cfe/trunk/tools/libclang/libclang.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=131230&r1=131229&r2=131230&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.exports (original)
+++ cfe/trunk/tools/libclang/libclang.exports Thu May 12 10:17:24 2011
@@ -1,6 +1,7 @@
clang_CXCursorSet_contains
clang_CXCursorSet_insert
clang_CXXMethod_isStatic
+clang_CXXMethod_isVirtual
clang_annotateTokens
clang_codeCompleteAt
clang_codeCompleteGetDiagnostic
More information about the cfe-commits
mailing list