diff options
| author | Kadir Cetinkaya <kadircet@google.com> | 2019-02-18 14:23:19 +0000 |
|---|---|---|
| committer | Kadir Cetinkaya <kadircet@google.com> | 2019-02-18 14:23:19 +0000 |
| commit | 9b4db445ce1e82ef2e3a10278a6352d1d7d28965 (patch) | |
| tree | d42467a44e0226e5ddf22b2b442bcfcda0173a87 | |
| parent | c102e2a2275b3a465d033756513e6960923f35af (diff) | |
| download | bcm5719-llvm-9b4db445ce1e82ef2e3a10278a6352d1d7d28965.tar.gz bcm5719-llvm-9b4db445ce1e82ef2e3a10278a6352d1d7d28965.zip | |
[clangd] Add tests for template specializations
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58190
llvm-svn: 354272
| -rw-r--r-- | clang-tools-extra/unittests/clangd/XRefsTests.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/XRefsTests.cpp b/clang-tools-extra/unittests/clangd/XRefsTests.cpp index fea90137d48..3b9610cb0d3 100644 --- a/clang-tools-extra/unittests/clangd/XRefsTests.cpp +++ b/clang-tools-extra/unittests/clangd/XRefsTests.cpp @@ -350,6 +350,58 @@ TEST(LocateSymbol, All) { FF(); void f() { T^est a; } )cpp", + + R"cpp(// explicit template specialization + template <typename T> + struct Foo { void bar() {} }; + + template <> + struct [[Foo]]<int> { void bar() {} }; + + void foo() { + Foo<char> abc; + Fo^o<int> b; + } + )cpp", + + R"cpp(// implicit template specialization + template <typename T> + struct [[Foo]] { void bar() {} }; + template <> + struct Foo<int> { void bar() {} }; + void foo() { + Fo^o<char> abc; + Foo<int> b; + } + )cpp", + + R"cpp(// partial template specialization + template <typename T> + struct Foo { void bar() {} }; + template <typename T> + struct [[Foo]]<T*> { void bar() {} }; + ^Foo<int*> x; + )cpp", + + R"cpp(// function template specializations + template <class T> + void foo(T) {} + template <> + void [[foo]](int) {} + void bar() { + fo^o(10); + } + )cpp", + + R"cpp(// variable template decls + template <class T> + T var = T(); + + template <> + double [[var]]<int> = 10; + + double y = va^r<int>; + )cpp", }; for (const char *Test : Tests) { Annotations T(Test); |

