================
@@ -45,11 +47,36 @@ OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
   P.ConsumeToken();
   std::string FirstTokSpelling = P.getPreprocessor().getSpelling(FirstTok);
 
-  OpenACCDirectiveKind DirKind = GetOpenACCDirectiveKind(FirstTokSpelling);
+  OpenACCDirectiveKind DirKind = getOpenACCDirectiveKind(FirstTokSpelling);
 
   if (DirKind == OpenACCDirectiveKind::Invalid)
     P.Diag(FirstTok, diag::err_acc_invalid_directive) << FirstTokSpelling;
 
+  // Combined Constructs allows parallel loop, serial loop, or kernels loop. 
Any
+  // other attempt at a combined construct will be diagnosed as an invalid
+  // clause.
+  Token SecondTok = P.getCurToken();
+  if (!SecondTok.isAnnotation() &&
+      P.getPreprocessor().getSpelling(SecondTok) == "loop") {
+    OpenACCDirectiveKind ReturnKind;
+    switch (DirKind) {
+    default:
+      // Nothing to do except in the below cases, as they should be diagnosed 
as
+      // a clause.
+      break;
+    case OpenACCDirectiveKind::Parallel:
+      ReturnKind = OpenACCDirectiveKind::ParallelLoop;
+      LLVM_FALLTHROUGH;
+    case OpenACCDirectiveKind::Serial:
+      ReturnKind = OpenACCDirectiveKind::SerialLoop;
+      LLVM_FALLTHROUGH;
+    case OpenACCDirectiveKind::Kernels:
+      ReturnKind = OpenACCDirectiveKind::KernelsLoop;
+      P.ConsumeToken();
+      return ReturnKind;
----------------
alexey-bataev wrote:

Hmm, ReturnKind will be rewritten in the last case

https://github.com/llvm/llvm-project/pull/72692
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to