[clang] [Clang] __has_builtin should return false for aux triple builtins (PR #121839)
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 27 12:51:42 PST 2025
Artem-B wrote:
I think the conceptual problem here is that `__has_builtin()` conflates "builtin exists" with "builtin is usable on the target". For C++ they are the same. For CUDA they are not. Builting in aux-triple do exist (as in compiler does see them when it constructs AST), but we can't generate code for them.
Considering that `__has_builtin` is a preprocessor entity and applies to all source code, it can never mean `is it usable` and can only indicate that the builtin is visible to the compiler. It can never tall whether the builtin is usable because for CUDA it would require the caller context, which preprocessor does not have.
I think this patch should be reverted.
https://github.com/llvm/llvm-project/pull/121839
More information about the cfe-commits
mailing list