================ @@ -1818,8 +1819,21 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { // usual allocation and deallocation functions. Required by libc++ return 201802; default: + // We may get here because of aux builtins which may not be + // supported on the default target, for example if we have an X86 + // specific builtin and the current target is SPIR-V. Sometimes we + // rely on __has_builtin returning true when passed a builtin that + // is not supported on the default target due to LangOpts but is + // supported on the aux target. See + // test/Headers/__cpuidex_conflict.c for an example. If the builtin + // is an aux builtin and it can never be supported on the default + // target, __has_builtin should return false. + if (getBuiltinInfo().isAuxBuiltinID(BuiltinID) && + getBuiltinInfo().isAuxBuiltinIDAlwaysUnsupportedOnDefaultTarget( ---------------- sarnex wrote:
The change in question uses the `ifdef` to try to prevent double definitions [here](https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/cpuid.h#L345), so if we change the return value then it would break that code (which was caught by the LIT fail), and reading the above PR it seems it was hard to find a check that worked, so I'm not sure what's best. https://github.com/llvm/llvm-project/pull/121839 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits