[PATCH] D57950: [clangd] Index parameters in function decls

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 8 07:22:58 PST 2019


kadircet updated this revision to Diff 185967.
kadircet added a comment.
This revision is now accepted and ready to land.

Also index function params in findrefs


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57950/new/

https://reviews.llvm.org/D57950

Files:
  clangd/XRefs.cpp
  unittests/clangd/SymbolInfoTests.cpp
  unittests/clangd/XRefsTests.cpp


Index: unittests/clangd/XRefsTests.cpp
===================================================================
--- unittests/clangd/XRefsTests.cpp
+++ unittests/clangd/XRefsTests.cpp
@@ -86,6 +86,13 @@
           auto *X = &[[foo]];
         }
       )cpp",
+
+      R"cpp(// Function parameter
+        void foo(int [[bar]]);
+        void foo(int [[bar]])) {
+          [[b^ar]] = 5;
+        }
+      )cpp",
   };
   for (const char *Test : Tests) {
     Annotations T(Test);
Index: unittests/clangd/SymbolInfoTests.cpp
===================================================================
--- unittests/clangd/SymbolInfoTests.cpp
+++ unittests/clangd/SymbolInfoTests.cpp
@@ -301,6 +301,12 @@
           }
         )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 {};
Index: clangd/XRefs.cpp
===================================================================
--- clangd/XRefs.cpp
+++ clangd/XRefs.cpp
@@ -215,6 +215,7 @@
   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 @@
   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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57950.185967.patch
Type: text/x-patch
Size: 2019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190208/6e487eb7/attachment-0001.bin>


More information about the cfe-commits mailing list