[flang-commits] [compiler-rt] [libcxx] [lldb] [flang] [llvm] [libc] [clang] [lld] [clang-tools-extra] [OpenACC] Implement 'default' clause parsing. (PR #77002)
via flang-commits
flang-commits at lists.llvm.org
Fri Jan 5 07:44:53 PST 2024
================
@@ -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
More information about the flang-commits
mailing list