Preserve source information when substituting into VarDecls.

llvm-svn: 84733
This commit is contained in:
John McCall 2009-10-21 02:39:02 +00:00
parent 5b5cb92816
commit f1abcdcddd
1 changed files with 6 additions and 5 deletions

View File

@ -123,16 +123,17 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) {
Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
// Do substitution on the type of the declaration
QualType T = SemaRef.SubstType(D->getType(), TemplateArgs,
D->getTypeSpecStartLoc(),
D->getDeclName());
if (T.isNull())
DeclaratorInfo *DI = SemaRef.SubstType(D->getDeclaratorInfo(),
TemplateArgs,
D->getTypeSpecStartLoc(),
D->getDeclName());
if (!DI)
return 0;
// Build the instantiated declaration
VarDecl *Var = VarDecl::Create(SemaRef.Context, Owner,
D->getLocation(), D->getIdentifier(),
T, D->getDeclaratorInfo(),
DI->getType(), DI,
D->getStorageClass());
Var->setThreadSpecified(D->isThreadSpecified());
Var->setCXXDirectInitializer(D->hasCXXDirectInitializer());