diff options
author | John McCall <rjmccall@apple.com> | 2009-10-29 08:12:44 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-10-29 08:12:44 +0000 |
commit | 833ca991c1bfc967f0995974ca86f66ba1f666b5 (patch) | |
tree | 54ce834e6510eae21e5cff09573c986e6ee7ca12 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 275c10a8a4a43219f67d8d2c912ec6294d9d9af2 (diff) |
Track source information for template arguments and template specialization
types. Preserve it through template instantiation. Preserve it through PCH,
although TSTs themselves aren't serializable, so that's pretty much meaningless.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85500 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 50b0fb81d7..0b54533175 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -886,14 +886,13 @@ Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl( // FIXME: Do we actually want to perform substitution here? I don't think // we do. if (D->hasDefaultArgument()) { - QualType DefaultPattern = D->getDefaultArgument(); - QualType DefaultInst + DeclaratorInfo *DefaultPattern = D->getDefaultArgumentInfo(); + DeclaratorInfo *DefaultInst = SemaRef.SubstType(DefaultPattern, TemplateArgs, D->getDefaultArgumentLoc(), D->getDeclName()); Inst->setDefaultArgument(DefaultInst, - D->getDefaultArgumentLoc(), D->defaultArgumentWasInherited() /* preserve? */); } @@ -1026,16 +1025,15 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization( // Substitute into the template arguments of the class template partial // specialization. - const TemplateArgumentList &PartialSpecTemplateArgs - = PartialSpec->getTemplateInstantiationArgs(); - llvm::SmallVector<TemplateArgument, 4> InstTemplateArgs; - for (unsigned I = 0, N = PartialSpecTemplateArgs.size(); I != N; ++I) { - TemplateArgument Inst = SemaRef.Subst(PartialSpecTemplateArgs[I], - TemplateArgs); - if (Inst.isNull()) + const TemplateArgumentLoc *PartialSpecTemplateArgs + = PartialSpec->getTemplateArgsAsWritten(); + unsigned N = PartialSpec->getNumTemplateArgsAsWritten(); + + llvm::SmallVector<TemplateArgumentLoc, 4> InstTemplateArgs(N); + for (unsigned I = 0; I != N; ++I) { + if (SemaRef.Subst(PartialSpecTemplateArgs[I], InstTemplateArgs[I], + TemplateArgs)) return true; - - InstTemplateArgs.push_back(Inst); } @@ -1116,6 +1114,8 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization( InstParams, ClassTemplate, Converted, + InstTemplateArgs.data(), + InstTemplateArgs.size(), 0); InstPartialSpec->setInstantiatedFromMember(PartialSpec); InstPartialSpec->setTypeAsWritten(WrittenTy); |