diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-01-14 00:11:49 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-01-14 00:11:49 +0000 |
commit | 22490747c123a78feec089539f30426084d348cf (patch) | |
tree | f03c378c01ad722111d3801e92479e9cd6b53a0b /tools/libclang | |
parent | 91534a357695fbdf3c136fb04218e37706da73a9 (diff) |
[libclang] Add CXIndexOpt_IndexFunctionLocalSymbols indexing option to indicate
that one wants indexing callbacks for function-local symbols as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang')
-rw-r--r-- | tools/libclang/IndexBody.cpp | 6 | ||||
-rw-r--r-- | tools/libclang/IndexingContext.cpp | 2 | ||||
-rw-r--r-- | tools/libclang/IndexingContext.h | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/tools/libclang/IndexBody.cpp b/tools/libclang/IndexBody.cpp index 177cad7cca..6dd45af814 100644 --- a/tools/libclang/IndexBody.cpp +++ b/tools/libclang/IndexBody.cpp @@ -84,6 +84,12 @@ public: Parent, ParentDC, E); return true; } + + bool VisitDeclStmt(DeclStmt *S) { + if (IndexCtx.indexFunctionLocalSymbols()) + IndexCtx.indexDeclGroupRef(S->getDeclGroup()); + return true; + } }; } // anonymous namespace diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp index 14dbc97002..f731580e66 100644 --- a/tools/libclang/IndexingContext.cpp +++ b/tools/libclang/IndexingContext.cpp @@ -551,7 +551,7 @@ bool IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc, return false; if (Loc.isInvalid()) return false; - if (D->getParentFunctionOrMethod()) + if (!indexFunctionLocalSymbols() && D->getParentFunctionOrMethod()) return false; if (isNotFromSourceFile(D->getLocation())) return false; diff --git a/tools/libclang/IndexingContext.h b/tools/libclang/IndexingContext.h index b58e3b690e..4a321204a8 100644 --- a/tools/libclang/IndexingContext.h +++ b/tools/libclang/IndexingContext.h @@ -324,6 +324,10 @@ public: return IndexOptions & CXIndexOpt_SuppressRedundantRefs; } + bool indexFunctionLocalSymbols() const { + return IndexOptions & CXIndexOpt_IndexFunctionLocalSymbols; + } + bool shouldAbort(); bool hasDiagnosticCallback() const { return CB.diagnostic; } |