[clang] [llvm] [OpenMP] Missing implicit otherwise clause in metadirective. (PR #127113)

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 10:00:40 PST 2025


================
@@ -2882,6 +2882,13 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
           /*ReadDirectiveWithinMetadirective=*/true);
       break;
     }
+    // If no match is found and no otherwise clause is present, skip
+    // OMP5.2 Chapter 7.4: If no otherwise clause is specified the effect is as
+    // if one was specified without an associated directive variant.
+    if (BestIdx == -1 && Idx == 1) {
+      ConsumeAnnotationToken();
+      return StmtEmpty();
+    }
----------------
zahiraam wrote:

or you mean the assertion should be before the call to `ConsumeAnnotationToken()`?

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


More information about the cfe-commits mailing list