[clang] [clang][SYCL] Add additional Sema rules for SYCL kernel parameters (PR #208571)

Ian Li via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 5 16:46:48 PDT 2026


================
@@ -213,3 +188,163 @@ void test() {
 }
 
 } // namespace badref7
+
+
+#include <stdatomic.h>
+// Check for atomic parameters and subobjects.
+namespace atomic1 {
+// Kernel entry point template definition.
+template<typename KNT, typename T>
+[[clang::sycl_kernel_entry_point(KNT)]]
+void kernel_single_task(T t) {} // expected-note-re {{within parameter 't' of type '(lambda at {{.*}})' declared here}}
+                                // expected-note-re at -1 {{within parameter 't' of type '(lambda at {{.*}})' declared here}}
+                                // expected-note-re at -2 {{within parameter 't' of type '(lambda at {{.*}})' declared here}}
+                                // expected-note-re at -3 {{within parameter 't' of type '(lambda at {{.*}})' declared here}}
+                                // expected-note at -4 {{within parameter 't' of type 'atomic1::Kernel' declared here}}
+
+struct Sa { 
+  int a;
+  _Atomic int b; // expected-error {{'_Atomic(int)' cannot be used as the type of a kernel parameter}}
+                 // expected-note at -3 {{within field of type 'Sa' declared here}}
----------------
ianayl wrote:

Data member name is included now, although should I change the rest of our diagnostics to use "data member" too, specifically for SYCL? It'd deviate from the rest of the diagnostics that still uses "field" however

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


More information about the cfe-commits mailing list