@@ -1105,7 +1105,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
11051105 ParenExprType = ParenParseOption::CastExpr;
11061106 break ;
11071107 case CastParseKind::PrimaryExprOnly:
1108- ParenExprType = FoldExpr;
1108+ ParenExprType = ParenParseOption:: FoldExpr;
11091109 break ;
11101110 }
11111111 ParsedType CastTy;
@@ -1121,17 +1121,19 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
11211121 return Res;
11221122
11231123 switch (ParenExprType) {
1124- case SimpleExpr: break ; // Nothing else to do.
1125- case CompoundStmt: break ; // Nothing else to do.
1126- case CompoundLiteral:
1124+ case ParenParseOption::SimpleExpr:
1125+ break ; // Nothing else to do.
1126+ case ParenParseOption::CompoundStmt:
1127+ break ; // Nothing else to do.
1128+ case ParenParseOption::CompoundLiteral:
11271129 // We parsed '(' type-name ')' '{' ... '}'. If any suffixes of
11281130 // postfix-expression exist, parse them now.
11291131 break ;
1130- case CastExpr:
1132+ case ParenParseOption:: CastExpr:
11311133 // We have parsed the cast-expression and no postfix-expr pieces are
11321134 // following.
11331135 return Res;
1134- case FoldExpr:
1136+ case ParenParseOption:: FoldExpr:
11351137 // We only parsed a fold-expression. There might be postfix-expr pieces
11361138 // afterwards; parse them now.
11371139 break ;
@@ -2528,7 +2530,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok,
25282530 // type-name, or it is a unary-expression that starts with a compound
25292531 // literal, or starts with a primary-expression that is a parenthesized
25302532 // expression.
2531- ParenParseOption ExprType = CastExpr;
2533+ ParenParseOption ExprType = ParenParseOption:: CastExpr;
25322534 SourceLocation LParenLoc = Tok.getLocation (), RParenLoc;
25332535
25342536 Operand = ParseParenExpression (ExprType, true /* stopIfCastExpr*/ ,
@@ -2537,7 +2539,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok,
25372539
25382540 // If ParseParenExpression parsed a '(typename)' sequence only, then this is
25392541 // a type.
2540- if (ExprType == CastExpr) {
2542+ if (ExprType == ParenParseOption:: CastExpr) {
25412543 isCastExpr = true ;
25422544 return ExprEmpty ();
25432545 }
@@ -3095,7 +3097,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
30953097 cutOffParsing ();
30963098 Actions.CodeCompletion ().CodeCompleteExpression (
30973099 getCurScope (), PreferredType.get (Tok.getLocation ()),
3098- /* IsParenthesized=*/ ExprType >= CompoundLiteral);
3100+ /* IsParenthesized=*/ ExprType >= ParenParseOption:: CompoundLiteral);
30993101 return ExprError ();
31003102 }
31013103
@@ -3119,7 +3121,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
31193121
31203122 // None of these cases should fall through with an invalid Result
31213123 // unless they've already reported an error.
3122- if (ExprType >= CompoundStmt && Tok.is (tok::l_brace)) {
3124+ if (ExprType >= ParenParseOption:: CompoundStmt && Tok.is (tok::l_brace)) {
31233125 Diag (Tok, OpenLoc.isMacroID () ? diag::ext_gnu_statement_expr_macro
31243126 : diag::ext_gnu_statement_expr);
31253127
@@ -3142,7 +3144,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
31423144 Actions.ActOnStartStmtExpr ();
31433145
31443146 StmtResult Stmt (ParseCompoundStatement (true ));
3145- ExprType = CompoundStmt;
3147+ ExprType = ParenParseOption:: CompoundStmt;
31463148
31473149 // If the substmt parsed correctly, build the AST node.
31483150 if (!Stmt.isInvalid ()) {
@@ -3152,7 +3154,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
31523154 Actions.ActOnStmtExprError ();
31533155 }
31543156 }
3155- } else if (ExprType >= CompoundLiteral && BridgeCast) {
3157+ } else if (ExprType >= ParenParseOption:: CompoundLiteral && BridgeCast) {
31563158 tok::TokenKind tokenKind = Tok.getKind ();
31573159 SourceLocation BridgeKeywordLoc = ConsumeToken ();
31583160
@@ -3189,7 +3191,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
31893191 return Actions.ObjC ().ActOnObjCBridgedCast (getCurScope (), OpenLoc, Kind,
31903192 BridgeKeywordLoc, Ty.get (),
31913193 RParenLoc, SubExpr.get ());
3192- } else if (ExprType >= CompoundLiteral &&
3194+ } else if (ExprType >= ParenParseOption:: CompoundLiteral &&
31933195 isTypeIdInParens (isAmbiguousTypeId)) {
31943196
31953197 // Otherwise, this is a compound literal expression or cast expression.
@@ -3233,7 +3235,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
32333235 ColonProtection.restore ();
32343236 RParenLoc = T.getCloseLocation ();
32353237 if (Tok.is (tok::l_brace)) {
3236- ExprType = CompoundLiteral;
3238+ ExprType = ParenParseOption:: CompoundLiteral;
32373239 TypeResult Ty;
32383240 {
32393241 InMessageExpressionRAIIObject InMessage (*this , false );
@@ -3285,7 +3287,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
32853287 }
32863288 }
32873289
3288- if (ExprType == CastExpr) {
3290+ if (ExprType == ParenParseOption:: CastExpr) {
32893291 // We parsed '(' type-name ')' and the thing after it wasn't a '{'.
32903292
32913293 if (DeclaratorInfo.isInvalidType ())
@@ -3331,9 +3333,9 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
33313333 Diag (Tok, diag::err_expected_lbrace_in_compound_literal);
33323334 return ExprError ();
33333335 }
3334- } else if (ExprType >= FoldExpr && Tok.is (tok::ellipsis) &&
3336+ } else if (ExprType >= ParenParseOption:: FoldExpr && Tok.is (tok::ellipsis) &&
33353337 isFoldOperator (NextToken ().getKind ())) {
3336- ExprType = FoldExpr;
3338+ ExprType = ParenParseOption:: FoldExpr;
33373339 return ParseFoldExpression (ExprResult (), T);
33383340 } else if (isTypeCast) {
33393341 // Parse the expression-list.
@@ -3343,18 +3345,18 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
33433345 if (!ParseSimpleExpressionList (ArgExprs)) {
33443346 // FIXME: If we ever support comma expressions as operands to
33453347 // fold-expressions, we'll need to allow multiple ArgExprs here.
3346- if (ExprType >= FoldExpr && ArgExprs.size () == 1 &&
3348+ if (ExprType >= ParenParseOption:: FoldExpr && ArgExprs.size () == 1 &&
33473349 isFoldOperator (Tok.getKind ()) && NextToken ().is (tok::ellipsis)) {
3348- ExprType = FoldExpr;
3350+ ExprType = ParenParseOption:: FoldExpr;
33493351 return ParseFoldExpression (ArgExprs[0 ], T);
33503352 }
33513353
3352- ExprType = SimpleExpr;
3354+ ExprType = ParenParseOption:: SimpleExpr;
33533355 Result = Actions.ActOnParenListExpr (OpenLoc, Tok.getLocation (),
33543356 ArgExprs);
33553357 }
33563358 } else if (getLangOpts ().OpenMP >= 50 && OpenMPDirectiveParsing &&
3357- ExprType == CastExpr && Tok.is (tok::l_square) &&
3359+ ExprType == ParenParseOption:: CastExpr && Tok.is (tok::l_square) &&
33583360 tryParseOpenMPArrayShapingCastPart ()) {
33593361 bool ErrorFound = false ;
33603362 SmallVector<Expr *, 4 > OMPDimensions;
@@ -3395,12 +3397,12 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
33953397 Result = Actions.CorrectDelayedTyposInExpr (Result);
33963398 }
33973399
3398- if (ExprType >= FoldExpr && isFoldOperator (Tok. getKind ()) &&
3399- NextToken ().is (tok::ellipsis)) {
3400- ExprType = FoldExpr;
3400+ if (ExprType >= ParenParseOption:: FoldExpr &&
3401+ isFoldOperator (Tok. getKind ()) && NextToken ().is (tok::ellipsis)) {
3402+ ExprType = ParenParseOption:: FoldExpr;
34013403 return ParseFoldExpression (Result, T);
34023404 }
3403- ExprType = SimpleExpr;
3405+ ExprType = ParenParseOption:: SimpleExpr;
34043406
34053407 // Don't build a paren expression unless we actually match a ')'.
34063408 if (!Result.isInvalid () && Tok.is (tok::r_paren))
0 commit comments