aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateVariadic.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-14 21:20:45 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-14 21:20:45 +0000
commit67fd1251aad51bb80d050b7fa5e506fef0ec8e02 (patch)
tree81040f6a18824db5f621b6488343e4216e7c2d16 /lib/Sema/SemaTemplateVariadic.cpp
parent3efd52cf8f4e57c5571bd8cc3168264c3bc46a1e (diff)
Teach PackExpansionExpr to keep track of the number of pack expansions
it will expand to, if known. Propagate this information throughout Sema. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateVariadic.cpp')
-rw-r--r--lib/Sema/SemaTemplateVariadic.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Sema/SemaTemplateVariadic.cpp b/lib/Sema/SemaTemplateVariadic.cpp
index 899b58e558..38a777efb1 100644
--- a/lib/Sema/SemaTemplateVariadic.cpp
+++ b/lib/Sema/SemaTemplateVariadic.cpp
@@ -415,6 +415,11 @@ QualType Sema::CheckPackExpansion(QualType Pattern,
}
ExprResult Sema::ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc) {
+ return CheckPackExpansion(Pattern, EllipsisLoc, llvm::Optional<unsigned>());
+}
+
+ExprResult Sema::CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
+ llvm::Optional<unsigned> NumExpansions) {
if (!Pattern)
return ExprError();
@@ -430,7 +435,7 @@ ExprResult Sema::ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc) {
// Create the pack expansion expression and source-location information.
return Owned(new (Context) PackExpansionExpr(Context.DependentTy, Pattern,
- EllipsisLoc));
+ EllipsisLoc, NumExpansions));
}
/// \brief Retrieve the depth and index of a parameter pack.
@@ -459,10 +464,6 @@ bool Sema::CheckParameterPacksForExpansion(SourceLocation EllipsisLoc,
std::pair<IdentifierInfo *, SourceLocation> FirstPack;
bool HaveFirstPack = false;
- // FIXME: Variadic templates. Even if we don't expand, we'd still like to
- // return the number of expansions back to the caller, perhaps as an
- // llvm::Optional, so that it can be embedded in the pack expansion. This
- // is important for the multi-level substitution case.
for (unsigned I = 0; I != NumUnexpanded; ++I) {
// Compute the depth and index for this parameter pack.
unsigned Depth;