[PATCH] D49848: Parse a possible trailing postfix expression suffix after a fold expression

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 27 13:28:28 PDT 2018


rsmith added a comment.

Thanks, I like this approach a lot more.



================
Comment at: include/clang/Parse/Parser.h:1658
+    CastExpr,        // Also allow '(' type-name ')' <anything>
+    FoldExpr         // Also allow fold-expression <anything>
   };
----------------
This should be reordered up nearer the top (probably as the second enumerator); when we call `ParseParenExpression` with `ExprType == CastExpr` or `ExprType == CompoundLiteral`, we still want to parse `FoldExpr`s.


================
Comment at: lib/Parse/ParseExpr.cpp:2519-2563
   } else if (Tok.is(tok::ellipsis) &&
              isFoldOperator(NextToken().getKind())) {
+    ExprType = FoldExpr;
     return ParseFoldExpression(ExprResult(), T);
   } else if (isTypeCast) {
     // Parse the expression-list.
     InMessageExpressionRAIIObject InMessage(*this, false);
----------------
The cases where we parse a fold-expression should all be guarded by `ExprType >= FoldExpr`.


Repository:
  rC Clang

https://reviews.llvm.org/D49848





More information about the cfe-commits mailing list