@@ -157,7 +157,7 @@ Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {
157157 // Silence extension warnings in the sub-expression
158158 ExtensionRAIIObject O (Diags);
159159
160- LHS = ParseCastExpression (AnyCastExpr);
160+ LHS = ParseCastExpression (CastParseKind:: AnyCastExpr);
161161 }
162162
163163 if (!LHS.isInvalid ())
@@ -181,9 +181,9 @@ ExprResult Parser::ParseAssignmentExpression(TypeCastState isTypeCast) {
181181 if (Tok.is (tok::kw_co_yield))
182182 return ParseCoyieldExpression ();
183183
184- ExprResult LHS = ParseCastExpression (AnyCastExpr,
185- /* isAddressOfOperand= */ false ,
186- isTypeCast);
184+ ExprResult LHS =
185+ ParseCastExpression (CastParseKind::AnyCastExpr ,
186+ /* isAddressOfOperand= */ false , isTypeCast);
187187 return ParseRHSOfBinaryExpression (LHS, prec::Assignment);
188188}
189189
@@ -195,8 +195,9 @@ ExprResult Parser::ParseConditionalExpression() {
195195 return ExprError ();
196196 }
197197
198- ExprResult LHS = ParseCastExpression (
199- AnyCastExpr, /* isAddressOfOperand=*/ false , TypeCastState::NotTypeCast);
198+ ExprResult LHS = ParseCastExpression (CastParseKind::AnyCastExpr,
199+ /* isAddressOfOperand=*/ false ,
200+ TypeCastState::NotTypeCast);
200201 return ParseRHSOfBinaryExpression (LHS, prec::Conditional);
201202}
202203
@@ -227,7 +228,8 @@ Parser::ParseConstantExpressionInExprEvalContext(TypeCastState isTypeCast) {
227228 Sema::ExpressionEvaluationContext::ConstantEvaluated &&
228229 " Call this function only if your ExpressionEvaluationContext is "
229230 " already ConstantEvaluated" );
230- ExprResult LHS (ParseCastExpression (AnyCastExpr, false , isTypeCast));
231+ ExprResult LHS (
232+ ParseCastExpression (CastParseKind::AnyCastExpr, false , isTypeCast));
231233 ExprResult Res (ParseRHSOfBinaryExpression (LHS, prec::Conditional));
232234 return Actions.ActOnConstantExpression (Res);
233235}
@@ -273,8 +275,8 @@ ExprResult Parser::ParseArrayBoundExpression() {
273275ExprResult Parser::ParseCaseExpression (SourceLocation CaseLoc) {
274276 EnterExpressionEvaluationContext ConstantEvaluated (
275277 Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated);
276- ExprResult LHS (
277- ParseCastExpression (AnyCastExpr, false , TypeCastState::NotTypeCast));
278+ ExprResult LHS (ParseCastExpression (CastParseKind::AnyCastExpr, false ,
279+ TypeCastState::NotTypeCast));
278280 ExprResult Res (ParseRHSOfBinaryExpression (LHS, prec::Conditional));
279281 return Actions.ActOnCaseExpr (CaseLoc, Res);
280282}
@@ -288,7 +290,7 @@ ExprResult Parser::ParseCaseExpression(SourceLocation CaseLoc) {
288290ExprResult Parser::ParseConstraintExpression () {
289291 EnterExpressionEvaluationContext ConstantEvaluated (
290292 Actions, Sema::ExpressionEvaluationContext::Unevaluated);
291- ExprResult LHS (ParseCastExpression (AnyCastExpr));
293+ ExprResult LHS (ParseCastExpression (CastParseKind:: AnyCastExpr));
292294 ExprResult Res (ParseRHSOfBinaryExpression (LHS, prec::LogicalOr));
293295 if (Res.isUsable () && !Actions.CheckConstraintExpression (Res.get ())) {
294296 Actions.CorrectDelayedTyposInExpr (Res);
@@ -313,7 +315,7 @@ Parser::ParseConstraintLogicalAndExpression(bool IsTrailingRequiresClause) {
313315 bool NotPrimaryExpression = false ;
314316 auto ParsePrimary = [&]() {
315317 ExprResult E =
316- ParseCastExpression (PrimaryExprOnly,
318+ ParseCastExpression (CastParseKind:: PrimaryExprOnly,
317319 /* isAddressOfOperand=*/ false ,
318320 /* isTypeCast=*/ TypeCastState::NotTypeCast,
319321 /* isVectorLiteral=*/ false , &NotPrimaryExpression);
@@ -592,7 +594,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
592594 } else if (getLangOpts ().CPlusPlus && NextTokPrec <= prec::Conditional)
593595 RHS = ParseAssignmentExpression ();
594596 else
595- RHS = ParseCastExpression (AnyCastExpr);
597+ RHS = ParseCastExpression (CastParseKind:: AnyCastExpr);
596598
597599 if (RHS.isInvalid ()) {
598600 // FIXME: Errors generated by the delayed typo correction should be
@@ -1452,7 +1454,8 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
14521454 // an ambiguous cast expression, such as "(T())++", then we recurse to
14531455 // determine whether the '++' is prefix or postfix.
14541456 Res = ParseCastExpression (
1455- getLangOpts ().CPlusPlus ? UnaryExprOnly : AnyCastExpr,
1457+ getLangOpts ().CPlusPlus ? CastParseKind::UnaryExprOnly
1458+ : CastParseKind::AnyCastExpr,
14561459 /* isAddressOfOperand*/ false , NotCastExpr, TypeCastState::NotTypeCast);
14571460 if (NotCastExpr) {
14581461 // If we return with NotCastExpr = true, we must not consume any tokens,
@@ -1478,7 +1481,8 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
14781481 SourceLocation SavedLoc = ConsumeToken ();
14791482 PreferredType.enterUnary (Actions, Tok.getLocation (), tok::amp, SavedLoc);
14801483
1481- Res = ParseCastExpression (AnyCastExpr, /* isAddressOfOperand=*/ true );
1484+ Res = ParseCastExpression (CastParseKind::AnyCastExpr,
1485+ /* isAddressOfOperand=*/ true );
14821486 if (!Res.isInvalid ()) {
14831487 Expr *Arg = Res.get ();
14841488 Res = Actions.ActOnUnaryOp (getCurScope (), SavedLoc, SavedKind, Arg);
@@ -1500,7 +1504,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
15001504 *NotPrimaryExpression = true ;
15011505 SourceLocation SavedLoc = ConsumeToken ();
15021506 PreferredType.enterUnary (Actions, Tok.getLocation (), SavedKind, SavedLoc);
1503- Res = ParseCastExpression (AnyCastExpr);
1507+ Res = ParseCastExpression (CastParseKind:: AnyCastExpr);
15041508 if (!Res.isInvalid ()) {
15051509 Expr *Arg = Res.get ();
15061510 Res = Actions.ActOnUnaryOp (getCurScope (), SavedLoc, SavedKind, Arg,
@@ -1515,7 +1519,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
15151519 if (NotPrimaryExpression)
15161520 *NotPrimaryExpression = true ;
15171521 SourceLocation CoawaitLoc = ConsumeToken ();
1518- Res = ParseCastExpression (AnyCastExpr);
1522+ Res = ParseCastExpression (CastParseKind:: AnyCastExpr);
15191523 if (!Res.isInvalid ())
15201524 Res = Actions.ActOnCoawaitExpr (getCurScope (), CoawaitLoc, Res.get ());
15211525 return Res;
@@ -1527,7 +1531,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
15271531 *NotPrimaryExpression = true ;
15281532 ExtensionRAIIObject O (Diags); // Use RAII to do this.
15291533 SourceLocation SavedLoc = ConsumeToken ();
1530- Res = ParseCastExpression (AnyCastExpr);
1534+ Res = ParseCastExpression (CastParseKind:: AnyCastExpr);
15311535 if (!Res.isInvalid ())
15321536 Res = Actions.ActOnUnaryOp (getCurScope (), SavedLoc, SavedKind, Res.get ());
15331537 return Res;
@@ -1921,7 +1925,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
19211925 // are compiling for OpenCL, we need to return an error as this implies
19221926 // that the address of the function is being taken, which is illegal in CL.
19231927
1924- if (ParseKind == PrimaryExprOnly)
1928+ if (ParseKind == CastParseKind:: PrimaryExprOnly)
19251929 // This is strictly a primary-expression - no postfix-expr pieces should be
19261930 // parsed.
19271931 return Res;
@@ -2515,10 +2519,10 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok,
25152519 Tok.isOneOf (tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
25162520 tok::kw_alignof, tok::kw__Alignof, tok::kw__Countof))
25172521 Actions.runWithSufficientStackSpace (Tok.getLocation (), [&] {
2518- Operand = ParseCastExpression (UnaryExprOnly);
2522+ Operand = ParseCastExpression (CastParseKind:: UnaryExprOnly);
25192523 });
25202524 else
2521- Operand = ParseCastExpression (UnaryExprOnly);
2525+ Operand = ParseCastExpression (CastParseKind:: UnaryExprOnly);
25222526 } else {
25232527 // If it starts with a '(', we know that it is either a parenthesized
25242528 // type-name, or it is a unary-expression that starts with a compound
@@ -3177,7 +3181,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
31773181 RParenLoc = T.getCloseLocation ();
31783182
31793183 PreferredType.enterTypeCast (Tok.getLocation (), Ty.get ().get ());
3180- ExprResult SubExpr = ParseCastExpression (AnyCastExpr);
3184+ ExprResult SubExpr = ParseCastExpression (CastParseKind:: AnyCastExpr);
31813185
31823186 if (Ty.isInvalid () || SubExpr.isInvalid ())
31833187 return ExprError ();
@@ -3259,11 +3263,11 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
32593263 // Parse the cast-expression that follows it next.
32603264 // isVectorLiteral = true will make sure we don't parse any
32613265 // 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 );
32673271
32683272 if (!Result.isInvalid ()) {
32693273 Result = Actions.ActOnCastExpr (getCurScope (), OpenLoc,
@@ -3312,9 +3316,10 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
33123316 PreferredType.enterTypeCast (Tok.getLocation (), CastTy.get ());
33133317 // Parse the cast-expression that follows it next.
33143318 // 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);
33183323 if (!Result.isInvalid ()) {
33193324 Result = Actions.ActOnCastExpr (getCurScope (), OpenLoc,
33203325 DeclaratorInfo, CastTy,
0 commit comments