ilya-biryukov added inline comments.
================
Comment at: clang-tools-extra/clangd/AST.h:86
+bool isImplicitTemplateInstantiation(const NamedDecl *D);
+bool isExplicitTemplateSpecialization(const NamedDecl *D);
----------------
Could you add a small comment with an example?
```
/// Indicates \p D is a template instantiation implicitly generated by the
compiler, e.g.
/// template <class T> struct vector {};
/// vector<int> v; // 'vector<int>' is an implicit instantiation
bool isImplicitTemplateInstantiation(const NamedDecl *D);
/// Indicates \p D is an explicit template specialization, e.g.
/// template <class T> struct vector {};
/// template <> struct vector<bool> {}; // <-- explicit specialization
///
/// Note that explicit instantiations are NOT explicit specializations, albeit
they look similar.
/// template struct vector<bool>; // <-- explicit instantiation, NOT an
explicit specialization.
bool isExplicitTemplateSpecialization(const NamedDecl *D);
```
================
Comment at: clang-tools-extra/clangd/unittests/ClangdUnitTests.cpp:110
+ template<typename T>
+ void f(T) {}
+ void s() {
----------------
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
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65510/new/
https://reviews.llvm.org/D65510
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits