================ @@ -1819,8 +1822,12 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { // usual allocation and deallocation functions. Required by libc++ return 201802; default: + // __has_target_builtin should return false for aux builtins. + if (IsHasTargetBuiltin && + getBuiltinInfo().isAuxBuiltinID(BuiltinID)) ---------------- sarnex wrote:
Good question. The function name is `isAuxBuiltinID` but the implementation of it makes it so that the behavior is like `isOnlyAuxBuiltinID`. The implementation of the function is: ``` /// Return true if builtin ID belongs to AuxTarget. bool isAuxBuiltinID(unsigned ID) const { return ID >= (Builtin::FirstTSBuiltin + NumTargetBuiltins); } ``` When we register builtins, we do it like this: ``` TargetShards = Target.getTargetBuiltins(); for (const auto &Shard : TargetShards) NumTargetBuiltins += Shard.Infos.size(); if (AuxTarget) { AuxTargetShards = AuxTarget->getTargetBuiltins(); for (const auto &Shard : AuxTargetShards) NumAuxTargetBuiltins += Shard.Infos.size(); } } ``` So we register all the target builtins before the aux target builtins, and we only consider something an aux builtin if it was registered specifically as an aux builtin, so I think the logic does what we want. https://github.com/llvm/llvm-project/pull/126324 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits