aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2019-02-26 14:23:47 +0000
committerKadir Cetinkaya <kadircet@google.com>2019-02-26 14:23:47 +0000
commit60ec08f0678f172b3bd08b4a7a82eccb3a950cfe (patch)
tree8071580dca8172caa076a0bba4d4ac7ae4d9c767 /clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp
parent[clang][Index] Visit UsingDecls and generate USRs for them (diff)
downloadllvm-project-60ec08f0678f172b3bd08b4a7a82eccb3a950cfe.tar.gz
llvm-project-60ec08f0678f172b3bd08b4a7a82eccb3a950cfe.tar.bz2
llvm-project-60ec08f0678f172b3bd08b4a7a82eccb3a950cfe.zip
[clangd] Index UsingDecls
Summary: D58340 enables indexing of USRs, this makes sure test in clangd are aligned with the change Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58341 llvm-svn: 354879
Diffstat (limited to 'clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp')
-rw-r--r--clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp b/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp
index a9e1f2e697ac..d795286fd799 100644
--- a/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp
+++ b/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp
@@ -331,9 +331,6 @@ TEST_F(SymbolCollectorTest, CollectSymbols) {
// 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
)";
@@ -360,6 +357,7 @@ TEST_F(SymbolCollectorTest, CollectSymbols) {
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))}));
}
@@ -1149,6 +1147,16 @@ TEST_F(SymbolCollectorTest, ImplementationDetail) {
AllOf(QName("Public"), Not(ImplementationDetail()))));
}
+TEST_F(SymbolCollectorTest, UsingDecl) {
+ const char *Header = R"(
+ void foo();
+ namespace std {
+ using ::foo;
+ })";
+ runSymbolCollector(Header, /**/ "");
+ EXPECT_THAT(Symbols, Contains(QName("std::foo")));
+}
+
} // namespace
} // namespace clangd
} // namespace clang