https://github.com/ravurvi20 updated 
https://github.com/llvm/llvm-project/pull/125648

>From 189dd3cc2230ea5752969f02f119b6ee30e3df69 Mon Sep 17 00:00:00 2001
From: Urvi Rav <urvi.ra...@gmail.com>
Date: Tue, 4 Feb 2025 01:35:41 -0600
Subject: [PATCH 1/3] default clause replaced by otherwise clause for
 metadirective

---
 .../clang/Basic/DiagnosticParseKinds.td       |  4 ++++
 clang/lib/Parse/ParseOpenMP.cpp               | 15 ++++++++++++++
 clang/test/OpenMP/metadirective_ast_print.c   | 20 +++++++++----------
 .../metadirective_device_arch_codegen.cpp     |  2 +-
 .../metadirective_device_isa_codegen.cpp      |  4 ++--
 ...etadirective_device_isa_codegen_amdgcn.cpp |  4 ++--
 .../metadirective_device_kind_codegen.c       |  2 +-
 .../metadirective_device_kind_codegen.cpp     |  2 +-
 clang/test/OpenMP/metadirective_empty.cpp     |  4 ++--
 .../metadirective_implementation_codegen.c    | 12 +++++------
 .../metadirective_implementation_codegen.cpp  | 12 +++++------
 clang/test/OpenMP/metadirective_messages.cpp  | 12 +++++++----
 12 files changed, 58 insertions(+), 35 deletions(-)

diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index c513dab810d1f53..4b8449e9ee9b629 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1657,6 +1657,10 @@ def err_omp_expected_colon : Error<"missing ':' in %0">;
 def err_omp_missing_comma : Error< "missing ',' after %0">;
 def err_omp_expected_context_selector
     : Error<"expected valid context selector in %0">;
+def err_omp_unknown_clause
+    : Error<"unknown clause '%0' in %1">;
+def warn_omp_default_deprecated : Warning<"'default' clause for"
+  " 'metadirective' is deprecated; use 'otherwise' instead">, 
InGroup<Deprecated>;
 def err_omp_requires_out_inout_depend_type : Error<
   "reserved locator 'omp_all_memory' requires 'out' or 'inout' "
   "dependency types">;
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 89b83938f352dff..673806ef28b9fc6 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -2743,6 +2743,15 @@ StmtResult 
Parser::ParseOpenMPDeclarativeOrExecutableDirective(
       OpenMPClauseKind CKind = Tok.isAnnotation()
                                    ? OMPC_unknown
                                    : getOpenMPClauseKind(PP.getSpelling(Tok));
+      // Check if the clause is unrecognized.
+      if (CKind == OMPC_unknown) {
+        Diag(Tok, diag::err_omp_unknown_clause)
+        << PP.getSpelling(Tok) << "metadirective";
+        return Directive;
+      }
+      if(CKind == OMPC_default) {
+        Diag(Tok, diag::warn_omp_default_deprecated);
+      }
       SourceLocation Loc = ConsumeToken();
 
       // Parse '('.
@@ -2769,6 +2778,12 @@ StmtResult 
Parser::ParseOpenMPDeclarativeOrExecutableDirective(
           return Directive;
         }
       }
+      if (CKind == OMPC_otherwise) {
+        // Check for 'otherwise' keyword.
+        if (Tok.is(tok::identifier) && Tok.getIdentifierInfo()->getName() == 
"otherwise") {
+        ConsumeToken();  // Consume 'otherwise'
+        }
+      }
       // Skip Directive for now. We will parse directive in the second 
iteration
       int paren = 0;
       while (Tok.isNot(tok::r_paren) || paren != 0) {
diff --git a/clang/test/OpenMP/metadirective_ast_print.c 
b/clang/test/OpenMP/metadirective_ast_print.c
index d9ff7e764521607..28efaac5949427b 100644
--- a/clang/test/OpenMP/metadirective_ast_print.c
+++ b/clang/test/OpenMP/metadirective_ast_print.c
@@ -15,18 +15,18 @@ void bar(void);
 #define N 10
 void foo(void) {
 #pragma omp metadirective when(device = {kind(cpu)} \
-                               : parallel) default()
+                               : parallel) otherwise()
   bar();
 #pragma omp metadirective when(implementation = {vendor(score(0)  \
                                                         : llvm)}, \
                                device = {kind(cpu)}               \
-                               : parallel) default(target teams)
+                               : parallel) otherwise(target teams)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)}                            
     \
                                : target teams) when(implementation = 
{vendor(llvm)} \
-                                                    : parallel) default()
+                                                    : parallel) otherwise()
   bar();
