@@ -196,7 +196,7 @@ ExprResult Parser::ParseConditionalExpression() {
196
196
}
197
197
198
198
ExprResult LHS = ParseCastExpression (
199
- AnyCastExpr, /* isAddressOfOperand=*/ false , NotTypeCast);
199
+ AnyCastExpr, /* isAddressOfOperand=*/ false , TypeCastState:: NotTypeCast);
200
200
return ParseRHSOfBinaryExpression (LHS, prec::Conditional);
201
201
}
202
202
@@ -239,7 +239,7 @@ ExprResult Parser::ParseConstantExpression() {
239
239
// C++98 and C++11 have no such rule, but this is only a defect in C++98.
240
240
EnterExpressionEvaluationContext ConstantEvaluated (
241
241
Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated);
242
- return ParseConstantExpressionInExprEvalContext (NotTypeCast);
242
+ return ParseConstantExpressionInExprEvalContext (TypeCastState:: NotTypeCast);
243
243
}
244
244
245
245
ExprResult Parser::ParseArrayBoundExpression () {
@@ -267,13 +267,14 @@ ExprResult Parser::ParseArrayBoundExpression() {
267
267
break ;
268
268
Iter->InConditionallyConstantEvaluateContext = true ;
269
269
}
270
- return ParseConstantExpressionInExprEvalContext (NotTypeCast);
270
+ return ParseConstantExpressionInExprEvalContext (TypeCastState:: NotTypeCast);
271
271
}
272
272
273
273
ExprResult Parser::ParseCaseExpression (SourceLocation CaseLoc) {
274
274
EnterExpressionEvaluationContext ConstantEvaluated (
275
275
Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated);
276
- ExprResult LHS (ParseCastExpression (AnyCastExpr, false , NotTypeCast));
276
+ ExprResult LHS (
277
+ ParseCastExpression (AnyCastExpr, false , TypeCastState::NotTypeCast));
277
278
ExprResult Res (ParseRHSOfBinaryExpression (LHS, prec::Conditional));
278
279
return Actions.ActOnCaseExpr (CaseLoc, Res);
279
280
}
@@ -310,12 +311,12 @@ Parser::ParseConstraintLogicalAndExpression(bool IsTrailingRequiresClause) {
310
311
EnterExpressionEvaluationContext ConstantEvaluated (
311
312
Actions, Sema::ExpressionEvaluationContext::Unevaluated);
312
313
bool NotPrimaryExpression = false ;
313
- auto ParsePrimary = [&] () {
314
- ExprResult E = ParseCastExpression (PrimaryExprOnly,
315
- /* isAddressOfOperand= */ false ,
316
- /* isTypeCast =*/ NotTypeCast ,
317
- /* isVectorLiteral =*/ false ,
318
- &NotPrimaryExpression);
314
+ auto ParsePrimary = [&]() {
315
+ ExprResult E =
316
+ ParseCastExpression (PrimaryExprOnly ,
317
+ /* isAddressOfOperand =*/ false ,
318
+ /* isTypeCast =*/ TypeCastState::NotTypeCast ,
319
+ /* isVectorLiteral= */ false , &NotPrimaryExpression);
319
320
if (E.isInvalid ())
320
321
return ExprError ();
321
322
auto RecoverFromNonPrimary = [&] (ExprResult E, bool Note) {
@@ -1107,8 +1108,9 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1107
1108
}
1108
1109
ParsedType CastTy;
1109
1110
SourceLocation RParenLoc;
1110
- Res = ParseParenExpression (ParenExprType, false /* stopIfCastExr*/ ,
1111
- isTypeCast == IsTypeCast, CastTy, RParenLoc);
1111
+ Res = ParseParenExpression (ParenExprType, false /* stopIfCastExr*/ ,
1112
+ isTypeCast == TypeCastState::IsTypeCast, CastTy,
1113
+ RParenLoc);
1112
1114
1113
1115
// FIXME: What should we do if a vector literal is followed by a
1114
1116
// postfix-expression suffix? Usually postfix operators are permitted on
@@ -1347,8 +1349,8 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1347
1349
Token Replacement;
1348
1350
CastExpressionIdValidator Validator (
1349
1351
/* Next=*/ Tok,
1350
- /* AllowTypes=*/ isTypeCast != NotTypeCast,
1351
- /* AllowNonTypes=*/ isTypeCast != IsTypeCast);
1352
+ /* AllowTypes=*/ isTypeCast != TypeCastState:: NotTypeCast,
1353
+ /* AllowNonTypes=*/ isTypeCast != TypeCastState:: IsTypeCast);
1352
1354
Validator.IsAddressOfOperand = isAddressOfOperand;
1353
1355
if (Tok.isOneOf (tok::periodstar, tok::arrowstar)) {
1354
1356
Validator.WantExpressionKeywords = false ;
@@ -1449,10 +1451,9 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
1449
1451
// One special case is implicitly handled here: if the preceding tokens are
1450
1452
// an ambiguous cast expression, such as "(T())++", then we recurse to
1451
1453
// determine whether the '++' is prefix or postfix.
1452
- Res = ParseCastExpression (getLangOpts ().CPlusPlus ?
1453
- UnaryExprOnly : AnyCastExpr,
1454
- /* isAddressOfOperand*/ false , NotCastExpr,
1455
- NotTypeCast);
1454
+ Res = ParseCastExpression (
1455
+ getLangOpts ().CPlusPlus ? UnaryExprOnly : AnyCastExpr,
1456
+ /* isAddressOfOperand*/ false , NotCastExpr, TypeCastState::NotTypeCast);
1456
1457
if (NotCastExpr) {
1457
1458
// If we return with NotCastExpr = true, we must not consume any tokens,
1458
1459
// so put the token back where we found it.
@@ -3258,10 +3259,11 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3258
3259
// Parse the cast-expression that follows it next.
3259
3260
// isVectorLiteral = true will make sure we don't parse any
3260
3261
// Postfix expression yet
3261
- Result = ParseCastExpression (/* isUnaryExpression=*/ AnyCastExpr,
3262
- /* isAddressOfOperand=*/ false ,
3263
- /* isTypeCast=*/ IsTypeCast,
3264
- /* isVectorLiteral=*/ true );
3262
+ Result =
3263
+ ParseCastExpression (/* isUnaryExpression=*/ AnyCastExpr,
3264
+ /* isAddressOfOperand=*/ false ,
3265
+ /* isTypeCast=*/ TypeCastState::IsTypeCast,
3266
+ /* isVectorLiteral=*/ true );
3265
3267
3266
3268
if (!Result.isInvalid ()) {
3267
3269
Result = Actions.ActOnCastExpr (getCurScope (), OpenLoc,
@@ -3312,7 +3314,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3312
3314
// TODO: For cast expression with CastTy.
3313
3315
Result = ParseCastExpression (/* isUnaryExpression=*/ AnyCastExpr,
3314
3316
/* isAddressOfOperand=*/ false ,
3315
- /* isTypeCast=*/ IsTypeCast);
3317
+ /* isTypeCast=*/ TypeCastState:: IsTypeCast);
3316
3318
if (!Result.isInvalid ()) {
3317
3319
Result = Actions.ActOnCastExpr (getCurScope (), OpenLoc,
3318
3320
DeclaratorInfo, CastTy,
@@ -3381,7 +3383,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
3381
3383
} else {
3382
3384
InMessageExpressionRAIIObject InMessage (*this , false );
3383
3385
3384
- Result = ParseExpression (MaybeTypeCast);
3386
+ Result = ParseExpression (TypeCastState:: MaybeTypeCast);
3385
3387
if (!getLangOpts ().CPlusPlus && Result.isUsable ()) {
3386
3388
// Correct typos in non-C++ code earlier so that implicit-cast-like
3387
3389
// expressions are parsed correctly.
0 commit comments