[clang] [clang-tools-extra] [Clang] Add a builtin that deduplicate types into a pack (PR #106730)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 14 07:07:26 PDT 2025
================
@@ -1700,6 +1717,21 @@ namespace {
return inherited::TransformTemplateArgument(Input, Output, Uneval);
}
+ using TreeTransform::TransformTemplateSpecializationType;
+ QualType
+ TransformTemplateSpecializationType(TypeLocBuilder &TLB,
+ TemplateSpecializationTypeLoc TL) {
+ auto *T = TL.getTypePtr();
+ if (!getSema().ArgPackSubstIndex || !T->isSugared() ||
+ !isPackProducingBuiltinTemplateName(T->getTemplateName()))
+ return TreeTransform::TransformTemplateSpecializationType(TLB, TL);
+ // Look through sugar to get to the SubstBuiltinTemplatePackType that we
+ // need to substitute into.
+ QualType R = TransformType(T->desugar());
+ TLB.pushTrivial(getSema().getASTContext(), R, TL.getBeginLoc());
+ return R;
+ }
----------------
ilya-biryukov wrote:
> But I'd think you be able to build a new AST Node which is basically a stripped down base class of PackIndexType which would be a good fit for this, and that's not as much work as building something from scratch.
Extracting a shared base definitely seems like a good, left a FIXME for now, will make sure to follow up on that.
https://github.com/llvm/llvm-project/pull/106730
More information about the cfe-commits
mailing list