[clang-tools-extra] r361511 - [Index] Fix reported references in presence of template type aliases

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu May 23 09:48:47 PDT 2019


Author: ibiryukov
Date: Thu May 23 09:48:47 2019
New Revision: 361511

URL: http://llvm.org/viewvc/llvm-project?rev=361511&view=rev
Log:
[Index] Fix reported references in presence of template type aliases

Summary: See the added test for an example.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: jkorous, arphaman, cfe-commits

Tags: #clang

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

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

Modified: clang-tools-extra/trunk/clangd/unittests/XRefsTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/XRefsTests.cpp?rev=361511&r1=361510&r2=361511&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/XRefsTests.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/XRefsTests.cpp Thu May 23 09:48:47 2019
@@ -497,6 +497,17 @@ TEST(LocateSymbol, Ambiguous) {
               ElementsAre(Sym("Foo"), Sym("Foo")));
 }
 
+TEST(LocateSymbol, TemplateTypedefs) {
+  auto T = Annotations(R"cpp(
+    template <class T> struct function {};
+    template <class T> using callback = function<T()>;
+
+    c^allback<int> foo;
+  )cpp");
+  auto AST = TestTU::withCode(T.code()).build();
+  EXPECT_THAT(locateSymbolAt(AST, T.point()), ElementsAre(Sym("callback")));
+}
+
 TEST(LocateSymbol, RelPathsInCompileCommand) {
   // The source is in "/clangd-test/src".
   // We build in "/clangd-test/build".




More information about the cfe-commits mailing list