[PATCH] D58341: [clangd] Index UsingDecls

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 18 02:18:47 PST 2019


kadircet created this revision.
kadircet added a reviewer: hokein.
Herald added subscribers: cfe-commits, jdoerfert, arphaman, jkorous, MaskRay, ioeric, ilya-biryukov.
Herald added a project: clang.

D58340 <https://reviews.llvm.org/D58340> enables indexing of USRs, this makes sure test in clangd are
aligned with the change


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D58341

Files:
  unittests/clangd/SymbolCollectorTests.cpp
  unittests/clangd/SymbolInfoTests.cpp


Index: unittests/clangd/SymbolInfoTests.cpp
===================================================================
--- unittests/clangd/SymbolInfoTests.cpp
+++ unittests/clangd/SymbolInfoTests.cpp
@@ -167,7 +167,8 @@
         )cpp",
               {CreateExpectedSymbolDetails("foo", "", "c:@F at foo#"),
                CreateExpectedSymbolDetails("foo", "", "c:@F at foo#b#"),
-               CreateExpectedSymbolDetails("foo", "", "c:@F at foo#I#")}},
+               CreateExpectedSymbolDetails("foo", "", "c:@F at foo#I#"),
+               CreateExpectedSymbolDetails("foo", "bar::", "c:@N at bar@foo")}},
           {
               R"cpp( // Multiple symbols returned - implicit conversion
           struct foo {};
Index: unittests/clangd/SymbolCollectorTests.cpp
===================================================================
--- unittests/clangd/SymbolCollectorTests.cpp
+++ unittests/clangd/SymbolCollectorTests.cpp
@@ -325,9 +325,6 @@
     // Namespace alias
     namespace baz = bar;
 
-    // FIXME: using declaration is not supported as the IndexAction will ignore
-    // implicit declarations (the implicit using shadow declaration) by default,
-    // and there is no way to customize this behavior at the moment.
     using bar::v2;
     } // namespace foo
   )";
@@ -354,6 +351,7 @@
                    AllOf(QName("foo::int32_t"), ForCodeCompletion(true)),
                    AllOf(QName("foo::v1"), ForCodeCompletion(true)),
                    AllOf(QName("foo::bar::v2"), ForCodeCompletion(true)),
+                   AllOf(QName("foo::v2"), ForCodeCompletion(true)),
                    AllOf(QName("foo::baz"), ForCodeCompletion(true))}));
 }
 
@@ -1118,6 +1116,17 @@
                   AllOf(QName("Public"), Not(ImplementationDetail()))));
 }
 
+TEST_F(SymbolCollectorTest, UsingDecl) {
+  const std::string Header = R"(
+  void foo();
+  namespace std {
+    using ::foo;
+  }
+  )";
+  runSymbolCollector(Header, /**/ "");
+  EXPECT_THAT(Symbols, Contains(QName("std::foo")));
+}
+
 } // namespace
 } // namespace clangd
 } // namespace clang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58341.187202.patch
Type: text/x-patch
Size: 2061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190218/da045d8e/attachment-0001.bin>


More information about the cfe-commits mailing list