[AST] Add a new TemplateKind for template decls found via a using decl.
authorHaojian Wu <hokein.wu@gmail.com>
Mon, 11 Apr 2022 12:44:46 +0000 (14:44 +0200)
committerHaojian Wu <hokein.wu@gmail.com>
Tue, 12 Apr 2022 08:48:23 +0000 (10:48 +0200)
commit5a5be4044f0bceb71bb6a81f6955704691b389ed
tree3bf71bf4568445d966ef506ccf288a3bb01acaa0
parent7d7771f34d14e0108adf02a6fd0b33943afae3da
[AST] Add a new TemplateKind for template decls found via a using decl.

This is the template version of https://reviews.llvm.org/D114251.

This patch introduces a new template name kind (UsingTemplateName). The
UsingTemplateName stores the found using-shadow decl (and underlying
template can be retrieved from the using-shadow decl). With the new
template name, we can be able to find the using decl that a template
typeloc (e.g. TemplateSpecializationTypeLoc) found its underlying template,
which is useful for tooling use cases (include cleaner etc).

This patch merely focuses on adding the node to the AST.

Next steps:
- support using-decl in qualified template name;
- update the clangd and other tools to use this new node;
- add ast matchers for matching different kinds of template names;

Differential Revision: https://reviews.llvm.org/D123127
22 files changed:
clang-tools-extra/clangd/DumpAST.cpp
clang-tools-extra/clangd/SemanticHighlighting.cpp
clang/include/clang/AST/PropertiesBase.td
clang/include/clang/AST/TemplateName.h
clang/include/clang/AST/TextNodeDumper.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/ASTStructuralEquivalence.cpp
clang/lib/AST/ItaniumMangle.cpp
clang/lib/AST/ODRHash.cpp
clang/lib/AST/TemplateName.cpp
clang/lib/AST/TextNodeDumper.cpp
clang/lib/AST/Type.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/test/AST/ast-dump-using-template.cpp [new file with mode: 0644]
clang/test/CXX/temp/temp.deduct.guide/p3.cpp
clang/tools/libclang/CIndex.cpp
clang/unittests/AST/ASTImporterTest.cpp
clang/unittests/AST/CMakeLists.txt
clang/unittests/AST/TemplateNameTest.cpp [new file with mode: 0644]