Author: dgregor
Date: Wed Jan 19 11:02:02 2011
New Revision: 123839

URL: http://llvm.org/viewvc/llvm-project?rev=123839&view=rev
Log:
NonTypeTemplateParmDecls always have TypeSourceInfo. There's no sense
in pretending otherwise.

Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=123839&r1=123838&r2=123839&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Wed Jan 19 11:02:02 2011
@@ -1456,19 +1456,13 @@
                                                  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());


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to