[clang] [OpenACC] Implement 'cache' construct parsing (PR #74324)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 06:53:43 PST 2023


================
@@ -298,7 +367,18 @@ void Parser::ParseOpenACCDirective() {
         T.consumeClose();
       break;
     }
+    case OpenACCDirectiveKind::Cache:
+      ParseOpenACCCacheVarList();
+      // The ParseOpenACCCacheVarList function manages to recover from failures,
+      // so we can always consume the close.
+      T.consumeClose();
+      break;
     }
+  } else if (DirKind == OpenACCDirectiveKind::Cache) {
+    // Cache's paren var-list is required, so error here if it isn't provided.
+    // We know that the consumeOpen above left the first non-paren here, so use
+    // expectAndConsume to emit the proper dialog, then continue.
+    (void)T.expectAndConsume();
----------------
erichkeane wrote:

I was considering the lack of a `(` to mean "the author provided nothing and continued with the clause-lists", so it didn't seem to make sense to try to parse a var list.  

Do you consider treating it as if it is JUST a missed '(' to make more sense?

https://github.com/llvm/llvm-project/pull/74324


More information about the cfe-commits mailing list