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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 23 10:12:21 PDT 2025


================
@@ -1641,6 +1641,13 @@ def DeviceKernel : DeclOrTypeAttr {
 }];
 }
 
+def SYCLExternal : InheritableAttr {
+  let Spellings = [Clang<"sycl_external">];
----------------
erichkeane 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.

Ah!  Yes, I was suggesting to dump the GNU spelling.  Keeping the clang namespace is also the right thing to do, so your suggestion is the right one.

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


More information about the cfe-commits mailing list