@@ -1105,7 +1105,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1105
1105
ParenExprType = ParenParseOption::CastExpr;
1106
1106
break ;
1107
1107
case CastParseKind::PrimaryExprOnly:
1108
- ParenExprType = FoldExpr;
1108
+ ParenExprType = ParenParseOption:: FoldExpr;
1109
1109
break ;
1110
1110
}
1111
1111
ParsedType CastTy;
@@ -1121,17 +1121,19 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1121
1121
return Res;
1122
1122
1123
1123
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:
1127
1129
// We parsed '(' type-name ')' '{' ... '}'. If any suffixes of
1128
1130
// postfix-expression exist, parse them now.
1129
1131
break ;
1130
- case CastExpr:
1132
+ case ParenParseOption:: CastExpr:
1131
1133
// We have parsed the cast-expression and no postfix-expr pieces are
1132
1134
// following.
1133
1135
return Res;
1134
- case FoldExpr:
1136
+ case ParenParseOption:: FoldExpr:
1135
1137
// We only parsed a fold-expression. There might be postfix-expr pieces
1136
1138
// afterwards; parse them now.
1137
1139
break ;
@@ -2528,7 +2530,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok,
2528
2530
// type-name, or it is a unary-expression that starts with a compound
2529
2531
// literal, or starts with a primary-expression that is a parenthesized
2530
2532
// expression.
2531
- ParenParseOption ExprType = CastExpr;
2533
+ ParenParseOption ExprType = ParenParseOption:: CastExpr;
2532
2534
SourceLocation LParenLoc = Tok.getLocation (), RParenLoc;
2533
2535
2534
2536
Operand = ParseParenExpression (ExprType, true /* stopIfCastExpr*/ ,
@@ -2537,7 +2539,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok,
2537
2539
2538
2540
// If ParseParenExpression parsed a '(typename)' sequence only, then this is
2539
2541
// a type.
2540
- if (ExprType == CastExpr) {
2542
+ if (ExprType == ParenParseOption:: CastExpr) {
2541
2543
isCastExpr = true ;
2542
2544
return ExprEmpty ();
2543
2545
}
@@ -3095,7 +3097,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3095
3097
cutOffParsing ();
3096
3098
Actions.CodeCompletion ().CodeCompleteExpression (
3097
3099
getCurScope (), PreferredType.get (Tok.getLocation ()),
3098
- /* IsParenthesized=*/ ExprType >= CompoundLiteral);
3100
+ /* IsParenthesized=*/ ExprType >= ParenParseOption:: CompoundLiteral);
3099
3101
return ExprError ();
3100
3102
}
3101
3103
@@ -3119,7 +3121,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3119
3121
3120
3122
// None of these cases should fall through with an invalid Result
3121
3123
// 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)) {
3123
3125
Diag (Tok, OpenLoc.isMacroID () ? diag::ext_gnu_statement_expr_macro
3124
3126
: diag::ext_gnu_statement_expr);
3125
3127
@@ -3142,7 +3144,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3142
3144
Actions.ActOnStartStmtExpr ();
3143
3145
3144
3146
StmtResult Stmt (ParseCompoundStatement (true ));
3145
- ExprType = CompoundStmt;
3147
+ ExprType = ParenParseOption:: CompoundStmt;
3146
3148
3147
3149
// If the substmt parsed correctly, build the AST node.
3148
3150
if (!Stmt.isInvalid ()) {
@@ -3152,7 +3154,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3152
3154
Actions.ActOnStmtExprError ();
3153
3155
}
3154
3156
}
3155
- } else if (ExprType >= CompoundLiteral && BridgeCast) {
3157
+ } else if (ExprType >= ParenParseOption:: CompoundLiteral && BridgeCast) {
3156
3158
tok::TokenKind tokenKind = Tok.getKind ();
3157
3159
SourceLocation BridgeKeywordLoc = ConsumeToken ();
3158
3160
@@ -3189,7 +3191,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3189
3191
return Actions.ObjC ().ActOnObjCBridgedCast (getCurScope (), OpenLoc, Kind,
3190
3192
BridgeKeywordLoc, Ty.get (),
3191
3193
RParenLoc, SubExpr.get ());
3192
- } else if (ExprType >= CompoundLiteral &&
3194
+ } else if (ExprType >= ParenParseOption:: CompoundLiteral &&
3193
3195
isTypeIdInParens (isAmbiguousTypeId)) {
3194
3196
3195
3197
// Otherwise, this is a compound literal expression or cast expression.
@@ -3233,7 +3235,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3233
3235
ColonProtection.restore ();
3234
3236
RParenLoc = T.getCloseLocation ();
3235
3237
if (Tok.is (tok::l_brace)) {
3236
- ExprType = CompoundLiteral;
3238
+ ExprType = ParenParseOption:: CompoundLiteral;
3237
3239
TypeResult Ty;
3238
3240
{
3239
3241
InMessageExpressionRAIIObject InMessage (*this , false );
@@ -3285,7 +3287,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3285
3287
}
3286
3288
}
3287
3289
3288
- if (ExprType == CastExpr) {
3290
+ if (ExprType == ParenParseOption:: CastExpr) {
3289
3291
// We parsed '(' type-name ')' and the thing after it wasn't a '{'.
3290
3292
3291
3293
if (DeclaratorInfo.isInvalidType ())
@@ -3331,9 +3333,9 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3331
3333
Diag (Tok, diag::err_expected_lbrace_in_compound_literal);
3332
3334
return ExprError ();
3333
3335
}
3334
- } else if (ExprType >= FoldExpr && Tok.is (tok::ellipsis) &&
3336
+ } else if (ExprType >= ParenParseOption:: FoldExpr && Tok.is (tok::ellipsis) &&
3335
3337
isFoldOperator (NextToken ().getKind ())) {
3336
- ExprType = FoldExpr;
3338
+ ExprType = ParenParseOption:: FoldExpr;
3337
3339
return ParseFoldExpression (ExprResult (), T);
3338
3340
} else if (isTypeCast) {
3339
3341
// Parse the expression-list.
@@ -3343,18 +3345,18 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3343
3345
if (!ParseSimpleExpressionList (ArgExprs)) {
3344
3346
// FIXME: If we ever support comma expressions as operands to
3345
3347
// 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 &&
3347
3349
isFoldOperator (Tok.getKind ()) && NextToken ().is (tok::ellipsis)) {
3348
- ExprType = FoldExpr;
3350
+ ExprType = ParenParseOption:: FoldExpr;
3349
3351
return ParseFoldExpression (ArgExprs[0 ], T);
3350
3352
}
3351
3353
3352
- ExprType = SimpleExpr;
3354
+ ExprType = ParenParseOption:: SimpleExpr;
3353
3355
Result = Actions.ActOnParenListExpr (OpenLoc, Tok.getLocation (),
3354
3356
ArgExprs);
3355
3357
}
3356
3358
} else if (getLangOpts ().OpenMP >= 50 && OpenMPDirectiveParsing &&
3357
- ExprType == CastExpr && Tok.is (tok::l_square) &&
3359
+ ExprType == ParenParseOption:: CastExpr && Tok.is (tok::l_square) &&
3358
3360
tryParseOpenMPArrayShapingCastPart ()) {
3359
3361
bool ErrorFound = false ;
3360
3362
SmallVector<Expr *, 4 > OMPDimensions;
@@ -3395,12 +3397,12 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3395
3397
Result = Actions.CorrectDelayedTyposInExpr (Result);
3396
3398
}
3397
3399
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;
3401
3403
return ParseFoldExpression (Result, T);
3402
3404
}
3403
- ExprType = SimpleExpr;
3405
+ ExprType = ParenParseOption:: SimpleExpr;
3404
3406
3405
3407
// Don't build a paren expression unless we actually match a ')'.
3406
3408
if (!Result.isInvalid () && Tok.is (tok::r_paren))
0 commit comments