Implement clang_isUnexposed(), a predicate function to simplify filtering out
unexposed AST elements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97985 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 7bc290d..da186f6 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -888,6 +888,12 @@
*/
CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);
+/***
+ * \brief Determine whether the given cursor represents a currently
+ * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
+ */
+CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);
+
/**
* \brief Describe the linkage of the entity referred to by a cursor.
*/
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 6fff183..b52a32e 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -1589,6 +1589,18 @@
return K == CXCursor_TranslationUnit;
}
+unsigned clang_isUnexposed(enum CXCursorKind K) {
+ switch (K) {
+ case CXCursor_UnexposedDecl:
+ case CXCursor_UnexposedExpr:
+ case CXCursor_UnexposedStmt:
+ case CXCursor_UnexposedAttr:
+ return true;
+ default:
+ return false;
+ }
+}
+
CXCursorKind clang_getCursorKind(CXCursor C) {
return C.kind;
}
diff --git a/tools/CIndex/CIndex.exports b/tools/CIndex/CIndex.exports
index e68060b..5b95300 100644
--- a/tools/CIndex/CIndex.exports
+++ b/tools/CIndex/CIndex.exports
@@ -67,6 +67,7 @@
_clang_isReference
_clang_isStatement
_clang_isTranslationUnit
+_clang_isUnexposed
_clang_setUseExternalASTGeneration
_clang_tokenize
_clang_visitChildren