Keep track of whether declararions were loaded from a precompiled
header or not via a new "PCHLevel" field in Decl. We currently use
this information to help CIndex filter out declarations that came from
a precompiled header (rather than from an AST file). Further down the
road, it can be used to help implement multi-level precompiled
headers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84267 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 716c15d..bfc8e62 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -86,10 +86,16 @@
}
{
CXIndex Idx = clang_createIndex();
+ if (!strcmp(argv[2], "local"))
+ clang_wantOnlyLocalDeclarations(Idx);
CXTranslationUnit TU = clang_createTranslationUnit(Idx, argv[1]);
+ if (!TU) {
+ fprintf(stderr, "Unable to load translation unit!\n");
+ return 1;
+ }
enum CXCursorKind K = CXCursor_NotImplemented;
- if (!strcmp(argv[2], "all")) {
+ if (!strcmp(argv[2], "all") || !strcmp(argv[2], "local")) {
clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0);
clang_disposeTranslationUnit(TU);
return 1;