[clang] Add sycl_external attribute (PR #140282)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Fri May 16 20:45:28 PDT 2025
================
@@ -1545,6 +1550,18 @@ def SYCLKernel : InheritableAttr {
let Documentation = [SYCLKernelDocs];
}
+def GlobalStorageNonLocalVar : SubsetSubject<Var,
+ [{S->hasGlobalStorage() &&
+ !S->isLocalVarDeclOrParm()}],
+ "global variables">;
+
+def SYCLExternal : InheritableAttr {
+ let Spellings = [GNU<"sycl_external">];
+ let Subjects = SubjectList<[Function, GlobalStorageNonLocalVar]>;
----------------
tahonermann wrote:
In SYCL 2020, the `SYCL_EXTERNAL` macro only applies to functions. Intel downstream repos allow the `sycl_device` attribute (which is used to implement `SYCL_EXTERNAL` there) to be applied to variables, but that isn't needed for SYCL 2020 conformance. If we later find a need to extend the semantics of `sycl_external` to variables, we should check with the SYCL WG to see if additions to the SYCL specification to support such semantics are warranted.
https://github.com/llvm/llvm-project/pull/140282
More information about the cfe-commits
mailing list