-#pragma omp metadirective default(target) when(implementation = 
{vendor(score(5)  \
+#pragma omp metadirective otherwise(target) when(implementation = 
{vendor(score(5)  \
                                                                         : 
llvm)}, \
                                                device = {kind(cpu, host)}      
   \
                                                : parallel)
@@ -40,15 +40,15 @@ void foo(void) {
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_all)} \
-                               : parallel) default(parallel for)
+                               : parallel) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_any)} \
-                               : parallel) default(parallel for)
+                               : parallel) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_none)} \
-                               : parallel) default(parallel for)
+                               : parallel) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 
@@ -64,17 +64,17 @@ void foo(void) {
 
 #pragma omp metadirective when(device={arch("amdgcn")}: \
                                 teams distribute parallel for)\
-                                default(parallel for)
+                                otherwise(parallel for)
   for (int i = 0; i < 100; i++)
   ;
 
 #pragma omp metadirective when(implementation = {extension(match_all)} \
-                               : nothing) default(parallel for)
+                               : nothing) otherwise(parallel for)
   for (int i = 0; i < 16; i++)
     ;
 
 #pragma omp metadirective when(implementation = {extension(match_any)} \
-                               : parallel) default(nothing)
+                               : parallel) otherwise(nothing)
   for (int i = 0; i < 16; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_device_arch_codegen.cpp 
b/clang/test/OpenMP/metadirective_device_arch_codegen.cpp
index eecae310d0a7783..c44337b33d5b39e 100644
--- a/clang/test/OpenMP/metadirective_device_arch_codegen.cpp
+++ b/clang/test/OpenMP/metadirective_device_arch_codegen.cpp
@@ -27,7 +27,7 @@ int metadirective1() {
    {
       #pragma omp metadirective \
                    when(device={arch("amdgcn")}: teams distribute parallel 
for) \
-                   default(parallel for)
+                   otherwise(parallel for)
 
          for (int i = 0; i < N; i++) {
            #pragma omp atomic write
diff --git a/clang/test/OpenMP/metadirective_device_isa_codegen.cpp 
b/clang/test/OpenMP/metadirective_device_isa_codegen.cpp
index 1d098063101d7ea..1b9829f7a56cef9 100644
--- a/clang/test/OpenMP/metadirective_device_isa_codegen.cpp
+++ b/clang/test/OpenMP/metadirective_device_isa_codegen.cpp
@@ -8,7 +8,7 @@ void bar();
 
 void x86_64_device_isa_selected() {
 #pragma omp metadirective when(device = {isa("sse2")} \
-                               : parallel) default(single)
+                               : parallel) otherwise(single)
   bar();
 }
 // CHECK-LABEL: void @_Z26x86_64_device_isa_selectedv()
@@ -21,7 +21,7 @@ void x86_64_device_isa_selected() {
 
 void x86_64_device_isa_not_selected() {
 #pragma omp metadirective when(device = {isa("some-unsupported-feature")} \
-                               : parallel) default(single)
+                               : parallel) otherwise(single)
   bar();
 }
 // CHECK-LABEL: void @_Z30x86_64_device_isa_not_selectedv()
diff --git a/clang/test/OpenMP/metadirective_device_isa_codegen_amdgcn.cpp 
b/clang/test/OpenMP/metadirective_device_isa_codegen_amdgcn.cpp
index cbb75c4a68376a3..c2c7b72a8469fd6 100644
--- a/clang/test/OpenMP/metadirective_device_isa_codegen_amdgcn.cpp
+++ b/clang/test/OpenMP/metadirective_device_isa_codegen_amdgcn.cpp
@@ -15,7 +15,7 @@ int amdgcn_device_isa_selected() {
   {
 #pragma omp metadirective                     \
     when(device = {isa("dpp")} \
-         : parallel) default(single)
+         : parallel) otherwise(single)
     threadCount++;
   }
 
@@ -38,7 +38,7 @@ int amdgcn_device_isa_not_selected() {
     when(device = {isa("sse")}                                 \
          : parallel)                                           \
         when(device = {isa("another-unsupported-gpu-feature")} \
-             : parallel) default(single)
+             : parallel) otherwise(single)
     threadCount++;
   }
 
diff --git a/clang/test/OpenMP/metadirective_device_kind_codegen.c 
b/clang/test/OpenMP/metadirective_device_kind_codegen.c
index f77f50426a16d42..0a8c54af2effd17 100644
--- a/clang/test/OpenMP/metadirective_device_kind_codegen.c
+++ b/clang/test/OpenMP/metadirective_device_kind_codegen.c
@@ -30,7 +30,7 @@ void foo(void) {
                                : parallel)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)} \
