aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-06 19:41:16 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-06 19:41:16 +0000
commit838eb7e8652e451d93494a4e583e4d11809bcb4a (patch)
tree332e35e9347d8749ea095f61cf08f697f158e38d /tools/c-index-test/c-index-test.c
parent14491490a5276ff4da9b28100fb8e7d442944288 (diff)
[libclang] Introduce a new indexing mode where we skip function bodies
that were already parsed in the same "indexing session". An indexing session is defined as using the same CXIndexAction object for multiple clang_indexSourceFile calls. Passing CXIndexOpt_SkipParsedBodiesInSession as an indexing option will enable the mode where we try to skip bodies that were already parsed in another translation unit. If a function's body was skipped, the "flags" field in the CXIdxDeclInfo structure will have "CXIdxDeclFlag_Skipped" bit was set. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r--tools/c-index-test/c-index-test.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 42d7a14787..7a36d093a5 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -2497,7 +2497,12 @@ static void index_indexDeclaration(CXClientData client_data,
printCXIndexContainer(info->lexicalContainer);
printf(" | isRedecl: %d", info->isRedeclaration);
printf(" | isDef: %d", info->isDefinition);
- printf(" | isContainer: %d", info->isContainer);
+ if (info->flags & CXIdxDeclFlag_Skipped) {
+ assert(!info->isContainer);
+ printf(" | isContainer: skipped");
+ } else {
+ printf(" | isContainer: %d", info->isContainer);
+ }
printf(" | isImplicit: %d\n", info->isImplicit);
for (i = 0; i != info->numAttributes; ++i) {
@@ -2608,6 +2613,8 @@ static unsigned getIndexOptions(void) {
index_opts |= CXIndexOpt_SuppressRedundantRefs;
if (getenv("CINDEXTEST_INDEXLOCALSYMBOLS"))
index_opts |= CXIndexOpt_IndexFunctionLocalSymbols;
+ if (!getenv("CINDEXTEST_DISABLE_SKIPPARSEDBODIES"))
+ index_opts |= CXIndexOpt_SkipParsedBodiesInSession;
return index_opts;
}