aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-10-21 00:58:09 +0000
committerJohn McCall <rjmccall@apple.com>2009-10-21 00:58:09 +0000
commitcd7ba1c183bbe09a4c9ca5b58a35ef5374ec0882 (patch)
tree45c93d85ff9061f5d9b56bdc2547f45f1221c873
parent4802a311f402836f1f226a3d7a87e6a3088f9704 (diff)
Clone Sema::SubstType for DeclaratorInfos.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84724 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/Sema.h4
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp16
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 4ad3deaadf..0b55ecd770 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -3152,6 +3152,10 @@ public:
void PerformPendingImplicitInstantiations();
+ DeclaratorInfo *SubstType(DeclaratorInfo *T,
+ const MultiLevelTemplateArgumentList &TemplateArgs,
+ SourceLocation Loc, DeclarationName Entity);
+
QualType SubstType(QualType T,
const MultiLevelTemplateArgumentList &TemplateArgs,
SourceLocation Loc, DeclarationName Entity);
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 9b9fc00848..53d158088c 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -702,6 +702,22 @@ TemplateInstantiator::TransformTemplateTypeParmType(TypeLocBuilder &TLB,
///
/// \returns If the instantiation succeeds, the instantiated
/// type. Otherwise, produces diagnostics and returns a NULL type.
+DeclaratorInfo *Sema::SubstType(DeclaratorInfo *T,
+ const MultiLevelTemplateArgumentList &Args,
+ SourceLocation Loc,
+ DeclarationName Entity) {
+ assert(!ActiveTemplateInstantiations.empty() &&
+ "Cannot perform an instantiation without some context on the "
+ "instantiation stack");
+
+ if (!T->getType()->isDependentType())
+ return T;
+
+ TemplateInstantiator Instantiator(*this, Args, Loc, Entity);
+ return Instantiator.TransformType(T);
+}
+
+/// Deprecated form of the above.
QualType Sema::SubstType(QualType T,
const MultiLevelTemplateArgumentList &TemplateArgs,
SourceLocation Loc, DeclarationName Entity) {