[PATCH] D123127: [AST] Add a new TemplateName for templates found via a using declaration.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 5 06:32:21 PDT 2022


hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman, martong, mgorny.
Herald added a reviewer: shafik.
Herald added a project: All.
hokein requested review of this revision.
Herald added a subscriber: ilya-biryukov.
Herald added projects: clang, clang-tools-extra.

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

This patch introduces a new sugar template name (UsingTemplateName), which stores
the found using-shadow decl and underlying template name. With the new
template name, we can be able to find the using decl that a template
typeloc (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:

- add ast matchers for matching different kinds of template names.
- update the clangd and other tools to use this new node.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123127

Files:
  clang-tools-extra/clangd/DumpAST.cpp
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  clang/include/clang/AST/ASTContext.h
  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/lib/Tooling/CMakeLists.txt
  clang/test/AST/ast-dump-using-template.cpp
  clang/tools/libclang/CIndex.cpp
  clang/unittests/AST/ASTImporterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123127.420485.patch
Type: text/x-patch
Size: 21336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220405/9f53dd48/attachment-0001.bin>


More information about the cfe-commits mailing list