]> granicus.if.org Git - clang/commitdiff
Preserve source information when substituting into VarDecls.
authorJohn McCall <rjmccall@apple.com>
Wed, 21 Oct 2009 02:39:02 +0000 (02:39 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 21 Oct 2009 02:39:02 +0000 (02:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84733 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiateDecl.cpp

index 4bbef29de0ba93d8f490e656dc1e20ec6e4a31b0..0a75383842545f2514e3c3cf13a9d80c46294b7c 100644 (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());