Skip to content

Commit ffd9f20

Browse files
authored
Update ParseExprCXX.cpp
while condition
1 parent 420d7d0 commit ffd9f20

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

clang/lib/Parse/ParseExprCXX.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,22 +1255,24 @@ static void tryConsumeLambdaSpecifierToken(Parser &P,
12551255
DeclEndLoc = SpecifierLoc;
12561256
};
12571257

1258-
while (true) {
1258+
// Process lambda specifiers until an invalid token is found
1259+
while (P.getCurToken().isOneOf(tok::kw_mutable, tok::kw_static,
1260+
tok::kw_constexpr, tok::kw_consteval)) {
12591261
switch (P.getCurToken().getKind()) {
12601262
case tok::kw_mutable:
1261-
ConsumeLocation(MutableLoc, 0);
1263+
ConsumeLocation(MutableLoc, 0);
12621264
break;
12631265
case tok::kw_static:
1264-
ConsumeLocation(StaticLoc, 1);
1266+
ConsumeLocation(StaticLoc, 1);
12651267
break;
12661268
case tok::kw_constexpr:
1267-
ConsumeLocation(ConstexprLoc, 2);
1269+
ConsumeLocation(ConstexprLoc, 2);
12681270
break;
12691271
case tok::kw_consteval:
12701272
ConsumeLocation(ConstevalLoc, 3);
12711273
break;
12721274
default:
1273-
return;
1275+
llvm_unreachable("Unexpected token in lambda specifier parsing");
12741276
}
12751277
}
12761278
}

0 commit comments

Comments
 (0)