[clang] [Clang][Sema] Reject unsupported opencl address space attributes in SYCL and HLSL (PR #152528)

Alexey Bader via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 7 08:56:30 PDT 2025


================
@@ -6573,8 +6574,15 @@ static void HandleAddressSpaceTypeAttribute(QualType &Type,
     if (S.getLangOpts().HLSL)
       ASIdx = Attr.asHLSLLangAS();
 
-    if (ASIdx == LangAS::Default)
-      llvm_unreachable("Invalid address space");
+    if (ASIdx == LangAS::Default) {
+      assert(S.getLangOpts().SYCLIsDevice || S.getLangOpts().HLSL);
----------------
bader wrote:

https://llvm.org/docs/ProgrammersManual.html#programmatic-errors

```suggestion
      assert((S.getLangOpts().SYCLIsDevice || S.getLangOpts().HLSL) && "Unexpected language mode");
```

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


More information about the cfe-commits mailing list