[clang] [Clang][ARM] Only try to redefine builtins for non-CUDA (PR #128222)
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 21 14:11:24 PST 2025
================
@@ -27,6 +27,8 @@
extern "C" {
#endif
+#if !defined(__CUDA_ARCH__)
+
----------------
Artem-B wrote:
Unfortunately, this will be observable to any code that happens to need those builtins, and they are actually not provided by the compiler (i.e. `__has_builtin(__wfi)` would be host on the *host*).
In that case, any use of `__wfi()` in the host code will break compilation because host-side code will not be able to find it.
I think a more robust fix would be to provide only declarations for these maybe-builtin functions, so the compiler always sees the correct signature of the functions that are conditionally provided depending on `__has_builtin()`.
https://github.com/llvm/llvm-project/pull/128222
More information about the cfe-commits
mailing list