]> granicus.if.org Git - clang/commitdiff
NonTypeTemplateParmDecls always have TypeSourceInfo. There's no sense
authorDouglas Gregor <dgregor@apple.com>
Wed, 19 Jan 2011 17:02:02 +0000 (17:02 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 19 Jan 2011 17:02:02 +0000 (17:02 +0000)
in pretending otherwise.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123839 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiateDecl.cpp

index 76e7406c51e9c58d5f44663921eec8d3abf298bb..b4ccdd572df3cceee032394c5891a9806a8dc43d 100644 (file)
@@ -1456,19 +1456,13 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
                                                  NonTypeTemplateParmDecl *D) {
   // Substitute into the type of the non-type template parameter.
   QualType T;
-  TypeSourceInfo *DI = D->getTypeSourceInfo();
-  if (DI) {
-    DI = SemaRef.SubstType(DI, TemplateArgs, D->getLocation(),
+  TypeSourceInfo *DI = SemaRef.SubstType(D->getTypeSourceInfo(), TemplateArgs, D->getLocation(),
                            D->getDeclName());
-    if (DI) T = DI->getType();
-  } else {
-    T = SemaRef.SubstType(D->getType(), TemplateArgs, D->getLocation(),
-                          D->getDeclName());
-    DI = 0;
-  }
-  if (T.isNull())
+  if (!DI)
     return 0;
   
+  T = DI->getType();
+  
   // Check that this type is acceptable for a non-type template parameter.
   bool Invalid = false;
   T = SemaRef.CheckNonTypeTemplateParameterType(T, D->getLocation());