Reland "[AST] Add a new TemplateKind for template decls found via a using decl.""
authorHaojian Wu <hokein.wu@gmail.com>
Tue, 12 Apr 2022 13:51:16 +0000 (15:51 +0200)
committerHaojian Wu <hokein.wu@gmail.com>
Thu, 14 Apr 2022 09:04:55 +0000 (11:04 +0200)
commit6ba1b9075dc1fef6c32eafa71495bfec803321e4
tree79a56fc0dd13988939ccfb1597757f09254d86e6
parent49b39c4f2e4b0dfac3eff10cfed309a13a243c59
Reland "[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]