From: John McCall Date: Wed, 21 Oct 2009 02:39:02 +0000 (+0000) Subject: Preserve source information when substituting into VarDecls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a5fa06a688e1086ea553a24b42b9915996ed1f7;p=clang Preserve source information when substituting into VarDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84733 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 4bbef29de0..0a75383842 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/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());