-                               : target parallel for) default(parallel for)
+                               : target parallel for) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_device_kind_codegen.cpp 
b/clang/test/OpenMP/metadirective_device_kind_codegen.cpp
index bfbfec8b27e1e88..446fd646ef17fc4 100644
--- a/clang/test/OpenMP/metadirective_device_kind_codegen.cpp
+++ b/clang/test/OpenMP/metadirective_device_kind_codegen.cpp
@@ -31,7 +31,7 @@ void foo() {
                                : parallel)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)} \
-                               : target parallel for) default(parallel for)
+                               : target parallel for) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_empty.cpp 
b/clang/test/OpenMP/metadirective_empty.cpp
index b93ed722cb6e904..9fcd35e82292d98 100644
--- a/clang/test/OpenMP/metadirective_empty.cpp
+++ b/clang/test/OpenMP/metadirective_empty.cpp
@@ -11,12 +11,12 @@ void func() {
   // Test where a valid when clause contains empty directive.
   // The directive will be ignored and code for a serial for loop will be 
generated.
 #pragma omp metadirective when(implementation = {vendor(llvm)} \
-                               :) default(parallel for)
+                               :) otherwise(parallel for)
   for (int i = 0; i < N; i++)
     ;
 
 #pragma omp metadirective when(implementation = {vendor(llvm)} \
-                               :nothing) default(parallel for)
+                               :nothing) otherwise(parallel for)
   for (int i = 0; i < N; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_implementation_codegen.c 
b/clang/test/OpenMP/metadirective_implementation_codegen.c
index da09b639d6d4098..dc0bcbaebd09922 100644
--- a/clang/test/OpenMP/metadirective_implementation_codegen.c
+++ b/clang/test/OpenMP/metadirective_implementation_codegen.c
@@ -12,27 +12,27 @@ void foo(void) {
 #pragma omp metadirective when(implementation = {vendor(score(0)  \
                                                         : llvm)}, \
                                device = {kind(cpu)}               \
-                               : parallel) default(target teams)
+                               : parallel) otherwise(target teams)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)}                            
     \
                                : target teams) when(implementation = 
{vendor(llvm)} \
-                                                    : parallel) default()
+                                                    : parallel) otherwise()
   bar();
-#pragma omp metadirective default(target) when(implementation = 
{vendor(score(5)  \
+#pragma omp metadirective otherwise(target) when(implementation = 
{vendor(score(5)  \
                                                                         : 
llvm)}, \
                                                device = {kind(cpu, host)}      
   \
                                                : parallel)
   bar();
 #pragma omp metadirective when(implementation = {extension(match_all)} \
-                               : parallel) default(parallel for)
+                               : parallel) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_any)} \
-                               : parallel) default(parallel for)
+                               : parallel) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_none)} \
-                               : parallel) default(parallel for)
+                               : parallel) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_implementation_codegen.cpp 
b/clang/test/OpenMP/metadirective_implementation_codegen.cpp
index b9f43d1a1e87cd0..a20b2e2f14bcd4e 100644
--- a/clang/test/OpenMP/metadirective_implementation_codegen.cpp
+++ b/clang/test/OpenMP/metadirective_implementation_codegen.cpp
@@ -12,27 +12,27 @@ void foo() {
 #pragma omp metadirective when(implementation = {vendor(score(0)  \
                                                         : llvm)}, \
                                device = {kind(cpu)}               \
-                               : parallel) default(target teams)
+                               : parallel) otherwise(target teams)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)}                            
     \
                                : target teams) when(implementation = 
{vendor(llvm)} \
-                                                    : parallel) default()
+                                                    : parallel) otherwise()
   bar();
