[clang] [Clang] Add __has_target_builtin macro (PR #126324)

Nick Sarnie via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 11 07:05:18 PST 2025


================
@@ -1797,16 +1803,18 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
                                            diag::err_feature_check_malformed);
         return II && HasExtension(*this, II->getName());
       });
-  } else if (II == Ident__has_builtin) {
+  } else if (II == Ident__has_builtin || II == Ident__has_target_builtin) {
+    bool IsHasTargetBuiltin = II == Ident__has_target_builtin;
     EvaluateFeatureLikeBuiltinMacro(
         OS, Tok, II, *this, false,
-        [this](Token &Tok, bool &HasLexedNextToken) -> int {
+        [this, IsHasTargetBuiltin](Token &Tok, bool &HasLexedNextToken) -> int {
           IdentifierInfo *II = ExpectFeatureIdentifierInfo(
               Tok, *this, diag::err_feature_check_malformed);
           if (!II)
             return false;
-          else if (II->getBuiltinID() != 0) {
-            switch (II->getBuiltinID()) {
+          auto BuiltinID = II->getBuiltinID();
----------------
sarnex wrote:

done in latest commit, thx

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


More information about the cfe-commits mailing list