[clang] [llvm] [OpenMP] Introduce the ompx_name clause for kernel naming (PR #200301)
Shilei Tian via cfe-commits
cfe-commits at lists.llvm.org
Sat May 30 20:23:06 PDT 2026
================
@@ -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 at +1 {{argument to 'ompx_name' clause must be a string literal}}
+ #pragma omp target ompx_name(x)
+ {
+ }
+
+ // expected-error at +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 at +1 {{previous use of this kernel name is here}}
+#pragma omp target ompx_name("baz")
+ foo();
+
+// expected-warning at +1 {{OpenMP target kernel name 'baz' is used more than once in this translation unit}}
+#pragma omp target ompx_name("baz")
----------------
shiltian wrote:
This is an interesting aspect. I guess another case is a target region in a header.
https://github.com/llvm/llvm-project/pull/200301
More information about the cfe-commits
mailing list