Skip to content

Commit

Permalink
[Index] Respect "IndexFunctionLocals" option for type loc.
Browse files Browse the repository at this point in the history
Summary:
Previously, clang index ignored local symbols defined in the function body even
IndexFunctionLocals is true.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52877

llvm-svn: 343767
  • Loading branch information
hokein committed Oct 4, 2018
1 parent aacd5e1 commit e94c869
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clang/lib/Index/IndexTypeSourceInfo.cpp
Expand Up @@ -100,7 +100,8 @@ class TypeIndexer : public RecursiveASTVisitor<TypeIndexer> {

bool VisitTagTypeLoc(TagTypeLoc TL) {
TagDecl *D = TL.getDecl();
if (D->getParentFunctionOrMethod())
if (!IndexCtx.shouldIndexFunctionLocalSymbols() &&
D->getParentFunctionOrMethod())
return true;

if (TL.isDefinition()) {
Expand Down
6 changes: 6 additions & 0 deletions clang/test/Index/index-local-symbol.cpp
@@ -0,0 +1,6 @@
void ff() {
struct Foo {};
}

// RUN: env CINDEXTEST_INDEXLOCALSYMBOLS=1 c-index-test -index-file %s | FileCheck %s
// CHECK: [indexDeclaration]: kind: struct | name: Foo | {{.*}} | loc: 2:10

0 comments on commit e94c869

Please sign in to comment.