[clang] [Clang] __has_builtin should return false for aux triple builtins (PR #121839)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 8 08:47:58 PST 2025
jhuber6 wrote:
> This is/was my concern. However, upon thinking further, as long as we RECOGNIZE/Parse/etc the builtins, it is OK I think if we report "!__has_builtin".
>
> That is:
>
> ```
> void foo() {
> #if __has_builtin(__builtin_x86_thing)
> __builtin_x86_thing();
> #else
> __builtin_x86_thing(); // woops, not has_builtin!
> #endif
> }
> ```
>
> NEEDS to still work, even if the `__has_builtin` answer is 'no'.
Yes, I think that makes sense as it would allow both sides to parse the same code without forcing the compiler to always emit an incompatible builtin call. Since we already allow users to split compilations with preprocessor values I think that's reasonable.
https://github.com/llvm/llvm-project/pull/121839
More information about the cfe-commits
mailing list