diff options
author | John McCall <rjmccall@apple.com> | 2009-10-21 02:39:02 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-10-21 02:39:02 +0000 |
commit | f1abcdcddd9886f2cb87b6c4df1fac686483b4bd (patch) | |
tree | 193ccc354594dc795731e1a7b9234629ad290a77 | |
parent | 5b5cb928161d34b1fa989714618ced54630a1b84 (diff) | |
download | bcm5719-llvm-f1abcdcddd9886f2cb87b6c4df1fac686483b4bd.tar.gz bcm5719-llvm-f1abcdcddd9886f2cb87b6c4df1fac686483b4bd.zip |
Preserve source information when substituting into VarDecls.
llvm-svn: 84733
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 4bbef29de0b..0a753838425 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -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()); |