aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-14 22:40:04 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-14 22:40:04 +0000
commit6a24bfda084f06a0b252b7befe8cbb17fce7f94e (patch)
treed8c6f97bb8b00178d8327dbf9a5ee25af3963186 /lib/Sema/SemaTemplateInstantiate.cpp
parentc39b5e867df74904ac7e50d225b3cca0db43571f (diff)
Handle substitutions into function parameter packs whose patterns
contain multiple parameter packs at different levels. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index c181a568b5..13cc17ef53 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -705,7 +705,8 @@ namespace {
QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
FunctionProtoTypeLoc TL);
- ParmVarDecl *TransformFunctionTypeParam(ParmVarDecl *OldParm);
+ ParmVarDecl *TransformFunctionTypeParam(ParmVarDecl *OldParm,
+ llvm::Optional<unsigned> NumExpansions);
/// \brief Transforms a template type parameter type by performing
/// substitution of the corresponding template type argument.
@@ -1000,8 +1001,10 @@ QualType TemplateInstantiator::TransformFunctionProtoType(TypeLocBuilder &TLB,
}
ParmVarDecl *
-TemplateInstantiator::TransformFunctionTypeParam(ParmVarDecl *OldParm) {
- return SemaRef.SubstParmVarDecl(OldParm, TemplateArgs);
+TemplateInstantiator::TransformFunctionTypeParam(ParmVarDecl *OldParm,
+ llvm::Optional<unsigned> NumExpansions) {
+ return SemaRef.SubstParmVarDecl(OldParm, TemplateArgs,
+ NumExpansions);
}
QualType
@@ -1241,7 +1244,8 @@ TypeSourceInfo *Sema::SubstFunctionDeclType(TypeSourceInfo *T,
}
ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
- const MultiLevelTemplateArgumentList &TemplateArgs) {
+ const MultiLevelTemplateArgumentList &TemplateArgs,
+ llvm::Optional<unsigned> NumExpansions) {
TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo();
TypeSourceInfo *NewDI = 0;
@@ -1260,9 +1264,8 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
// We still have unexpanded parameter packs, which means that
// our function parameter is still a function parameter pack.
// Therefore, make its type a pack expansion type.
- // FIXME: Variadic templates num expansions.
NewDI = CheckPackExpansion(NewDI, ExpansionTL.getEllipsisLoc(),
- llvm::Optional<unsigned>());
+ NumExpansions);
}
} else {
NewDI = SubstType(OldDI, TemplateArgs, OldParm->getLocation(),