Implement support for pack expansions in initializer lists and
expression lists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122764 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 92bbbd7..be5c7d7 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -172,8 +172,8 @@
/// = *= /= %= += -= <<= >>= &= ^= |=
///
/// expression: [C99 6.5.17]
-/// assignment-expression
-/// expression ',' assignment-expression
+/// assignment-expression ...[opt]
+/// expression ',' assignment-expression ...[opt]
///
ExprResult Parser::ParseExpression() {
ExprResult LHS(ParseAssignmentExpression());
@@ -1030,8 +1030,8 @@
/// '(' type-name ')' '{' initializer-list ',' '}'
///
/// argument-expression-list: [C99 6.5.2]
-/// argument-expression
-/// argument-expression-list ',' assignment-expression
+/// argument-expression ...[opt]
+/// argument-expression-list ',' assignment-expression ...[opt]
///
ExprResult
Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
@@ -1692,8 +1692,8 @@
/// argument-expression-list , assignment-expression
///
/// [C++] expression-list:
-/// [C++] assignment-expression
-/// [C++] expression-list , assignment-expression
+/// [C++] assignment-expression ...[opt]
+/// [C++] expression-list , assignment-expression ...[opt]
///
bool Parser::ParseExpressionList(llvm::SmallVectorImpl<Expr*> &Exprs,
llvm::SmallVectorImpl<SourceLocation> &CommaLocs,
@@ -1710,6 +1710,8 @@
}
ExprResult Expr(ParseAssignmentExpression());
+ if (Tok.is(tok::ellipsis))
+ Expr = Actions.ActOnPackExpansion(Expr.get(), ConsumeToken());
if (Expr.isInvalid())
return true;