[clang] [Clang] __has_builtin should return false for aux triple builtins (PR #121839)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 7 09:03:24 PST 2025


AlexVlx wrote:

> > I don't think it makes any sense for `__has_builtin` to return true when the target does not in-fact have the builtin. Most of the time this is used to guard target specific code, which will then be wrong if it's compiled on the device. Realistically the solution that makes sense to me is to not emit any of the aux target's builtins as available.
> 
> From the user's perspective, the target DOES support the builtin though, since from their perspective, their target is 'SYCL host + device'. So this is actually not as clear as "it should never", because target/aux-target are machinations of the implementation, and don't properly respect the user's definition of 'target'.

Right, this is essentially a consequence of trying to provide the single-source appearance / illusion.

https://github.com/llvm/llvm-project/pull/121839


More information about the cfe-commits mailing list