================
@@ -0,0 +1,48 @@
+// Test for ompx_name clause error checking
+// RUN: %clang_cc1 -std=c++20 -verify -fopenmp %s
+
+static void foo() {
+}
+
+void bar() {
+  int x = 5;
+
+  // expected-error@+1 {{argument to 'ompx_name' clause must be a string 
literal}}
+  #pragma omp target ompx_name(x)
+  {
+  }
+
+  // expected-error@+1 {{argument to 'ompx_name' clause must be a string 
literal}}
+  #pragma omp target ompx_name(123)
+  {
+  }
+
+  // This should work - string literal
+  #pragma omp target ompx_name("valid_name")
+  {
+  }
+
+// expected-note@+1 {{previous use of this kernel name is here}}
+#pragma omp target ompx_name("baz")
+  foo();
+
+// expected-warning@+1 {{OpenMP target kernel name 'baz' is used more than 
once in this translation unit}}
+#pragma omp target ompx_name("baz")
----------------
jdoerfert wrote:

You should get the errors at compile or runtime, but that is, for me, expected. 
We can add an extension later to make the name unique with a suffix, but for 
now, errors should be fine.

https://github.com/llvm/llvm-project/pull/200301
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to