diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index a4741df84d12..3c69d0f292a2 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -1336,6 +1336,24 @@ CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor); */ 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); + /** * @} */ diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 753e90e4b02e..16cd309b319b 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/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(cxcursor::getCursorDecl(C)); + return (D && D->isStatic()) ? 1 : 0; +} // end: extern "C" + //===----------------------------------------------------------------------===// // CXString Operations. //===----------------------------------------------------------------------===// diff --git a/clang/tools/libclang/libclang.darwin.exports b/clang/tools/libclang/libclang.darwin.exports index 2ea3677addea..4b61bd34cbd3 100644 --- a/clang/tools/libclang/libclang.darwin.exports +++ b/clang/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/clang/tools/libclang/libclang.exports b/clang/tools/libclang/libclang.exports index 321a4ccab4e9..ad984f0e9d68 100644 --- a/clang/tools/libclang/libclang.exports +++ b/clang/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