@@ -157,7 +157,7 @@ Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {
157
157
// Silence extension warnings in the sub-expression
158
158
ExtensionRAIIObject O (Diags);
159
159
160
- LHS = ParseCastExpression (AnyCastExpr);
160
+ LHS = ParseCastExpression (CastParseKind:: AnyCastExpr);
161
161
}
162
162
163
163
if (!LHS.isInvalid ())
@@ -181,9 +181,9 @@ ExprResult Parser::ParseAssignmentExpression(TypeCastState isTypeCast) {
181
181
if (Tok.is (tok::kw_co_yield))
182
182
return ParseCoyieldExpression ();
183
183
184
- ExprResult LHS = ParseCastExpression (AnyCastExpr,
185
- /* isAddressOfOperand= */ false ,
186
- isTypeCast);
184
+ ExprResult LHS =
185
+ ParseCastExpression (CastParseKind::AnyCastExpr ,
186
+ /* isAddressOfOperand= */ false , isTypeCast);
187
187
return ParseRHSOfBinaryExpression (LHS, prec::Assignment);
188
188
}
189
189
@@ -195,8 +195,9 @@ ExprResult Parser::ParseConditionalExpression() {
195
195
return ExprError ();
196
196
}
197
197
198
- ExprResult LHS = ParseCastExpression (
199
- AnyCastExpr, /* isAddressOfOperand=*/ false , TypeCastState::NotTypeCast);
198
+ ExprResult LHS = ParseCastExpression (CastParseKind::AnyCastExpr,
199
+ /* isAddressOfOperand=*/ false ,
200
+ TypeCastState::NotTypeCast);
200
201
return ParseRHSOfBinaryExpression (LHS, prec::Conditional);
201
202
}
202
203
@@ -227,7 +228,8 @@ Parser::ParseConstantExpressionInExprEvalContext(TypeCastState isTypeCast) {
227
228
Sema::ExpressionEvaluationContext::ConstantEvaluated &&
228
229
" Call this function only if your ExpressionEvaluationContext is "
229
230
" already ConstantEvaluated" );
230
- ExprResult LHS (ParseCastExpression (AnyCastExpr, false , isTypeCast));
231
+ ExprResult LHS (
232
+ ParseCastExpression (CastParseKind::AnyCastExpr, false , isTypeCast));
231
233
ExprResult Res (ParseRHSOfBinaryExpression (LHS, prec::Conditional));
232
234
return Actions.ActOnConstantExpression (Res);
233
235
}
@@ -273,8 +275,8 @@ ExprResult Parser::ParseArrayBoundExpression() {
273
275
ExprResult Parser::ParseCaseExpression (SourceLocation CaseLoc) {
274
276
EnterExpressionEvaluationContext ConstantEvaluated (
275
277
Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated);
276
- ExprResult LHS (
277
- ParseCastExpression (AnyCastExpr, false , TypeCastState::NotTypeCast));
278
+ ExprResult LHS (ParseCastExpression (CastParseKind::AnyCastExpr, false ,
279
+ TypeCastState::NotTypeCast));
278
280
ExprResult Res (ParseRHSOfBinaryExpression (LHS, prec::Conditional));
279
281
return Actions.ActOnCaseExpr (CaseLoc, Res);
280
282
}
@@ -288,7 +290,7 @@ ExprResult Parser::ParseCaseExpression(SourceLocation CaseLoc) {
288
290
ExprResult Parser::ParseConstraintExpression () {
289
291
EnterExpressionEvaluationContext ConstantEvaluated (
290
292
Actions, Sema::ExpressionEvaluationContext::Unevaluated);
291
- ExprResult LHS (ParseCastExpression (AnyCastExpr));
293
+ ExprResult LHS (ParseCastExpression (CastParseKind:: AnyCastExpr));
292
294
ExprResult Res (ParseRHSOfBinaryExpression (LHS, prec::LogicalOr));
293
295
if (Res.isUsable () && !Actions.CheckConstraintExpression (Res.get ())) {
294
296
Actions.CorrectDelayedTyposInExpr (Res);
@@ -313,7 +315,7 @@ Parser::ParseConstraintLogicalAndExpression(bool IsTrailingRequiresClause) {
313
315
bool NotPrimaryExpression = false ;
314
316
auto ParsePrimary = [&]() {
315
317
ExprResult E =
316
- ParseCastExpression (PrimaryExprOnly,
318
+ ParseCastExpression (CastParseKind:: PrimaryExprOnly,
317
319
/* isAddressOfOperand=*/ false ,
318
320
/* isTypeCast=*/ TypeCastState::NotTypeCast,
319
321
/* isVectorLiteral=*/ false , &NotPrimaryExpression);
@@ -592,7 +594,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
592
594
} else if (getLangOpts ().CPlusPlus && NextTokPrec <= prec::Conditional)
593
595
RHS = ParseAssignmentExpression ();
594
596
else
595
- RHS = ParseCastExpression (AnyCastExpr);
597
+ RHS = ParseCastExpression (CastParseKind:: AnyCastExpr);
596
598
597
599
if (RHS.isInvalid ()) {
598
600
// FIXME: Errors generated by the delayed typo correction should be
@@ -1452,7 +1454,8 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1452
1454
// an ambiguous cast expression, such as "(T())++", then we recurse to
1453
1455
// determine whether the '++' is prefix or postfix.
1454
1456
Res = ParseCastExpression (
1455
- getLangOpts ().CPlusPlus ? UnaryExprOnly : AnyCastExpr,
1457
+ getLangOpts ().CPlusPlus ? CastParseKind::UnaryExprOnly
1458
+ : CastParseKind::AnyCastExpr,
1456
1459
/* isAddressOfOperand*/ false , NotCastExpr, TypeCastState::NotTypeCast);
1457
1460
if (NotCastExpr) {
1458
1461
// If we return with NotCastExpr = true, we must not consume any tokens,
@@ -1478,7 +1481,8 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1478
1481
SourceLocation SavedLoc = ConsumeToken ();
1479
1482
PreferredType.enterUnary (Actions, Tok.getLocation (), tok::amp, SavedLoc);
1480
1483
1481
- Res = ParseCastExpression (AnyCastExpr, /* isAddressOfOperand=*/ true );
1484
+ Res = ParseCastExpression (CastParseKind::AnyCastExpr,
1485
+ /* isAddressOfOperand=*/ true );
1482
1486
if (!Res.isInvalid ()) {
1483
1487
Expr *Arg = Res.get ();
1484
1488
Res = Actions.ActOnUnaryOp (getCurScope (), SavedLoc, SavedKind, Arg);
@@ -1500,7 +1504,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1500
1504
*NotPrimaryExpression = true ;
1501
1505
SourceLocation SavedLoc = ConsumeToken ();
1502
1506
PreferredType.enterUnary (Actions, Tok.getLocation (), SavedKind, SavedLoc);
1503
- Res = ParseCastExpression (AnyCastExpr);
1507
+ Res = ParseCastExpression (CastParseKind:: AnyCastExpr);
1504
1508
if (!Res.isInvalid ()) {
1505
1509
Expr *Arg = Res.get ();
1506
1510
Res = Actions.ActOnUnaryOp (getCurScope (), SavedLoc, SavedKind, Arg,
@@ -1515,7 +1519,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1515
1519
if (NotPrimaryExpression)
1516
1520
*NotPrimaryExpression = true ;
1517
1521
SourceLocation CoawaitLoc = ConsumeToken ();
1518
- Res = ParseCastExpression (AnyCastExpr);
1522
+ Res = ParseCastExpression (CastParseKind:: AnyCastExpr);
1519
1523
if (!Res.isInvalid ())
1520
1524
Res = Actions.ActOnCoawaitExpr (getCurScope (), CoawaitLoc, Res.get ());
1521
1525
return Res;
@@ -1527,7 +1531,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1527
1531
*NotPrimaryExpression = true ;
1528
1532
ExtensionRAIIObject O (Diags); // Use RAII to do this.
1529
1533
SourceLocation SavedLoc = ConsumeToken ();
1530
- Res = ParseCastExpression (AnyCastExpr);
1534
+ Res = ParseCastExpression (CastParseKind:: AnyCastExpr);
1531
1535
if (!Res.isInvalid ())
1532
1536
Res = Actions.ActOnUnaryOp (getCurScope (), SavedLoc, SavedKind, Res.get ());
1533
1537
return Res;
@@ -1921,7 +1925,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1921
1925
// are compiling for OpenCL, we need to return an error as this implies
1922
1926
// that the address of the function is being taken, which is illegal in CL.
1923
1927
1924
- if (ParseKind == PrimaryExprOnly)
1928
+ if (ParseKind == CastParseKind:: PrimaryExprOnly)
1925
1929
// This is strictly a primary-expression - no postfix-expr pieces should be
1926
1930
// parsed.
1927
1931
return Res;
@@ -2515,10 +2519,10 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok,
2515
2519
Tok.isOneOf (tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2516
2520
tok::kw_alignof, tok::kw__Alignof, tok::kw__Countof))
2517
2521
Actions.runWithSufficientStackSpace (Tok.getLocation (), [&] {
2518
- Operand = ParseCastExpression (UnaryExprOnly);
2522
+ Operand = ParseCastExpression (CastParseKind:: UnaryExprOnly);
2519
2523
});
2520
2524
else
2521
- Operand = ParseCastExpression (UnaryExprOnly);
2525
+ Operand = ParseCastExpression (CastParseKind:: UnaryExprOnly);
2522
2526
} else {
2523
2527
// If it starts with a '(', we know that it is either a parenthesized
2524
2528
// type-name, or it is a unary-expression that starts with a compound
@@ -3177,7 +3181,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3177
3181
RParenLoc = T.getCloseLocation ();
3178
3182
3179
3183
PreferredType.enterTypeCast (Tok.getLocation (), Ty.get ().get ());
3180
- ExprResult SubExpr = ParseCastExpression (AnyCastExpr);
3184
+ ExprResult SubExpr = ParseCastExpression (CastParseKind:: AnyCastExpr);
3181
3185
3182
3186
if (Ty.isInvalid () || SubExpr.isInvalid ())
3183
3187
return ExprError ();
@@ -3259,11 +3263,11 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3259
3263
// Parse the cast-expression that follows it next.
3260
3264
// isVectorLiteral = true will make sure we don't parse any
3261
3265
// Postfix expression yet
3262
- Result =
3263
- ParseCastExpression ( /* isUnaryExpression=*/ AnyCastExpr,
3264
- /* isAddressOfOperand=*/ false ,
3265
- /* isTypeCast=*/ TypeCastState::IsTypeCast,
3266
- /* isVectorLiteral=*/ true );
3266
+ Result = ParseCastExpression (
3267
+ /* isUnaryExpression=*/ CastParseKind:: AnyCastExpr,
3268
+ /* isAddressOfOperand=*/ false ,
3269
+ /* isTypeCast=*/ TypeCastState::IsTypeCast,
3270
+ /* isVectorLiteral=*/ true );
3267
3271
3268
3272
if (!Result.isInvalid ()) {
3269
3273
Result = Actions.ActOnCastExpr (getCurScope (), OpenLoc,
@@ -3312,9 +3316,10 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3312
3316
PreferredType.enterTypeCast (Tok.getLocation (), CastTy.get ());
3313
3317
// Parse the cast-expression that follows it next.
3314
3318
// TODO: For cast expression with CastTy.
3315
- Result = ParseCastExpression (/* isUnaryExpression=*/ AnyCastExpr,
3316
- /* isAddressOfOperand=*/ false ,
3317
- /* isTypeCast=*/ TypeCastState::IsTypeCast);
3319
+ Result = ParseCastExpression (
3320
+ /* isUnaryExpression=*/ CastParseKind::AnyCastExpr,
3321
+ /* isAddressOfOperand=*/ false ,
3322
+ /* isTypeCast=*/ TypeCastState::IsTypeCast);
3318
3323
if (!Result.isInvalid ()) {
3319
3324
Result = Actions.ActOnCastExpr (getCurScope (), OpenLoc,
3320
3325
DeclaratorInfo, CastTy,
0 commit comments