[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 23 10:10:29 PDT 2025


================
@@ -1641,6 +1641,13 @@ def DeviceKernel : DeclOrTypeAttr {
 }];
 }
 
+def SYCLExternal : InheritableAttr {
+  let Spellings = [Clang<"sycl_external">];
----------------
tahonermann wrote:

We use the `Clang` spelling for `sycl_kernel_entry_point`, what would be the reason for doing differently here? The attribute is an implementation detail used to provide the `SYCL_EXTERNAL` functionality, so shouldn't be directly written by SYCL programmers. Are you suggesting excluding the `GNU` spelling?

SYCL is only relevant for C++, so the `C23` spelling wouldn't be desired.

If we switch to (only) the `CXX11` spelling, I think the `clang` namespace should be retained.
```suggestion
  let Spellings = [CXX11<"clang", "sycl_external">];
```

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


More information about the cfe-commits mailing list