[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:53:22 PST 2025
================
@@ -27,6 +27,8 @@
extern "C" {
#endif
+#if !defined(__CUDA_ARCH__)
+
----------------
Artem-B wrote:
I'm actually wondering if the header needs `__has_builtin()`... They are coming from the same compiler, and, if they are missing, they are declared in terms of `__builtin*()` functions.
Looking at their definitions, it appears that those builtins are defined when we're targeting windows:
https://github.com/llvm/llvm-project/blob/79261d4aab4f7a0f56f5ea32a5ac06241c5cd94a/clang/include/clang/Basic/BuiltinsARM.def#L212-L220
If we have to define them on non-windows targets anyways, perhaps a better fix is to let clang define them everywhere, and avoid this special case in the headers.
@compnerd -- do you recall what's the story with these non-builtin builtins here?
They were added specifically for MS targets in https://github.com/llvm/llvm-project/commit/4bddd9d400aa75de8961a4e6c5e3f387302534e8
But five years later, @Bigcheese added these wrappers in the header:
https://github.com/llvm/llvm-project/commit/16af23fae8ad2949048e0fc34cf9114dfbe4742a
https://github.com/llvm/llvm-project/pull/128222
More information about the cfe-commits
mailing list