Author: hokein Date: Thu Oct 4 04:03:55 2018 New Revision: 343767 URL: http://llvm.org/viewvc/llvm-project?rev=343767&view=rev Log: [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 Added: cfe/trunk/test/Index/index-local-symbol.cpp Modified: cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp Modified: cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp?rev=343767&r1=343766&r2=343767&view=diff ============================================================================== --- cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp (original) +++ cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp Thu Oct 4 04:03:55 2018 @@ -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()) { Added: cfe/trunk/test/Index/index-local-symbol.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-local-symbol.cpp?rev=343767&view=auto ============================================================================== --- cfe/trunk/test/Index/index-local-symbol.cpp (added) +++ cfe/trunk/test/Index/index-local-symbol.cpp Thu Oct 4 04:03:55 2018 @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits