diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-12 22:20:26 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-12 22:20:26 +0000 |
commit | b970d0ca9d2e7ad8eecc5bdb2aa1bb959317b304 (patch) | |
tree | a9a5fd714013bfadae74e5ff4ac2e5d4ba443f48 /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | dd772264f45da4ab884134e82def16b93545291e (diff) | |
download | bcm5719-llvm-b970d0ca9d2e7ad8eecc5bdb2aa1bb959317b304.tar.gz bcm5719-llvm-b970d0ca9d2e7ad8eecc5bdb2aa1bb959317b304.zip |
Store the type of the integral value within a TemplateArgument, so that we can more efficiently reconstruct an IntegerLiteral from it during template instantiation
llvm-svn: 66833
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 6ed4d9fb445..6252e29e568 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -595,19 +595,11 @@ TemplateExprInstantiator::VisitDeclRefExpr(DeclRefExpr *E) { Decl *D = E->getDecl(); if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D)) { assert(NTTP->getDepth() == 0 && "No nested templates yet"); - QualType T = NTTP->getType(); - if (T->isDependentType()) { - // FIXME: We'll be doing this instantiation a lot. Should we - // cache this information in the TemplateArgument itself? - T = SemaRef.InstantiateType(T, TemplateArgs, NumTemplateArgs, - E->getSourceRange().getBegin(), - NTTP->getDeclName()); - if (T.isNull()) - return SemaRef.ExprError(); - } + const TemplateArgument &Arg = TemplateArgs[NTTP->getPosition()]; return SemaRef.Owned(new (SemaRef.Context) IntegerLiteral( - *TemplateArgs[NTTP->getPosition()].getAsIntegral(), - T, E->getSourceRange().getBegin())); + *Arg.getAsIntegral(), + Arg.getIntegralType(), + E->getSourceRange().getBegin())); } else assert(false && "Can't handle arbitrary declaration references"); |