[all-commits] [llvm/llvm-project] 6ba1b9: Reland "[AST] Add a new TemplateKind for template ...

Haojian Wu via All-commits all-commits at lists.llvm.org
Thu Apr 14 02:05:15 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6ba1b9075dc1fef6c32eafa71495bfec803321e4
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2022-04-14 (Thu, 14 Apr 2022)

  Changed paths:
    M clang-tools-extra/clangd/DumpAST.cpp
    M clang-tools-extra/clangd/SemanticHighlighting.cpp
    M clang/include/clang/AST/PropertiesBase.td
    M clang/include/clang/AST/TemplateName.h
    M clang/include/clang/AST/TextNodeDumper.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/ASTStructuralEquivalence.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/ODRHash.cpp
    M clang/lib/AST/TemplateName.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    A clang/test/AST/ast-dump-using-template.cpp
    M clang/test/CXX/temp/temp.deduct.guide/p3.cpp
    M clang/tools/libclang/CIndex.cpp
    M clang/unittests/AST/ASTImporterTest.cpp
    M clang/unittests/AST/CMakeLists.txt
    A clang/unittests/AST/TemplateNameTest.cpp

  Log Message:
  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

More information about the All-commits mailing list