[clang] [clang][SYCL] Implement address space attributes for SYCL (PR #200849)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 15 23:21:41 PDT 2026
================
@@ -576,21 +576,38 @@ class ParsedAttr final
}
}
- /// If this is an OpenCL address space attribute, returns its SYCL
- /// representation in LangAS, otherwise returns default address space.
+ /// If this is a SYCL address space attribute, returns its SYCL
+ /// representation in LangAS.
LangAS asSYCLLangAS() const {
- switch (getKind()) {
- case ParsedAttr::AT_OpenCLGlobalAddressSpace:
+ switch (getParsedKind()) {
+ case ParsedAttr::AT_SYCLGlobalAddressSpace:
return LangAS::sycl_global;
+ // TODO: OpenCLGlobalDeviceAddressSpace, OpenCLGlobalHostAddressSpace,
+ // sycl_global_device, and sycl_global_host will be removed after
+ // deprecation.
+ // https://discourse.llvm.org/t/rfc-remove-opencl-global-device-and-opencl-global-host-address-space-attributes/90677
case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
return LangAS::sycl_global_device;
case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
return LangAS::sycl_global_host;
----------------
tahonermann wrote:
We intend to remove this code in the near future, but just in case that doesn't happen for some reason, let's make the handling of all the OpenCL attributes consistent and map these OpenCL global_host/global_device attributes to their corresponding OpenCL enumerators. Just move the case statements into the block of other OpenCL case statements below; `asOpenCLLangAS()` will do the right thing for these. We can also dispense with the deprecation comment here since it is present where these attributes are defined; we can't fail to remove these uses once those definitions are removed.
https://github.com/llvm/llvm-project/pull/200849
More information about the cfe-commits
mailing list