[PATCH] D65510: [clangd] Fix implicit template instatiations appearing as topLevelDecls.

Johan Vikström via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 07:21:01 PDT 2019


jvikstrom marked 2 inline comments as done.
jvikstrom added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/ClangdUnitTests.cpp:110
+    template<typename T>
+    void f(T) {}
+    void s() {
----------------
ilya-biryukov wrote:
> Could you also check that:
> 
> 1.  explicit specializations are present
> ```
> template <>
> void f(bool) {}
> ```
> 2. explicit instantiations are absent
> ```
> template void f(bool);
> ```
> 3. partial specializations are present (they should not be affected by this change, but testing those here seems appropriate)
> ```
> template <class T>
> struct vector {};
> 
> template <class T>
> struct vector<T*> {}; // partial specialization, should be present
> ```
> 4. template variables and classes are also handled:
> ```
> template <class T>
> T foo = 10; // (!) requires C++17
> ```
Explicit instantiations are present in topLevelDecls though, otherwise RecursiveASTVisitor would not traverse them (so adding a test to make sure explicit instantiations are included in toplevel).

Also adding a test to SemanticHighlighting to make sure that explicit instantiations are visited in that (is some other RecursiveASTVisitor usage I should add this to instead?)



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65510





More information about the cfe-commits mailing list