================
@@ -176,6 +192,26 @@ bool isOpenACCDirectiveKind(OpenACCDirectiveKind Kind,
Token Tok) {
llvm_unreachable("Unknown 'Kind' Passed");
}
+/// Used for cases where we expect an identifier-like token, but don't want to
+/// give awkward error messages in cases where it is accidentially a keyword.
+bool expectIdentifierOrKeyword(Parser &P) {
+ Token Tok = P.getCurToken();
+
+ if (Tok.is(tok::identifier)) {
+ P.ConsumeToken();
----------------
cor3ntin wrote:
This is confusing.
It would be better to first check the token is an identifier, and consume it in
the caller code (and it avoids having to do a copy) - it would be more existent
with the existing `Parser::expectIdentifier` function (which is actually
objective-c specific...)
https://github.com/llvm/llvm-project/pull/77002
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits