@@ -71,6 +71,9 @@ NamedDecl *getAsNamedDecl(TemplateParameter P);
7171class TemplateParameterList final
7272 : private llvm::TrailingObjects<TemplateParameterList, NamedDecl *,
7373 Expr *> {
74+ // / The template argument list of the template parameter list.
75+ TemplateArgument *InjectedArgs = nullptr ;
76+
7477 // / The location of the 'template' keyword.
7578 SourceLocation TemplateLoc;
7679
@@ -196,6 +199,9 @@ class TemplateParameterList final
196199
197200 bool hasAssociatedConstraints () const ;
198201
202+ // / Get the template argument list of the template parameter list.
203+ ArrayRef<TemplateArgument> getInjectedTemplateArgs (const ASTContext &Context);
204+
199205 SourceLocation getTemplateLoc () const { return TemplateLoc; }
200206 SourceLocation getLAngleLoc () const { return LAngleLoc; }
201207 SourceLocation getRAngleLoc () const { return RAngleLoc; }
@@ -793,15 +799,6 @@ class RedeclarableTemplateDecl : public TemplateDecl,
793799 // / The first value in the array is the number of specializations/partial
794800 // / specializations that follow.
795801 GlobalDeclID *LazySpecializations = nullptr ;
796-
797- // / The set of "injected" template arguments used within this
798- // / template.
799- // /
800- // / This pointer refers to the template arguments (there are as
801- // / many template arguments as template parameters) for the
802- // / template, and is allocated lazily, since most templates do not
803- // / require the use of this information.
804- TemplateArgument *InjectedArgs = nullptr ;
805802 };
806803
807804 // / Pointer to the common data shared by all declarations of this
@@ -927,7 +924,10 @@ class RedeclarableTemplateDecl : public TemplateDecl,
927924 // / Although the C++ standard has no notion of the "injected" template
928925 // / arguments for a template, the notion is convenient when
929926 // / we need to perform substitutions inside the definition of a template.
930- ArrayRef<TemplateArgument> getInjectedTemplateArgs ();
927+ ArrayRef<TemplateArgument>
928+ getInjectedTemplateArgs (const ASTContext &Context) const {
929+ return getTemplateParameters ()->getInjectedTemplateArgs (Context);
930+ }
931931
932932 using redecl_range = redeclarable_base::redecl_range;
933933 using redecl_iterator = redeclarable_base::redecl_iterator;
@@ -2087,10 +2087,6 @@ class ClassTemplatePartialSpecializationDecl
20872087 // / The list of template parameters
20882088 TemplateParameterList *TemplateParams = nullptr ;
20892089
2090- // / The set of "injected" template arguments used within this
2091- // / partial specialization.
2092- TemplateArgument *InjectedArgs = nullptr ;
2093-
20942090 // / The class template partial specialization from which this
20952091 // / class template partial specialization was instantiated.
20962092 // /
@@ -2136,9 +2132,11 @@ class ClassTemplatePartialSpecializationDecl
21362132 return TemplateParams;
21372133 }
21382134
2139- // / Retrieve the template arguments list of the template parameter list
2140- // / of this template.
2141- ArrayRef<TemplateArgument> getInjectedTemplateArgs ();
2135+ // / Get the template argument list of the template parameter list.
2136+ ArrayRef<TemplateArgument>
2137+ getInjectedTemplateArgs (const ASTContext &Context) const {
2138+ return getTemplateParameters ()->getInjectedTemplateArgs (Context);
2139+ }
21422140
21432141 // / \brief All associated constraints of this partial specialization,
21442142 // / including the requires clause and any constraints derived from
@@ -2864,10 +2862,6 @@ class VarTemplatePartialSpecializationDecl
28642862 // / The list of template parameters
28652863 TemplateParameterList *TemplateParams = nullptr ;
28662864
2867- // / The set of "injected" template arguments used within this
2868- // / partial specialization.
2869- TemplateArgument *InjectedArgs = nullptr ;
2870-
28712865 // / The variable template partial specialization from which this
28722866 // / variable template partial specialization was instantiated.
28732867 // /
@@ -2914,9 +2908,11 @@ class VarTemplatePartialSpecializationDecl
29142908 return TemplateParams;
29152909 }
29162910
2917- // / Retrieve the template arguments list of the template parameter list
2918- // / of this template.
2919- ArrayRef<TemplateArgument> getInjectedTemplateArgs ();
2911+ // / Get the template argument list of the template parameter list.
2912+ ArrayRef<TemplateArgument>
2913+ getInjectedTemplateArgs (const ASTContext &Context) const {
2914+ return getTemplateParameters ()->getInjectedTemplateArgs (Context);
2915+ }
29202916
29212917 // / \brief All associated constraints of this partial specialization,
29222918 // / including the requires clause and any constraints derived from
0 commit comments