[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
Mon Jun 16 07:01:05 PDT 2025


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

Error diagnostics are explicitly requested for many other attributes including `sycl_kernel_entry_point`. I think the default is to emit a warning if an attribute is used with an entity for which it does not appertain; we should be consistent.
```suggestion
  let Subjects = SubjectList<[Function], ErrorDiag>;
```

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


More information about the cfe-commits mailing list