/// \brief Transform the definition of the given declaration by
/// instantiating it.
- Decl *TransformDefinition(Decl *D);
+ Decl *TransformDefinition(SourceLocation Loc, Decl *D);
/// \bried Transform the first qualifier within a scope by instantiating the
/// declaration.
return SemaRef.FindInstantiatedDecl(Loc, cast<NamedDecl>(D), TemplateArgs);
}
-Decl *TemplateInstantiator::TransformDefinition(Decl *D) {
+Decl *TemplateInstantiator::TransformDefinition(SourceLocation Loc, Decl *D) {
Decl *Inst = getSema().SubstDecl(D, getSema().CurContext, TemplateArgs);
if (!Inst)
return 0;
/// By default, invokes TransformDecl() to transform the declaration.
/// Subclasses may override this function to provide alternate behavior.
Decl *TransformDefinition(SourceLocation Loc, Decl *D) {
- return getDerived().TransformDecl(D);
+ return getDerived().TransformDecl(Loc, D);
}
/// \brief Transform the given declaration, which was the first part of a
if (S->getConditionVariable()) {
ConditionVar
= cast_or_null<VarDecl>(
- getDerived().TransformDefinition(S->getConditionVariable()));
+ getDerived().TransformDefinition(
+ S->getConditionVariable()->getLocation(),
+ S->getConditionVariable()));
if (!ConditionVar)
return SemaRef.StmtError();
} else {
if (S->getConditionVariable()) {
ConditionVar
= cast_or_null<VarDecl>(
- getDerived().TransformDefinition(S->getConditionVariable()));
+ getDerived().TransformDefinition(
+ S->getConditionVariable()->getLocation(),
+ S->getConditionVariable()));
if (!ConditionVar)
return SemaRef.StmtError();
} else {
if (S->getConditionVariable()) {
ConditionVar
= cast_or_null<VarDecl>(
- getDerived().TransformDefinition(S->getConditionVariable()));
+ getDerived().TransformDefinition(
+ S->getConditionVariable()->getLocation(),
+ S->getConditionVariable()));
if (!ConditionVar)
return SemaRef.StmtError();
} else {
if (S->getConditionVariable()) {
ConditionVar
= cast_or_null<VarDecl>(
- getDerived().TransformDefinition(S->getConditionVariable()));
+ getDerived().TransformDefinition(
+ S->getConditionVariable()->getLocation(),
+ S->getConditionVariable()));
if (!ConditionVar)
return SemaRef.StmtError();
} else {
llvm::SmallVector<Decl *, 4> Decls;
for (DeclStmt::decl_iterator D = S->decl_begin(), DEnd = S->decl_end();
D != DEnd; ++D) {
- Decl *Transformed = getDerived().TransformDefinition(*D);
+ Decl *Transformed = getDerived().TransformDefinition((*D)->getLocation(),
+ *D);
if (!Transformed)
return SemaRef.StmtError();