aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-19 17:02:02 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-19 17:02:02 +0000
commit61f438ac38cb7ccd40e77861b19f34553694416f (patch)
tree1d136db95adad1a07ad2a463b7796f9c0dfc27e5 /lib/Sema/SemaTemplateInstantiateDecl.cpp
parent92c3a04f3ec683f279814b0eb6d6271b3fd3a219 (diff)
NonTypeTemplateParmDecls always have TypeSourceInfo. There's no sense
in pretending otherwise. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123839 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 76e7406c51..b4ccdd572d 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -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());