@@ -31,8 +31,6 @@ namespace {
31
31
DeclContext *Owner;
32
32
const MultiLevelTemplateArgumentList &TemplateArgs;
33
33
34
- void InstantiateAttrs (Decl *Tmpl, Decl *New);
35
-
36
34
public:
37
35
typedef Sema::OwningExprResult OwningExprResult;
38
36
@@ -144,28 +142,29 @@ bool TemplateDeclInstantiator::SubstQualifier(const TagDecl *OldDecl,
144
142
}
145
143
146
144
// FIXME: Is this still too simple?
147
- void TemplateDeclInstantiator::InstantiateAttrs (Decl *Tmpl, Decl *New) {
145
+ void Sema::InstantiateAttrs (const MultiLevelTemplateArgumentList &TemplateArgs,
146
+ Decl *Tmpl, Decl *New) {
148
147
for (const Attr *TmplAttr = Tmpl->getAttrs (); TmplAttr;
149
148
TmplAttr = TmplAttr->getNext ()) {
150
149
// FIXME: This should be generalized to more than just the AlignedAttr.
151
150
if (const AlignedAttr *Aligned = dyn_cast<AlignedAttr>(TmplAttr)) {
152
151
if (Aligned->isDependent ()) {
153
152
// The alignment expression is not potentially evaluated.
154
- EnterExpressionEvaluationContext Unevaluated (SemaRef ,
153
+ EnterExpressionEvaluationContext Unevaluated (* this ,
155
154
Action::Unevaluated);
156
155
157
- OwningExprResult Result = SemaRef. SubstExpr (Aligned->getAlignmentExpr (),
158
- TemplateArgs);
156
+ OwningExprResult Result = SubstExpr (Aligned->getAlignmentExpr (),
157
+ TemplateArgs);
159
158
if (!Result.isInvalid ())
160
159
// FIXME: Is this the correct source location?
161
- SemaRef. AddAlignedAttr (Aligned->getAlignmentExpr ()->getExprLoc (),
162
- New, Result.takeAs <Expr>());
160
+ AddAlignedAttr (Aligned->getAlignmentExpr ()->getExprLoc (),
161
+ New, Result.takeAs <Expr>());
163
162
continue ;
164
163
}
165
164
}
166
165
167
166
// FIXME: Is cloning correct for all attributes?
168
- Attr *NewAttr = TmplAttr->clone (SemaRef. Context );
167
+ Attr *NewAttr = TmplAttr->clone (Context);
169
168
New->addAttr (NewAttr);
170
169
}
171
170
}
@@ -234,7 +233,7 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) {
234
233
Typedef->setPreviousDeclaration (cast<TypedefDecl>(InstPrev));
235
234
}
236
235
237
- InstantiateAttrs (D, Typedef);
236
+ SemaRef. InstantiateAttrs (TemplateArgs, D, Typedef);
238
237
239
238
Typedef->setAccess (D->getAccess ());
240
239
Owner->addDecl (Typedef);
@@ -399,7 +398,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
399
398
if (Owner->isFunctionOrMethod ())
400
399
SemaRef.CurrentInstantiationScope ->InstantiatedLocal (D, Var);
401
400
}
402
- InstantiateAttrs (D, Var);
401
+ SemaRef. InstantiateAttrs (TemplateArgs, D, Var);
403
402
404
403
// Link instantiations of static data members back to the template from
405
404
// which they were instantiated.
@@ -518,7 +517,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
518
517
return 0 ;
519
518
}
520
519
521
- InstantiateAttrs (D, Field);
520
+ SemaRef. InstantiateAttrs (TemplateArgs, D, Field);
522
521
523
522
if (Invalid)
524
523
Field->setInvalidDecl ();
@@ -1975,7 +1974,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
1975
1974
Proto->getExtInfo ()));
1976
1975
}
1977
1976
1978
- InstantiateAttrs (Tmpl, New);
1977
+ SemaRef. InstantiateAttrs (TemplateArgs, Tmpl, New);
1979
1978
1980
1979
return false ;
1981
1980
}
0 commit comments