-#pragma omp metadirective default(target) when(implementation = 
{vendor(score(5)  \
+#pragma omp metadirective otherwise(target) when(implementation = 
{vendor(score(5)  \
                                                                         : 
llvm)}, \
                                                device = {kind(cpu, host)}      
   \
                                                : parallel)
   bar();
 #pragma omp metadirective when(implementation = {extension(match_all)} \
-                               : parallel) default(parallel for)
+                               : parallel) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_any)} \
-                               : parallel) default(parallel for)
+                               : parallel) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_none)} \
-                               : parallel) default(parallel for)
+                               : parallel) otherwise(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_messages.cpp 
b/clang/test/OpenMP/metadirective_messages.cpp
index b342a094a7870a8..8a32b36c016d6e6 100644
--- a/clang/test/OpenMP/metadirective_messages.cpp
+++ b/clang/test/OpenMP/metadirective_messages.cpp
@@ -11,12 +11,16 @@ void foo() {
   ;
 #pragma omp metadirective when(device{arch(nvptx)}) // expected-error 
{{missing ':' in when clause}} expected-error {{expected expression}} 
expected-warning {{expected '=' after the context set name "device"; '=' 
assumed}}
   ;
-#pragma omp metadirective when(device{arch(nvptx)}: ) default() // 
expected-warning {{expected '=' after the context set name "device"; '=' 
assumed}}
+#pragma omp metadirective when(device{arch(nvptx)}: ) otherwise() // 
expected-warning {{expected '=' after the context set name "device"; '=' 
assumed}}
   ;
-#pragma omp metadirective when(device = {arch(nvptx)} : ) default(xyz) // 
expected-error {{expected an OpenMP directive}} expected-error {{use of 
undeclared identifier 'xyz'}}
+#pragma omp metadirective when(device = {arch(nvptx)} : ) otherwise(xyz) // 
expected-error {{expected an OpenMP directive}} expected-error {{use of 
undeclared identifier 'xyz'}}
   ;
-#pragma omp metadirective when(device = {arch(nvptx)} : parallel default() // 
expected-error {{expected ',' or ')' in 'when' clause}} expected-error 
{{expected expression}}
+#pragma omp metadirective when(device = {arch(nvptx)} : parallel otherwise() 
// expected-error {{expected ',' or ')' in 'when' clause}} expected-error 
{{expected expression}}
   ;
-#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : 
parallel) default(single) // expected-warning {{isa trait 
'some-unsupported-feature' is not known to the current target; verify the 
spelling or consider restricting the context selector with the 'arch' selector 
further}}
+#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : 
parallel) otherwise(single) // expected-warning {{isa trait 
'some-unsupported-feature' is not known to the current target; verify the 
spelling or consider restricting the context selector with the 'arch' selector 
further}}
+  ;
+#pragma omp metadirective when(device = {arch(nvptx)} : parallel) default() // 
expected-warning {{'default' clause for 'metadirective' is deprecated; use 
'otherwise' instead}}
+  ;
+#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() 
//expected-error {{unknown clause 'xyz' in metadirective}} expected-error {{use 
of undeclared identifier 'xyz'}} expected-error {{expected expression}} 
expected-error {{expected ';' after expression}}
   ;
 }

>From be152cbebf2b5be802f4d98b1639a1ab84194e07 Mon Sep 17 00:00:00 2001
From: Urvi Rav <urvi.ra...@gmail.com>
Date: Tue, 4 Feb 2025 21:10:21 -0600
Subject: [PATCH 2/3] changes in uknown clause error

---
 clang/lib/Parse/ParseOpenMP.cpp              | 1 -
 clang/test/OpenMP/metadirective_messages.cpp | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 673806ef28b9fc6..a0f4a2c7a220f46 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -2747,7 +2747,6 @@ StmtResult 
Parser::ParseOpenMPDeclarativeOrExecutableDirective(
       if (CKind == OMPC_unknown) {
         Diag(Tok, diag::err_omp_unknown_clause)
         << PP.getSpelling(Tok) << "metadirective";
-        return Directive;
       }
       if(CKind == OMPC_default) {
         Diag(Tok, diag::warn_omp_default_deprecated);
diff --git a/clang/test/OpenMP/metadirective_messages.cpp 
b/clang/test/OpenMP/metadirective_messages.cpp
index 8a32b36c016d6e6..955bc70e0b9660d 100644
--- a/clang/test/OpenMP/metadirective_messages.cpp
+++ b/clang/test/OpenMP/metadirective_messages.cpp
@@ -21,6 +21,6 @@ void foo() {
   ;
 #pragma omp metadirective when(device = {arch(nvptx)} : parallel) default() // 
expected-warning {{'default' clause for 'metadirective' is deprecated; use 
'otherwise' instead}}
   ;
-#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() 
//expected-error {{unknown clause 'xyz' in metadirective}} expected-error {{use 
of undeclared identifier 'xyz'}} expected-error {{expected expression}} 
expected-error {{expected ';' after expression}}
+#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() 
//expected-error {{unknown clause 'xyz' in metadirective}} 
   ;
 }

>From 5976ae86e45c0a50a9d409db3c5f30b9cdc5169a Mon Sep 17 00:00:00 2001
From: Urvi Rav <urvi.ra...@gmail.com>
Date: Thu, 6 Feb 2025 04:37:17 -0600
Subject: [PATCH 3/3] updated clause handling in ParseOpenMP.cpp

---
 clang/lib/Parse/ParseOpenMP.cpp               |  8 ++-
 clang/test/OpenMP/metadirective_ast_print.c   | 20 +++---
 .../metadirective_device_arch_codegen.cpp     |  2 +-
 .../metadirective_device_isa_codegen.cpp      |  4 +-
 ...etadirective_device_isa_codegen_amdgcn.cpp |  4 +-
 .../metadirective_device_kind_codegen.c       |  2 +-
 .../metadirective_device_kind_codegen.cpp     |  2 +-
 clang/test/OpenMP/metadirective_empty.cpp     |  4 +-
 .../metadirective_implementation_codegen.c    | 12 ++--
 .../metadirective_implementation_codegen.cpp  | 12 ++--
 clang/test/OpenMP/metadirective_messages.cpp  | 63 +++++++++++++------
 11 files changed, 80 insertions(+), 53 deletions(-)

diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index a0f4a2c7a220f46..6ed3d2c7795515f 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -2744,11 +2744,15 @@ StmtResult 
Parser::ParseOpenMPDeclarativeOrExecutableDirective(
                                    ? OMPC_unknown
                                    : getOpenMPClauseKind(PP.getSpelling(Tok));
       // Check if the clause is unrecognized.
-      if (CKind == OMPC_unknown) {
+      if (getLangOpts().OpenMP < 52 && (CKind == OMPC_unknown || CKind == 
OMPC_otherwise)) {
         Diag(Tok, diag::err_omp_unknown_clause)
         << PP.getSpelling(Tok) << "metadirective";
       }
-      if(CKind == OMPC_default) {
+      if (getLangOpts().OpenMP >= 52 && CKind == OMPC_unknown) {
+        Diag(Tok, diag::err_omp_unknown_clause)
+        << PP.getSpelling(Tok) << "metadirective";
+      }
+      if(CKind == OMPC_default && getLangOpts().OpenMP >= 52) {
         Diag(Tok, diag::warn_omp_default_deprecated);
       }
       SourceLocation Loc = ConsumeToken();
diff --git a/clang/test/OpenMP/metadirective_ast_print.c 
b/clang/test/OpenMP/metadirective_ast_print.c
index 28efaac5949427b..d9ff7e764521607 100644
--- a/clang/test/OpenMP/metadirective_ast_print.c
+++ b/clang/test/OpenMP/metadirective_ast_print.c
@@ -15,18 +15,18 @@ void bar(void);
 #define N 10
 void foo(void) {
 #pragma omp metadirective when(device = {kind(cpu)} \
-                               : parallel) otherwise()
+                               : parallel) default()
   bar();
 #pragma omp metadirective when(implementation = {vendor(score(0)  \
                                                         : llvm)}, \
                                device = {kind(cpu)}               \
-                               : parallel) otherwise(target teams)
+                               : parallel) default(target teams)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)}                            
     \
                                : target teams) when(implementation = 
{vendor(llvm)} \
-                                                    : parallel) otherwise()
+                                                    : parallel) default()
   bar();
-#pragma omp metadirective otherwise(target) when(implementation = 
{vendor(score(5)  \
+#pragma omp metadirective default(target) when(implementation = 
{vendor(score(5)  \
                                                                         : 
llvm)}, \
                                                device = {kind(cpu, host)}      
   \
                                                : parallel)
@@ -40,15 +40,15 @@ void foo(void) {
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_all)} \
-                               : parallel) otherwise(parallel for)
+                               : parallel) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_any)} \
-                               : parallel) otherwise(parallel for)
+                               : parallel) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_none)} \
-                               : parallel) otherwise(parallel for)
+                               : parallel) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 
@@ -64,17 +64,17 @@ void foo(void) {
 
 #pragma omp metadirective when(device={arch("amdgcn")}: \
                                 teams distribute parallel for)\
-                                otherwise(parallel for)
+                                default(parallel for)
   for (int i = 0; i < 100; i++)
   ;
 
 #pragma omp metadirective when(implementation = {extension(match_all)} \
-                               : nothing) otherwise(parallel for)
+                               : nothing) default(parallel for)
   for (int i = 0; i < 16; i++)
     ;
 
 #pragma omp metadirective when(implementation = {extension(match_any)} \
