[clang] [clang][SYCL] Implement address space attributes for SYCL (PR #200849)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 10:03:26 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;
----------------
elizabethandrews wrote:

I would rather not do this. We would break existing code with no way of fixing wherever the attributes are used now. IMO we should wait for the deprecation behavior to be over before forcing users to remove the attributes from their code base because we changed behavior. 

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


More information about the cfe-commits mailing list