[all-commits] [llvm/llvm-project] d73f71: [clang] AST: remove DependentTemplateSpecializatio...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Thu Sep 11 09:23:09 PDT 2025


  Branch: refs/heads/users/mizvekov/remove-dtst
  Home:   https://github.com/llvm/llvm-project
  Commit: d73f711c80f334eb878ba1a313b259f38f974687
      https://github.com/llvm/llvm-project/commit/d73f711c80f334eb878ba1a313b259f38f974687
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2025-09-11 (Thu, 11 Sep 2025)

  Changed paths:
    M clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
    M clang-tools-extra/clangd/FindTarget.cpp
    M clang-tools-extra/clangd/SemanticHighlighting.cpp
    M clang-tools-extra/clangd/unittests/FindTargetTests.cpp
    M clang-tools-extra/include-cleaner/lib/WalkAST.cpp
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/AST/ASTNodeTraverser.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/AST/TemplateName.h
    M clang/include/clang/AST/TypeBase.h
    M clang/include/clang/AST/TypeLoc.h
    M clang/include/clang/AST/TypeProperties.td
    M clang/include/clang/ASTMatchers/ASTMatchers.h
    M clang/include/clang/Basic/TypeNodes.td
    M clang/include/clang/Sema/HeuristicResolver.h
    M clang/include/clang/Sema/Sema.h
    M clang/include/clang/Serialization/TypeBitCodes.def
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/ASTStructuralEquivalence.cpp
    M clang/lib/AST/ASTTypeTraits.cpp
    M clang/lib/AST/DeclTemplate.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/MicrosoftMangle.cpp
    M clang/lib/AST/ODRHash.cpp
    M clang/lib/AST/TemplateName.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/AST/TypeLoc.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/ASTMatchers/ASTMatchersInternal.cpp
    M clang/lib/ASTMatchers/Dynamic/Registry.cpp
    M clang/lib/Sema/HeuristicResolver.cpp
    M clang/lib/Sema/SemaAttr.cpp
    M clang/lib/Sema/SemaCXXScopeSpec.cpp
    M clang/lib/Sema/SemaCoroutine.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
    M clang/lib/Tooling/Syntax/BuildTree.cpp
    M clang/test/AST/ast-dump-templates.cpp
    M clang/tools/libclang/CIndex.cpp
    M clang/tools/libclang/CXIndexDataConsumer.cpp
    M clang/unittests/AST/ASTImporterTest.cpp
    M clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

  Log Message:
  -----------
  [clang] AST: remove DependentTemplateSpecializationType

A DependentTemplateSpecializationType (DTST) is basically just a
TemplateSpecializationType (TST) with a hardcoded DependentTemplateName (DTN)
as its TemplateName.

This removes the DTST and replaces all uses of it with a TST, removing
a lot of duplication in the implementation.

Technically the hardcoded DTN is an optimization for a most common case, but
the TST implementation is in better shape overall and with other optimizations,
so this patch ends up being an overall performance positive:

A DTST also didn't allow a template name representing a DependentTemplateName
that was substituted from an alias templates, while the TST does by the simple
fact it can hold an arbitrary TemplateName, so this patch also increases the
amount of sugar retained, while still being faster overall.

Example (from included test case):
```C++
template<template<class> class TT> using T1 = TT<int>;
template<class T> using T2 = T1<T::template X>;
```

Here we can now represent in the AST that `TT` was substituted for the dependent
template name `T::template X`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list