-                               : parallel) otherwise(nothing)
+                               : parallel) default(nothing)
   for (int i = 0; i < 16; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_device_arch_codegen.cpp 
b/clang/test/OpenMP/metadirective_device_arch_codegen.cpp
index c44337b33d5b39e..eecae310d0a7783 100644
--- a/clang/test/OpenMP/metadirective_device_arch_codegen.cpp
+++ b/clang/test/OpenMP/metadirective_device_arch_codegen.cpp
@@ -27,7 +27,7 @@ int metadirective1() {
    {
       #pragma omp metadirective \
                    when(device={arch("amdgcn")}: teams distribute parallel 
for) \
-                   otherwise(parallel for)
+                   default(parallel for)
 
          for (int i = 0; i < N; i++) {
            #pragma omp atomic write
diff --git a/clang/test/OpenMP/metadirective_device_isa_codegen.cpp 
b/clang/test/OpenMP/metadirective_device_isa_codegen.cpp
index 1b9829f7a56cef9..1d098063101d7ea 100644
--- a/clang/test/OpenMP/metadirective_device_isa_codegen.cpp
+++ b/clang/test/OpenMP/metadirective_device_isa_codegen.cpp
@@ -8,7 +8,7 @@ void bar();
 
 void x86_64_device_isa_selected() {
 #pragma omp metadirective when(device = {isa("sse2")} \
-                               : parallel) otherwise(single)
+                               : parallel) default(single)
   bar();
 }
 // CHECK-LABEL: void @_Z26x86_64_device_isa_selectedv()
@@ -21,7 +21,7 @@ void x86_64_device_isa_selected() {
 
 void x86_64_device_isa_not_selected() {
 #pragma omp metadirective when(device = {isa("some-unsupported-feature")} \
-                               : parallel) otherwise(single)
+                               : parallel) default(single)
   bar();
 }
 // CHECK-LABEL: void @_Z30x86_64_device_isa_not_selectedv()
diff --git a/clang/test/OpenMP/metadirective_device_isa_codegen_amdgcn.cpp 
b/clang/test/OpenMP/metadirective_device_isa_codegen_amdgcn.cpp
index c2c7b72a8469fd6..cbb75c4a68376a3 100644
--- a/clang/test/OpenMP/metadirective_device_isa_codegen_amdgcn.cpp
+++ b/clang/test/OpenMP/metadirective_device_isa_codegen_amdgcn.cpp
@@ -15,7 +15,7 @@ int amdgcn_device_isa_selected() {
   {
 #pragma omp metadirective                     \
     when(device = {isa("dpp")} \
-         : parallel) otherwise(single)
+         : parallel) default(single)
     threadCount++;
   }
 
@@ -38,7 +38,7 @@ int amdgcn_device_isa_not_selected() {
     when(device = {isa("sse")}                                 \
          : parallel)                                           \
         when(device = {isa("another-unsupported-gpu-feature")} \
-             : parallel) otherwise(single)
+             : parallel) default(single)
     threadCount++;
   }
 
diff --git a/clang/test/OpenMP/metadirective_device_kind_codegen.c 
b/clang/test/OpenMP/metadirective_device_kind_codegen.c
index 0a8c54af2effd17..f77f50426a16d42 100644
--- a/clang/test/OpenMP/metadirective_device_kind_codegen.c
+++ b/clang/test/OpenMP/metadirective_device_kind_codegen.c
@@ -30,7 +30,7 @@ void foo(void) {
                                : parallel)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)} \
-                               : target parallel for) otherwise(parallel for)
+                               : target parallel for) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_device_kind_codegen.cpp 
b/clang/test/OpenMP/metadirective_device_kind_codegen.cpp
index 446fd646ef17fc4..bfbfec8b27e1e88 100644
--- a/clang/test/OpenMP/metadirective_device_kind_codegen.cpp
+++ b/clang/test/OpenMP/metadirective_device_kind_codegen.cpp
@@ -31,7 +31,7 @@ void foo() {
                                : parallel)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)} \
-                               : target parallel for) otherwise(parallel for)
+                               : target parallel for) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_empty.cpp 
b/clang/test/OpenMP/metadirective_empty.cpp
index 9fcd35e82292d98..b93ed722cb6e904 100644
--- a/clang/test/OpenMP/metadirective_empty.cpp
+++ b/clang/test/OpenMP/metadirective_empty.cpp
@@ -11,12 +11,12 @@ void func() {
   // Test where a valid when clause contains empty directive.
   // The directive will be ignored and code for a serial for loop will be 
generated.
 #pragma omp metadirective when(implementation = {vendor(llvm)} \
-                               :) otherwise(parallel for)
+                               :) default(parallel for)
   for (int i = 0; i < N; i++)
     ;
 
 #pragma omp metadirective when(implementation = {vendor(llvm)} \
-                               :nothing) otherwise(parallel for)
+                               :nothing) default(parallel for)
   for (int i = 0; i < N; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_implementation_codegen.c 
b/clang/test/OpenMP/metadirective_implementation_codegen.c
index dc0bcbaebd09922..da09b639d6d4098 100644
--- a/clang/test/OpenMP/metadirective_implementation_codegen.c
+++ b/clang/test/OpenMP/metadirective_implementation_codegen.c
@@ -12,27 +12,27 @@ void foo(void) {
 #pragma omp metadirective when(implementation = {vendor(score(0)  \
                                                         : llvm)}, \
                                device = {kind(cpu)}               \
-                               : parallel) otherwise(target teams)
+                               : parallel) default(target teams)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)}                            
     \
                                : target teams) when(implementation = 
{vendor(llvm)} \
-                                                    : parallel) otherwise()
+                                                    : parallel) default()
   bar();
