Only set the point of instantiation for an implicit or explicit
instantiation once we have committed to performing the
instantiation. As part of this, make our makeshift
template-instantiation location information suck slightly less.
Fixes PR5264.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85209 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 872b3c0..15b1520 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -1884,6 +1884,7 @@
return Arg;
case TemplateArgument::Type: {
+ TemporaryBase Rebase(*this, Arg.getLocation(), DeclarationName());
QualType T = getDerived().TransformType(Arg.getAsType());
if (T.isNull())
return TemplateArgument();
@@ -1891,6 +1892,10 @@
}
case TemplateArgument::Declaration: {
+ DeclarationName Name;
+ if (NamedDecl *ND = dyn_cast<NamedDecl>(Arg.getAsDecl()))
+ Name = ND->getDeclName();
+ TemporaryBase Rebase(*this, Arg.getLocation(), Name);
Decl *D = getDerived().TransformDecl(Arg.getAsDecl());
if (!D)
return TemplateArgument();