[Index] Respect "IndexFunctionLocals" option for type loc.

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
This commit is contained in:
Haojian Wu
2018-10-04 11:03:55 +00:00
parent aacd5e187b
commit e94c869434
2 changed files with 8 additions and 1 deletions

View File

@@ -100,7 +100,8 @@ public:
bool VisitTagTypeLoc(TagTypeLoc TL) {
TagDecl *D = TL.getDecl();
if (D->getParentFunctionOrMethod())
if (!IndexCtx.shouldIndexFunctionLocalSymbols() &&
D->getParentFunctionOrMethod())
return true;
if (TL.isDefinition()) {

View File

@@ -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