[clang] [OpenACC] Implement enter data/exit data construct parsing (PR #72916)
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 21 06:52:06 PST 2023
================
@@ -91,10 +140,19 @@ OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
P.ConsumeToken();
std::string FirstTokSpelling = P.getPreprocessor().getSpelling(FirstTok);
- OpenACCDirectiveKind DirKind = getOpenACCDirectiveKind(FirstTokSpelling);
+ OpenACCDirectiveKindEx ExDirKind = getOpenACCDirectiveKind(FirstTokSpelling);
+
+ switch (ExDirKind) {
+ case OpenACCDirectiveKindEx::Invalid:
+ P.Diag(FirstTok, diag::err_acc_invalid_directive) << 0 << FirstTokSpelling;
+ return OpenACCDirectiveKind::Invalid;
+ case OpenACCDirectiveKindEx::Enter:
+ case OpenACCDirectiveKindEx::Exit:
+ return ParseOpenACCEnterExitDataDirective(P, FirstTok, FirstTokSpelling,
+ ExDirKind);
+ }
----------------
alexey-bataev wrote:
Could you add a check please:
if (ExDirKind >= OpenACCDirectiveKindEx::Invalid) before this switch and a comment describing this behaviour?
https://github.com/llvm/llvm-project/pull/72916
More information about the cfe-commits
mailing list