[clang] [Clang][AST] Store injected template arguments in TemplateParameterList (PR #113579)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 25 10:35:21 PDT 2024


================
@@ -51,14 +51,15 @@ DefaultTemplateArgumentContainsUnexpandedPack(const TemplateParam &P) {
          P.getDefaultArgument().getArgument().containsUnexpandedParameterPack();
 }
 
-TemplateParameterList::TemplateParameterList(const ASTContext& C,
+TemplateParameterList::TemplateParameterList(const ASTContext &C,
                                              SourceLocation TemplateLoc,
                                              SourceLocation LAngleLoc,
                                              ArrayRef<NamedDecl *> Params,
                                              SourceLocation RAngleLoc,
                                              Expr *RequiresClause)
-    : TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
-      NumParams(Params.size()), ContainsUnexpandedParameterPack(false),
+    : InjectedArgs(&C), TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc),
----------------
erichkeane wrote:

Honestly, I strongly dislike it there as well.  It seems like quite a hacky way of getting our intended behavior here that is jarring/unreadable every time I see it.  I also think that there is some level of awkwardness to doing an allocation in a function whose type doesn't really look like it should be able to allocate.

https://github.com/llvm/llvm-project/pull/113579


More information about the cfe-commits mailing list