[clang-tools-extra] r353696 - [clangd] Index parameters in function decls

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 11 05:03:08 PST 2019


Author: kadircet
Date: Mon Feb 11 05:03:08 2019
New Revision: 353696

URL: http://llvm.org/viewvc/llvm-project?rev=353696&view=rev
Log:
[clangd] Index parameters in function decls

Reviewers: hokein

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

Modified:
    clang-tools-extra/trunk/clangd/XRefs.cpp
    clang-tools-extra/trunk/unittests/clangd/SymbolInfoTests.cpp
    clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp

Modified: clang-tools-extra/trunk/clangd/XRefs.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/XRefs.cpp?rev=353696&r1=353695&r2=353696&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/XRefs.cpp (original)
+++ clang-tools-extra/trunk/clangd/XRefs.cpp Mon Feb 11 05:03:08 2019
@@ -215,6 +215,7 @@ IdentifiedSymbol getSymbolAtPosition(Par
   IndexOpts.SystemSymbolFilter =
       index::IndexingOptions::SystemSymbolFilterKind::All;
   IndexOpts.IndexFunctionLocals = true;
+  IndexOpts.IndexParametersInDeclarations = true;
   indexTopLevelDecls(AST.getASTContext(), AST.getPreprocessor(),
                      AST.getLocalTopLevelDecls(), DeclMacrosFinder, IndexOpts);
 
@@ -400,6 +401,7 @@ findRefs(const std::vector<const Decl *>
   IndexOpts.SystemSymbolFilter =
       index::IndexingOptions::SystemSymbolFilterKind::All;
   IndexOpts.IndexFunctionLocals = true;
+  IndexOpts.IndexParametersInDeclarations = true;
   indexTopLevelDecls(AST.getASTContext(), AST.getPreprocessor(),
                      AST.getLocalTopLevelDecls(), RefFinder, IndexOpts);
   return std::move(RefFinder).take();

Modified: clang-tools-extra/trunk/unittests/clangd/SymbolInfoTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/SymbolInfoTests.cpp?rev=353696&r1=353695&r2=353696&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/SymbolInfoTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/SymbolInfoTests.cpp Mon Feb 11 05:03:08 2019
@@ -302,6 +302,12 @@ TEST(SymbolInfoTests, All) {
         )cpp",
               {CreateExpectedSymbolDetails("bar", "foo::", "c:@E at foo@bar")}},
           {
+              R"cpp( // Parameters in declarations
+          void foo(int ba^r);
+        )cpp",
+              {CreateExpectedSymbolDetails("bar", "foo",
+                                           "c:TestTU.cpp at 50@F at foo#I#@bar")}},
+          {
               R"cpp( // Type inferrence with auto keyword
           struct foo {};
           foo getfoo() { return foo{}; }

Modified: clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp?rev=353696&r1=353695&r2=353696&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp Mon Feb 11 05:03:08 2019
@@ -86,6 +86,10 @@ TEST(HighlightsTest, All) {
           auto *X = &[[foo]];
         }
       )cpp",
+
+      R"cpp(// Function parameter in decl
+        void foo(int [[^bar]]);
+      )cpp",
   };
   for (const char *Test : Tests) {
     Annotations T(Test);




More information about the cfe-commits mailing list