[clang] [clang][SYCL] Add SYCL spelling for AS attributes (PR #200849)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 23 08:13:52 PDT 2026
https://github.com/tahonermann requested changes to this pull request.
Thanks @elizabethandrews. I posted suggested documentation.
I think an additional `clang/SemaSYCL/sycl-address-space-attr-appertainment.cpp` test along the lines of `sycl-external-attr-appertainment.cpp` and `sycl-kernel-entry-point-attr-appertainment.cpp` is warranted to validate that appropriate diagnostics are issued for incorrect use of these attributes. That test should exercise examples like the following (there are probably other cases that should be exercised; this list likely isn't exhaustive).
```
[[clang::sycl_global]]; // Invalid.
namespace [[clang::sycl_global]] bad1 {} // Invalid.
struct [[clang::sycl_global]] bad2 {}; // Invalid.
enum [[clang::sycl_global]] bad3 {}; // Invalid.
enum {
bad4 [[clang::sycl_global]] // Invalid.
};
template<typename>
concept bad5 [[clang::sycl_global]] = true; // Invalid.
[[clang::sycl_global]] int bad6(); // Invalid.
int bad7(void (fp [[clang::sycl_global]])()); // Invalid.
int bad8() [[clang::sycl_global]]; // Invalid.
struct bad9 {
[[clang::sycl_global]] int mf(); // Invalid.
[[clang::sycl_global]] int dm; // Invalid.
};
struct S1;
int [[clang::sycl_global]] S1::*mpi; // Ok.
using global_int = int [[clang::sycl_global]]; // Ok.
using global_int_ptr = global_int*; // Ok.
global_int bad10; // Invalid.
global_int_ptr gip; // Ok.
```
https://github.com/llvm/llvm-project/pull/200849
More information about the cfe-commits
mailing list