aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Tooling/Syntax/BuildTree.cpp
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2025-09-12 13:55:38 -0300
committerGitHub <noreply@github.com>2025-09-12 13:55:38 -0300
commitba9d1c41c41d568a798e0a8c38a89d294647c28d (patch)
tree948be2f45e5cdbf25aa9b61195a11865b7f093ef /clang/lib/Tooling/Syntax/BuildTree.cpp
parent615d07ea55ea57afab0205aa739239070448a038 (diff)
downloadllvm-ba9d1c41c41d568a798e0a8c38a89d294647c28d.zip
llvm-ba9d1c41c41d568a798e0a8c38a89d294647c28d.tar.gz
llvm-ba9d1c41c41d568a798e0a8c38a89d294647c28d.tar.bz2
[clang] AST: remove DependentTemplateSpecializationType (#158109)
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: <img width="1465" height="38" alt="image" src="https://github.com/user-attachments/assets/084b0694-2839-427a-b664-eff400f780b5" /> A DTST also didn't allow a template name representing a DTN that was substituted, such as from an alias template, while the TST does allow it 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`.
Diffstat (limited to 'clang/lib/Tooling/Syntax/BuildTree.cpp')
-rw-r--r--clang/lib/Tooling/Syntax/BuildTree.cpp7
1 files changed, 0 insertions, 7 deletions
diff --git a/clang/lib/Tooling/Syntax/BuildTree.cpp b/clang/lib/Tooling/Syntax/BuildTree.cpp
index b75f8ff..90fd1f9 100644
--- a/clang/lib/Tooling/Syntax/BuildTree.cpp
+++ b/clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -974,13 +974,6 @@ public:
BeginLoc = TST.getTemplateNameLoc();
return buildSimpleTemplateName({BeginLoc, TST.getEndLoc()});
}
- case TypeLoc::DependentTemplateSpecialization: {
- auto DT = TL.castAs<DependentTemplateSpecializationTypeLoc>();
- SourceLocation BeginLoc = DT.getTemplateKeywordLoc();
- if (BeginLoc.isInvalid())
- BeginLoc = DT.getTemplateNameLoc();
- return buildSimpleTemplateName({BeginLoc, DT.getEndLoc()});
- }
case TypeLoc::Decltype: {
const auto DTL = TL.castAs<DecltypeTypeLoc>();
if (!RecursiveASTVisitor::TraverseDecltypeTypeLoc(