@@ -1270,20 +1270,20 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
1270
1270
// / should try to recover harder. It returns false if the condition is
1271
1271
// / successfully parsed. Note that a successful parse can still have semantic
1272
1272
// / errors in the condition.
1273
- // / Additionally, if LParenLoc and RParenLoc are non-null, it will assign
1274
- // / the location of the outer-most '(' and ')' , respectively, to them .
1273
+ // / Additionally, it will assign the location of the outer-most '(' and ')',
1274
+ // / to LParenLoc and RParenLoc , respectively.
1275
1275
bool Parser::ParseParenExprOrCondition (StmtResult *InitStmt,
1276
1276
Sema::ConditionResult &Cond,
1277
1277
SourceLocation Loc,
1278
- Sema::ConditionKind CK, bool MissingOK,
1279
- SourceLocation * LParenLoc,
1280
- SourceLocation * RParenLoc) {
1278
+ Sema::ConditionKind CK,
1279
+ SourceLocation & LParenLoc,
1280
+ SourceLocation & RParenLoc) {
1281
1281
BalancedDelimiterTracker T (*this , tok::l_paren);
1282
1282
T.consumeOpen ();
1283
1283
SourceLocation Start = Tok.getLocation ();
1284
1284
1285
1285
if (getLangOpts ().CPlusPlus ) {
1286
- Cond = ParseCXXCondition (InitStmt, Loc, CK, MissingOK );
1286
+ Cond = ParseCXXCondition (InitStmt, Loc, CK, false );
1287
1287
} else {
1288
1288
ExprResult CondExpr = ParseExpression ();
1289
1289
@@ -1292,7 +1292,7 @@ bool Parser::ParseParenExprOrCondition(StmtResult *InitStmt,
1292
1292
Cond = Sema::ConditionError ();
1293
1293
else
1294
1294
Cond = Actions.ActOnCondition (getCurScope (), Loc, CondExpr.get (), CK,
1295
- MissingOK);
1295
+ /* MissingOK= */ false );
1296
1296
}
1297
1297
1298
1298
// If the parser was confused by the condition and we don't have a ')', try to
@@ -1312,18 +1312,13 @@ bool Parser::ParseParenExprOrCondition(StmtResult *InitStmt,
1312
1312
Actions.PreferredConditionType (CK));
1313
1313
if (!CondExpr.isInvalid ())
1314
1314
Cond = Actions.ActOnCondition (getCurScope (), Loc, CondExpr.get (), CK,
1315
- MissingOK);
1315
+ /* MissingOK= */ false );
1316
1316
}
1317
1317
1318
1318
// Either the condition is valid or the rparen is present.
1319
1319
T.consumeClose ();
1320
-
1321
- if (LParenLoc != nullptr ) {
1322
- *LParenLoc = T.getOpenLocation ();
1323
- }
1324
- if (RParenLoc != nullptr ) {
1325
- *RParenLoc = T.getCloseLocation ();
1326
- }
1320
+ LParenLoc = T.getOpenLocation ();
1321
+ RParenLoc = T.getCloseLocation ();
1327
1322
1328
1323
// Check for extraneous ')'s to catch things like "if (foo())) {". We know
1329
1324
// that all callers are looking for a statement after the condition, so ")"
@@ -1499,7 +1494,7 @@ StmtResult Parser::ParseIfStatement(SourceLocation *TrailingElseLoc) {
1499
1494
if (ParseParenExprOrCondition (&InitStmt, Cond, IfLoc,
1500
1495
IsConstexpr ? Sema::ConditionKind::ConstexprIf
1501
1496
: Sema::ConditionKind::Boolean,
1502
- /* MissingOK= */ false , & LParen, & RParen))
1497
+ LParen, RParen))
1503
1498
return StmtError ();
1504
1499
1505
1500
if (IsConstexpr)
@@ -1694,8 +1689,7 @@ StmtResult Parser::ParseSwitchStatement(SourceLocation *TrailingElseLoc) {
1694
1689
SourceLocation LParen;
1695
1690
SourceLocation RParen;
1696
1691
if (ParseParenExprOrCondition (&InitStmt, Cond, SwitchLoc,
1697
- Sema::ConditionKind::Switch,
1698
- /* MissingOK=*/ false , &LParen, &RParen))
1692
+ Sema::ConditionKind::Switch, LParen, RParen))
1699
1693
return StmtError ();
1700
1694
1701
1695
StmtResult Switch = Actions.ActOnStartOfSwitchStmt (
@@ -1785,8 +1779,7 @@ StmtResult Parser::ParseWhileStatement(SourceLocation *TrailingElseLoc) {
1785
1779
SourceLocation LParen;
1786
1780
SourceLocation RParen;
1787
1781
if (ParseParenExprOrCondition (nullptr , Cond, WhileLoc,
1788
- Sema::ConditionKind::Boolean,
1789
- /* MissingOK=*/ false , &LParen, &RParen))
1782
+ Sema::ConditionKind::Boolean, LParen, RParen))
1790
1783
return StmtError ();
1791
1784
1792
1785
// C99 6.8.5p5 - In C99, the body of the while statement is a scope, even if
0 commit comments