aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-05-17 20:06:56 +0000
committerTed Kremenek <kremenek@apple.com>2010-05-17 20:06:56 +0000
commit9ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3b (patch)
tree04461010b622c33c54edc9dcbfc3d7bcdc1ba2ef
parent293279ae4351f4f17ce44aa4f72861d0bc74c918 (diff)
Add libclang function 'clang_CXXMethod_isStatic' to query of a C++ method
is declared static. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103963 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang-c/Index.h18
-rw-r--r--tools/libclang/CIndex.cpp13
-rw-r--r--tools/libclang/libclang.darwin.exports3
-rw-r--r--tools/libclang/libclang.exports3
4 files changed, 35 insertions, 2 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index a4741df84d..3c69d0f292 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -1341,6 +1341,24 @@ CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
*/
/**
+ * \defgroup CINDEX_CPP C++ AST introspection
+ *
+ * The routines in this group provide access information in the ASTs specific
+ * to C++ language features.
+ *
+ * @{
+ */
+
+/**
+ * \brief Determine if a C++ member function is declared 'static'.
+ */
+CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
+
+/**
+ * @}
+ */
+
+/**
* \defgroup CINDEX_LEX Token extraction and manipulation
*
* The routines in this group provide access to the tokens within a
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 753e90e4b0..16cd309b31 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -2752,6 +2752,19 @@ CXLanguageKind clang_getCursorLanguage(CXCursor cursor) {
}
} // end: extern "C"
+
+//===----------------------------------------------------------------------===//
+// C++ AST instrospection.
+//===----------------------------------------------------------------------===//
+
+extern "C" {
+unsigned clang_CXXMethod_isStatic(CXCursor C) {
+ if (!clang_isDeclaration(C.kind))
+ return 0;
+ CXXMethodDecl *D = dyn_cast<CXXMethodDecl>(cxcursor::getCursorDecl(C));
+ return (D && D->isStatic()) ? 1 : 0;
+} // end: extern "C"
+
//===----------------------------------------------------------------------===//
// CXString Operations.
//===----------------------------------------------------------------------===//
diff --git a/tools/libclang/libclang.darwin.exports b/tools/libclang/libclang.darwin.exports
index 2ea3677add..4b61bd34cb 100644
--- a/tools/libclang/libclang.darwin.exports
+++ b/tools/libclang/libclang.darwin.exports
@@ -1,3 +1,4 @@
+_clang_CXXMethod_isStatic
_clang_annotateTokens
_clang_codeComplete
_clang_codeCompleteGetDiagnostic
@@ -23,8 +24,8 @@ _clang_equalCursors
_clang_equalLocations
_clang_equalTypes
_clang_formatDiagnostic
-_clang_getCanonicalType
_clang_getCString
+_clang_getCanonicalType
_clang_getClangVersion
_clang_getCompletionChunkCompletionString
_clang_getCompletionChunkKind
diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports
index 321a4ccab4..ad984f0e9d 100644
--- a/tools/libclang/libclang.exports
+++ b/tools/libclang/libclang.exports
@@ -1,3 +1,4 @@
+clang_CXXMethod_isStatic
clang_annotateTokens
clang_codeComplete
clang_codeCompleteGetDiagnostic
@@ -23,8 +24,8 @@ clang_equalCursors
clang_equalLocations
clang_equalTypes
clang_formatDiagnostic
-clang_getCanonicalType
clang_getCString
+clang_getCanonicalType
clang_getClangVersion
clang_getCompletionChunkCompletionString
clang_getCompletionChunkKind