llvm
15c3371e - [clang][SYCL] Fix compilation of MSVC headers (#22154)

Commit
42 days ago
[clang][SYCL] Fix compilation of MSVC headers (#22154) MSVC headers rely heavily on __cdecl calling convention attribute. SYCL device mosly uses SPIR-based targets which use spir_function default calling convention not compatible with __cdecl. I've made an attempt to avoid errors coming from MSVC headers using CUDA-style approach in 94ca49099ef77751a33e4babe41b2ae03ff228e1 which however failed for several reasons. Most this happens because SYCL is implicit about what is compiled for device and it allows to include standard C++ headers during device compilations, so the approach that was taken in 94ca49099ef77751a33e4babe41b2ae03ff228e1 didn't work for the two more cases in MSVC headers: 1. allocation/deallocation functions are marked with __cdecl and that was conflicting with implicit declarations of these with default calling convention. 2. due to 94ca49099ef77751a33e4babe41b2ae03ff228e1 applied, __cdecl calling covention attribute was preserved on functions even though it is not supported for the target and it declares different calling convention than the default that caused function types for functions with and without __cdecl attribute to be different and cause fail to compile MSVC headers. This is to unblock the pulldown but I'm going to propose this to the community as well since SYCL language design doesn't give us another way to solve this.
Author
Committer
Parents
Loading