-#pragma omp metadirective otherwise(target) when(implementation = 
{vendor(score(5)  \
+#pragma omp metadirective default(target) when(implementation = 
{vendor(score(5)  \
                                                                         : 
llvm)}, \
                                                device = {kind(cpu, host)}      
   \
                                                : parallel)
   bar();
 #pragma omp metadirective when(implementation = {extension(match_all)} \
-                               : parallel) otherwise(parallel for)
+                               : parallel) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_any)} \
-                               : parallel) otherwise(parallel for)
+                               : parallel) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_none)} \
-                               : parallel) otherwise(parallel for)
+                               : parallel) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_implementation_codegen.cpp 
b/clang/test/OpenMP/metadirective_implementation_codegen.cpp
index a20b2e2f14bcd4e..b9f43d1a1e87cd0 100644
--- a/clang/test/OpenMP/metadirective_implementation_codegen.cpp
+++ b/clang/test/OpenMP/metadirective_implementation_codegen.cpp
@@ -12,27 +12,27 @@ void foo() {
 #pragma omp metadirective when(implementation = {vendor(score(0)  \
                                                         : llvm)}, \
                                device = {kind(cpu)}               \
-                               : parallel) otherwise(target teams)
+                               : parallel) default(target teams)
   bar();
 #pragma omp metadirective when(device = {kind(gpu)}                            
     \
                                : target teams) when(implementation = 
{vendor(llvm)} \
-                                                    : parallel) otherwise()
+                                                    : parallel) default()
   bar();
-#pragma omp metadirective otherwise(target) when(implementation = 
{vendor(score(5)  \
+#pragma omp metadirective default(target) when(implementation = 
{vendor(score(5)  \
                                                                         : 
llvm)}, \
                                                device = {kind(cpu, host)}      
   \
                                                : parallel)
   bar();
 #pragma omp metadirective when(implementation = {extension(match_all)} \
-                               : parallel) otherwise(parallel for)
+                               : parallel) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_any)} \
-                               : parallel) otherwise(parallel for)
+                               : parallel) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 #pragma omp metadirective when(implementation = {extension(match_none)} \
-                               : parallel) otherwise(parallel for)
+                               : parallel) default(parallel for)
   for (int i = 0; i < 100; i++)
     ;
 }
diff --git a/clang/test/OpenMP/metadirective_messages.cpp 
b/clang/test/OpenMP/metadirective_messages.cpp
index 955bc70e0b9660d..7645a316c3d3cd8 100644
--- a/clang/test/OpenMP/metadirective_messages.cpp
+++ b/clang/test/OpenMP/metadirective_messages.cpp
@@ -2,25 +2,48 @@
 
 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -verify -fopenmp-simd -x c++ 
-std=c++14 -fexceptions -fcxx-exceptions %s
 
+// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 
-ferror-limit 100 -o - %s -Wuninitialized
+
 void foo() {
-#pragma omp metadirective // expected-error {{expected expression}}
-  ;
-#pragma omp metadirective when() // expected-error {{expected valid context 
selector in when clause}} expected-error {{expected expression}} 
expected-warning {{expected identifier or string literal describing a context 
set; set skipped}} expected-note {{context set options are: 'construct' 
'device' 'implementation' 'user'}} expected-note {{the ignored set spans until 
here}}
-  ;
-#pragma omp metadirective when(device{}) // expected-warning {{expected '=' 
after the context set name "device"; '=' assumed}} expected-warning {{expected 
identifier or string literal describing a context selector; selector skipped}} 
expected-note {{context selector options are: 'kind' 'arch' 'isa'}} 
expected-note {{the ignored selector spans until here}} expected-error 
{{expected valid context selector in when clause}} expected-error {{expected 
expression}}
-  ;
-#pragma omp metadirective when(device{arch(nvptx)}) // expected-error 
{{missing ':' in when clause}} expected-error {{expected expression}} 
expected-warning {{expected '=' after the context set name "device"; '=' 
assumed}}
-  ;
-#pragma omp metadirective when(device{arch(nvptx)}: ) otherwise() // 
expected-warning {{expected '=' after the context set name "device"; '=' 
assumed}}
-  ;
-#pragma omp metadirective when(device = {arch(nvptx)} : ) otherwise(xyz) // 
expected-error {{expected an OpenMP directive}} expected-error {{use of 
undeclared identifier 'xyz'}}
-  ;
-#pragma omp metadirective when(device = {arch(nvptx)} : parallel otherwise() 
// expected-error {{expected ',' or ')' in 'when' clause}} expected-error 
{{expected expression}}
-  ;
-#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : 
parallel) otherwise(single) // expected-warning {{isa trait 
'some-unsupported-feature' is not known to the current target; verify the 
spelling or consider restricting the context selector with the 'arch' selector 
further}}
-  ;
-#pragma omp metadirective when(device = {arch(nvptx)} : parallel) default() // 
expected-warning {{'default' clause for 'metadirective' is deprecated; use 
'otherwise' instead}}
-  ;
-#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() 
//expected-error {{unknown clause 'xyz' in metadirective}} 
-  ;
+#if _OPENMP >= 202111
+  #pragma omp metadirective // omp52-error {{expected expression}}
+    ;
+  #pragma omp metadirective when() // omp52-error {{expected valid context 
selector in when clause}} expected-error {{expected expression}} 
expected-warning {{expected identifier or string literal describing a context 
set; set skipped}} expected-note {{context set options are: 'construct' 
'device' 'implementation' 'user'}} expected-note {{the ignored set spans until 
here}}
+    ;
+  #pragma omp metadirective when(device{}) // omp52-warning {{expected '=' 
after the context set name "device"; '=' assumed}} expected-warning {{expected 
identifier or string literal describing a context selector; selector skipped}} 
expected-note {{context selector options are: 'kind' 'arch' 'isa'}} 
expected-note {{the ignored selector spans until here}} expected-error 
{{expected valid context selector in when clause}} expected-error {{expected 
expression}}
+    ;
+  #pragma omp metadirective when(device{arch(nvptx)}) // omp52-error {{missing 
':' in when clause}} expected-error {{expected expression}} expected-warning 
{{expected '=' after the context set name "device"; '=' assumed}}
+    ;
+  #pragma omp metadirective when(device{arch(nvptx)}: ) otherwise() // 
omp52-warning {{expected '=' after the context set name "device"; '=' assumed}}
+    ;
+  #pragma omp metadirective when(device = {arch(nvptx)} : ) otherwise(xyz) // 
omp52-error {{expected an OpenMP directive}} expected-error {{use of undeclared 
identifier 'xyz'}}
+    ;
+  #pragma omp metadirective when(device = {arch(nvptx)} : parallel otherwise() 
// omp52-error {{expected ',' or ')' in 'when' clause}} expected-error 
{{expected expression}}
+    ;
+  #pragma omp metadirective when(device = {isa("some-unsupported-feature")} : 
parallel) otherwise(single) // omp52-warning {{isa trait 
'some-unsupported-feature' is not known to the current target; verify the 
spelling or consider restricting the context selector with the 'arch' selector 
further}}
+    ;
+  #pragma omp metadirective when(device = {arch(nvptx)} : parallel) default() 
// omp52-warning {{'default' clause for 'metadirective' is deprecated; use 
'otherwise' instead}}
+    ;
+  #pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() 
//omp52-error {{unknown clause 'xyz' in metadirective}} 
+    ;
+#else
+  #pragma omp metadirective // expected-error {{expected expression}}
+    ;
+  #pragma omp metadirective when() // expected-error {{expected valid context 
selector in when clause}} expected-error {{expected expression}} 
expected-warning {{expected identifier or string literal describing a context 
set; set skipped}} expected-note {{context set options are: 'construct' 
'device' 'implementation' 'user'}} expected-note {{the ignored set spans until 
here}}
+    ;
+  #pragma omp metadirective when(device{}) // expected-warning {{expected '=' 
after the context set name "device"; '=' assumed}} expected-warning {{expected 
identifier or string literal describing a context selector; selector skipped}} 
expected-note {{context selector options are: 'kind' 'arch' 'isa'}} 
expected-note {{the ignored selector spans until here}} expected-error 
{{expected valid context selector in when clause}} expected-error {{expected 
expression}}
+    ;
+  #pragma omp metadirective when(device{arch(nvptx)}) // expected-error 
{{missing ':' in when clause}} expected-error {{expected expression}} 
expected-warning {{expected '=' after the context set name "device"; '=' 
assumed}}
+    ;
+  #pragma omp metadirective when(device{arch(nvptx)}: ) default() // 
expected-warning {{expected '=' after the context set name "device"; '=' 
assumed}}
+    ;
+  #pragma omp metadirective when(device = {arch(nvptx)} : ) default(xyz) // 
expected-error {{expected an OpenMP directive}} expected-error {{use of 
undeclared identifier 'xyz'}}
+    ;
+  #pragma omp metadirective when(device = {arch(nvptx)} : parallel default() 
// expected-error {{expected ',' or ')' in 'when' clause}} expected-error 
{{expected expression}}
+    ;
+  #pragma omp metadirective when(device = {isa("some-unsupported-feature")} : 
parallel) default(single) // expected-warning {{isa trait 
'some-unsupported-feature' is not known to the current target; verify the 
spelling or consider restricting the context selector with the 'arch' selector 
further}}
+    ;
+  #pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() 
//expected-error {{unknown clause 'xyz' in metadirective}} 
+    ;
+#endif
 }

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to