diff --git a/lib/Index/IndexTypeSourceInfo.cpp b/lib/Index/IndexTypeSourceInfo.cpp index 8342e93c156d..85afc6345053 100644 --- a/lib/Index/IndexTypeSourceInfo.cpp +++ b/lib/Index/IndexTypeSourceInfo.cpp @@ -100,7 +100,8 @@ class TypeIndexer : public RecursiveASTVisitor { bool VisitTagTypeLoc(TagTypeLoc TL) { TagDecl *D = TL.getDecl(); - if (D->getParentFunctionOrMethod()) + if (!IndexCtx.shouldIndexFunctionLocalSymbols() && + D->getParentFunctionOrMethod()) return true; if (TL.isDefinition()) { diff --git a/test/Index/index-local-symbol.cpp b/test/Index/index-local-symbol.cpp new file mode 100644 index 000000000000..1ffc4ec89ed8 --- /dev/null +++ b/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 \ No newline at end of file