https://github.com/carlocab updated 
https://github.com/llvm/llvm-project/pull/119670

>From 10059eebc9a9b0cbef3dc14a6ddd482c9266f7b8 Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <[email protected]>
Date: Tue, 10 Dec 2024 01:45:22 +0800
Subject: [PATCH 1/8] [clang][Driver][Darwin] Optionally use xcselect to find
 macOS SDK

This is a scaled down version of https://reviews.llvm.org/D136315.

The intent is largely the same as before[^1], but I've scaled down the scope
to try to avoid the issues that the previous patch caused:
- the changes are now opt-in based on enabling `CLANG_USE_XCSELECT`
- this only works when targeting macOS on a macOS host (this is the only
  case supported by `libxcselect`[^2])

We also introduce an environment variable `CLANG_NO_XCSELECT` that
disables this behaviour if Clang is configured with
`CLANG_USE_XCSELECT=ON`. This is needed to avoid breaking tests.

Another reason to leave this as opt-in for now is that there are some
bugs in libxcselect that need fixing before it is safe to use by default
for all users. This has been reported to Apple as FB16081077.

[^1]: See also https://reviews.llvm.org/D109460 and #45225.
[^2]: https://developer.apple.com/documentation/xcselect?language=objc
---
 clang/CMakeLists.txt                      | 33 +++++++++++++++++++++++
 clang/include/clang/Config/config.h.cmake |  6 +++++
 clang/lib/Driver/CMakeLists.txt           |  4 +++
 clang/lib/Driver/ToolChains/Darwin.cpp    | 31 ++++++++++++++-------
 clang/test/lit.cfg.py                     |  4 +++
 5 files changed, 69 insertions(+), 9 deletions(-)

diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index f0d10603374b9..ef360907bd08d 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -229,6 +229,39 @@ if(GCC_INSTALL_PREFIX AND NOT 
USE_DEPRECATED_GCC_INSTALL_PREFIX)
     "See https://github.com/llvm/llvm-project/pull/77537 for detail.")
 endif()
 
+if(APPLE)
+  check_include_file(xcselect.h CLANG_HAVE_XCSELECT_H)
+  if(CLANG_HAVE_XCSELECT_H)
+    include(CheckSymbolExists)
+    list(APPEND CMAKE_REQUIRED_LIBRARIES xcselect)
+    check_symbol_exists(xcselect_host_sdk_path xcselect.h 
CLANG_HAVE_XCSELECT_HOST_SDK_PATH)
+    list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES xcselect)
+  endif()
+endif()
+
+cmake_dependent_option(CLANG_USE_XCSELECT "Use libxcselect to find the macOS 
SDK." OFF
+  "APPLE;CLANG_HAVE_XCSELECT_HOST_SDK_PATH" OFF)
+
+if(DEFAULT_SYSROOT AND CLANG_USE_XCSELECT)
+  message(FATAL_ERROR "Setting DEFAULT_SYSROOT is incompatible with 
CLANG_USE_XCSELECT.")
+endif()
+
+if(CLANG_USE_XCSELECT)
+  set(XCSELECT_VALID_POLICIES LATEST MATCHING_ONLY MATCHING_PREFERRED)
+  set(CLANG_XCSELECT_HOST_SDK_POLICY "LATEST" CACHE STRING
+    "Policy to use for xcselect. One of: ${XCSELECT_VALID_POLICIES}")
+  set_property(CACHE CLANG_XCSELECT_HOST_SDK_POLICY PROPERTY STRINGS 
${XCSELECT_VALID_POLICIES})
+  string(TOUPPER ${CLANG_XCSELECT_HOST_SDK_POLICY} 
CLANG_XCSELECT_HOST_SDK_POLICY)
+  list(JOIN XCSELECT_VALID_POLICIES "|" XCSELECT_POLICY_REGEX)
+  if(NOT CLANG_XCSELECT_HOST_SDK_POLICY MATCHES 
"^XCSELECT_HOST_SDK_POLICY_(${XCSELECT_POLICY_REGEX})$")
+    if(NOT CLANG_XCSELECT_HOST_SDK_POLICY IN_LIST XCSELECT_VALID_POLICIES)
+      message(FATAL_ERROR
+        "CLANG_XCSELECT_HOST_SDK_POLICY (${CLANG_XCSELECT_HOST_SDK_POLICY}) 
must be one of: ${XCSELECT_VALID_POLICIES}")
+    endif()
+    set(CLANG_XCSELECT_HOST_SDK_POLICY 
"XCSELECT_HOST_SDK_POLICY_${CLANG_XCSELECT_HOST_SDK_POLICY}")
+  endif()
+endif()
+
 set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
 
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL
diff --git a/clang/include/clang/Config/config.h.cmake 
b/clang/include/clang/Config/config.h.cmake
index 00c352b458c34..05e4deb671a7e 100644
--- a/clang/include/clang/Config/config.h.cmake
+++ b/clang/include/clang/Config/config.h.cmake
@@ -85,4 +85,10 @@
 /* Whether CIR is built into Clang */
 #cmakedefine01 CLANG_ENABLE_CIR
 
+/* Whether to use xcselect to find the macOS SDK */
+#cmakedefine CLANG_USE_XCSELECT
+
+/* Policy to use for xcselect */
+#cmakedefine CLANG_XCSELECT_HOST_SDK_POLICY ${CLANG_XCSELECT_HOST_SDK_POLICY}
+
 #endif
diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index f5440a01a5932..ef5c7eacfc3e1 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -14,6 +14,10 @@ if(WIN32)
   set(system_libs version)
 endif()
 
+if(CLANG_USE_XCSELECT)
+  set(system_libs xcselect)
+endif()
+
 add_clang_library(clangDriver
   Action.cpp
   Compilation.cpp
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 86810e1f28f36..e65fbcf1a397d 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -27,6 +27,10 @@
 #include "llvm/TargetParser/Triple.h"
 #include <cstdlib> // ::getenv
 
+#ifdef CLANG_USE_XCSELECT
+#include <xcselect.h> // ::xcselect_host_sdk_path
+#endif
+
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang::driver::toolchains;
@@ -2488,17 +2492,26 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) 
const {
     // Warn if the path does not exist.
     if (!getVFS().exists(A->getValue()))
       getDriver().Diag(clang::diag::warn_missing_sysroot) << A->getValue();
-  } else {
-    if (char *env = ::getenv("SDKROOT")) {
-      // We only use this value as the default if it is an absolute path,
-      // exists, and it is not the root path.
-      if (llvm::sys::path::is_absolute(env) && getVFS().exists(env) &&
-          StringRef(env) != "/") {
-        Args.append(Args.MakeSeparateArg(
-            nullptr, Opts.getOption(options::OPT_isysroot), env));
-      }
+  } else if (const char *env = ::getenv("SDKROOT"); env && *env) {
+    // We only use this value as the default if it is an absolute path,
+    // exists, and it is not the root path.
+    if (llvm::sys::path::is_absolute(env) && getVFS().exists(env) &&
+        StringRef(env) != "/") {
+      Args.append(Args.MakeSeparateArg(
+          nullptr, Opts.getOption(options::OPT_isysroot), env));
     }
   }
+#ifdef CLANG_USE_XCSELECT
+  else if (const char *env = ::getenv("CLANG_NO_XCSELECT");
+           getTriple().isMacOSX() && (!env || !*env)) {
+    if (char *p;
+        !::xcselect_host_sdk_path(CLANG_XCSELECT_HOST_SDK_POLICY, &p)) {
+      Args.append(Args.MakeSeparateArg(
+          nullptr, Opts.getOption(options::OPT_isysroot), p));
+      ::free(p);
+    }
+  }
+#endif
 
   // Read the SDKSettings.json file for more information, like the SDK version
   // that we can pass down to the compiler.
diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 183b674dcddae..b8ec50408cb63 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -474,6 +474,10 @@ def user_is_root():
 # default configs for the test runs.
 config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"
 
+# Configuring clang with CLANG_USE_XCSELECT=ON breaks some tests, so disable
+# its behaviour while running tests.
+config.environment["CLANG_NO_XCSELECT"] = "1"
+
 if lit_config.update_tests:
     import sys
     import os

>From 99e539fc5e8670402fa7c916579dfab96c7350f4 Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <[email protected]>
Date: Fri, 13 Dec 2024 02:32:17 +0800
Subject: [PATCH 2/8] Gate all `xcselect` checks behind `CLANG_USE_XCSELECT`

---
 clang/CMakeLists.txt | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index ef360907bd08d..b3bc56209fc9e 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -229,30 +229,35 @@ if(GCC_INSTALL_PREFIX AND NOT 
USE_DEPRECATED_GCC_INSTALL_PREFIX)
     "See https://github.com/llvm/llvm-project/pull/77537 for detail.")
 endif()
 
-if(APPLE)
+cmake_dependent_option(CLANG_USE_XCSELECT "Use libxcselect to find the macOS 
SDK." OFF "APPLE" OFF)
+
+if(CLANG_USE_XCSELECT)
+  if(DEFAULT_SYSROOT)
+    message(FATAL_ERROR "Setting DEFAULT_SYSROOT is incompatible with 
CLANG_USE_XCSELECT.")
+  endif()
+
   check_include_file(xcselect.h CLANG_HAVE_XCSELECT_H)
-  if(CLANG_HAVE_XCSELECT_H)
-    include(CheckSymbolExists)
-    list(APPEND CMAKE_REQUIRED_LIBRARIES xcselect)
-    check_symbol_exists(xcselect_host_sdk_path xcselect.h 
CLANG_HAVE_XCSELECT_HOST_SDK_PATH)
-    list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES xcselect)
+  if(NOT CLANG_HAVE_XCSELECT_H)
+    message(FATAL_ERROR "CLANG_USE_XCSELECT is enabled but xcselect.h was not 
found.")
   endif()
-endif()
 
-cmake_dependent_option(CLANG_USE_XCSELECT "Use libxcselect to find the macOS 
SDK." OFF
-  "APPLE;CLANG_HAVE_XCSELECT_HOST_SDK_PATH" OFF)
+  include(CheckSymbolExists)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES xcselect)
+  check_symbol_exists(xcselect_host_sdk_path xcselect.h 
CLANG_HAVE_XCSELECT_HOST_SDK_PATH)
+  list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES xcselect)
 
-if(DEFAULT_SYSROOT AND CLANG_USE_XCSELECT)
-  message(FATAL_ERROR "Setting DEFAULT_SYSROOT is incompatible with 
CLANG_USE_XCSELECT.")
-endif()
+  if(NOT CLANG_HAVE_XCSELECT_HOST_SDK_PATH)
+    message(FATAL_ERROR "CLANG_USE_XCSELECT is enabled but either libxcselect 
is not available "
+      "or it is missing xcselect_host_sdk_path.")
+  endif()
 
-if(CLANG_USE_XCSELECT)
   set(XCSELECT_VALID_POLICIES LATEST MATCHING_ONLY MATCHING_PREFERRED)
   set(CLANG_XCSELECT_HOST_SDK_POLICY "LATEST" CACHE STRING
     "Policy to use for xcselect. One of: ${XCSELECT_VALID_POLICIES}")
   set_property(CACHE CLANG_XCSELECT_HOST_SDK_POLICY PROPERTY STRINGS 
${XCSELECT_VALID_POLICIES})
   string(TOUPPER ${CLANG_XCSELECT_HOST_SDK_POLICY} 
CLANG_XCSELECT_HOST_SDK_POLICY)
   list(JOIN XCSELECT_VALID_POLICIES "|" XCSELECT_POLICY_REGEX)
+
   if(NOT CLANG_XCSELECT_HOST_SDK_POLICY MATCHES 
"^XCSELECT_HOST_SDK_POLICY_(${XCSELECT_POLICY_REGEX})$")
     if(NOT CLANG_XCSELECT_HOST_SDK_POLICY IN_LIST XCSELECT_VALID_POLICIES)
       message(FATAL_ERROR

>From f999ff02b701d4c5077cf10d5eda67c18b531bda Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <[email protected]>
Date: Fri, 13 Dec 2024 02:37:10 +0800
Subject: [PATCH 3/8] Avoid `if` conditions with multiple statements

---
 clang/lib/Driver/ToolChains/Darwin.cpp | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index e65fbcf1a397d..5c76b04a49348 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2492,7 +2492,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) 
const {
     // Warn if the path does not exist.
     if (!getVFS().exists(A->getValue()))
       getDriver().Diag(clang::diag::warn_missing_sysroot) << A->getValue();
-  } else if (const char *env = ::getenv("SDKROOT"); env && *env) {
+  } else if (const char *env = ::getenv("SDKROOT")) {
     // We only use this value as the default if it is an absolute path,
     // exists, and it is not the root path.
     if (llvm::sys::path::is_absolute(env) && getVFS().exists(env) &&
@@ -2502,13 +2502,16 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) 
const {
     }
   }
 #ifdef CLANG_USE_XCSELECT
-  else if (const char *env = ::getenv("CLANG_NO_XCSELECT");
-           getTriple().isMacOSX() && (!env || !*env)) {
-    if (char *p;
-        !::xcselect_host_sdk_path(CLANG_XCSELECT_HOST_SDK_POLICY, &p)) {
-      Args.append(Args.MakeSeparateArg(
-          nullptr, Opts.getOption(options::OPT_isysroot), p));
-      ::free(p);
+  else if (getTriple().isMacOSX()) {
+    const char *env = ::getenv("CLANG_NO_XCSELECT");
+
+    if (!env || !*env) {
+      char *p;
+      if (!::xcselect_host_sdk_path(CLANG_XCSELECT_HOST_SDK_POLICY, &p)) {
+        Args.append(Args.MakeSeparateArg(
+            nullptr, Opts.getOption(options::OPT_isysroot), p));
+        ::free(p);
+      }
     }
   }
 #endif

>From ebce5ba0bb3d21821981aacf6d7ac7c0eb6abb0f Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <[email protected]>
Date: Sat, 14 Dec 2024 00:40:09 +0800
Subject: [PATCH 4/8] Add xcselect test

---
 clang/test/CMakeLists.txt     | 1 +
 clang/test/Driver/xcselect.c  | 5 +++++
 clang/test/lit.cfg.py         | 2 ++
 clang/test/lit.site.cfg.py.in | 1 +
 4 files changed, 9 insertions(+)
 create mode 100644 clang/test/Driver/xcselect.c

diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index f6244c938fc90..db12d4ee38fe4 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -12,6 +12,7 @@ llvm_canonicalize_cmake_booleans(
   CLANG_ENABLE_CIR
   CLANG_ENABLE_OBJC_REWRITER
   CLANG_LINK_CLANG_DYLIB
+  CLANG_USE_XCSELECT
   ENABLE_BACKTRACES
   LLVM_BYE_LINK_INTO_TOOLS
   LLVM_ENABLE_PLUGINS
diff --git a/clang/test/Driver/xcselect.c b/clang/test/Driver/xcselect.c
new file mode 100644
index 0000000000000..bdb89dbb966ba
--- /dev/null
+++ b/clang/test/Driver/xcselect.c
@@ -0,0 +1,5 @@
+// REQUIRES: xcselect
+// RUN: %clang -target arm64-apple-darwin -c -### %s 2> %t.log
+// RUN: FileCheck %s <%t.log
+
+// CHECK: "-isysroot" "{{.*}}/SDKs/MacOSX{{([0-9]+(\.[0-9]+)?)?}}.sdk"
diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index b8ec50408cb63..dac2b76fe73a7 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -429,6 +429,8 @@ def calculate_arch_features(arch_string):
 if config.clang_enable_cir:
     config.available_features.add("cir-enabled")
 
+if config.use_xcselect:
+    config.available_features.add("xcselect")
 
 # Tests that rely on chmod to restrict file permissions (e.g. write-permission
 # checks) are unreliable when run as root, since root bypasses file 
permissions.
diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index 3bdff42262164..cb35118167d99 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -47,6 +47,7 @@ config.ppc_linux_default_ieeelongdouble = 
@PPC_LINUX_DEFAULT_IEEELONGDOUBLE@
 config.have_llvm_driver = @LLVM_TOOL_LLVM_DRIVER_BUILD@
 config.spirv_tools_tests = @LLVM_INCLUDE_SPIRV_TOOLS_TESTS@
 config.substitutions.append(("%llvm-version-major", "@LLVM_VERSION_MAJOR@"))
+config.use_xcselect = @CLANG_USE_XCSELECT@
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)

>From f1b7fd38ace6926670c20c46017426b47e388ba0 Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <[email protected]>
Date: Sat, 14 Dec 2024 00:46:42 +0800
Subject: [PATCH 5/8] Mark failing tests with CLANG_USE_XCSELECT as XFAIL

---
 clang/lib/Driver/ToolChains/Darwin.cpp             | 14 +++++---------
 clang/test/Driver/arc.c                            |  3 +++
 clang/test/Driver/clang-g-opts.c                   |  3 +++
 clang/test/Driver/clang-translation.c              |  3 +++
 clang/test/Driver/darwin-builtin-modules.c         |  3 +++
 clang/test/Driver/darwin-debug-flags.c             |  3 +++
 clang/test/Driver/darwin-header-search-system.cpp  |  2 ++
 .../test/Driver/darwin-ld-platform-version-macos.c |  3 +++
 clang/test/Driver/darwin-ld.c                      |  3 +++
 clang/test/Driver/darwin-multiarch-arm.c           |  3 +++
 clang/test/Driver/darwin-objc-options.m            |  3 +++
 clang/test/Driver/darwin-version.c                 |  3 +++
 clang/test/Driver/debug-options.c                  |  3 +++
 clang/test/Driver/fsanitize.c                      |  3 +++
 .../Driver/macos-apple-silicon-slice-link-libs.cpp |  3 +++
 clang/test/Driver/target-triple-deployment.c       |  3 +++
 clang/test/lit.cfg.py                              |  4 ----
 17 files changed, 49 insertions(+), 13 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 5c76b04a49348..7b866d6df47f9 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2503,15 +2503,11 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) 
const {
   }
 #ifdef CLANG_USE_XCSELECT
   else if (getTriple().isMacOSX()) {
-    const char *env = ::getenv("CLANG_NO_XCSELECT");
-
-    if (!env || !*env) {
-      char *p;
-      if (!::xcselect_host_sdk_path(CLANG_XCSELECT_HOST_SDK_POLICY, &p)) {
-        Args.append(Args.MakeSeparateArg(
-            nullptr, Opts.getOption(options::OPT_isysroot), p));
-        ::free(p);
-      }
+    char *p;
+    if (!::xcselect_host_sdk_path(CLANG_XCSELECT_HOST_SDK_POLICY, &p)) {
+      Args.append(Args.MakeSeparateArg(
+          nullptr, Opts.getOption(options::OPT_isysroot), p));
+      ::free(p);
     }
   }
 #endif
diff --git a/clang/test/Driver/arc.c b/clang/test/Driver/arc.c
index e5d1af5225662..7f6ac81aad17f 100644
--- a/clang/test/Driver/arc.c
+++ b/clang/test/Driver/arc.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // RUN: not %clang -ObjC -target i386-apple-darwin10 -stdlib=libstdc++ -m32 
-fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
 // RUN: not %clang -x objective-c -target i386-apple-darwin10 
-stdlib=libstdc++ -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
 // RUN: not %clang -x objective-c++ -target i386-apple-darwin10 
-stdlib=libstdc++ -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
diff --git a/clang/test/Driver/clang-g-opts.c b/clang/test/Driver/clang-g-opts.c
index fdbe0b96420c5..36cc3820bef16 100644
--- a/clang/test/Driver/clang-g-opts.c
+++ b/clang/test/Driver/clang-g-opts.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // RUN: %clang -### -S %s        2>&1 | FileCheck 
--check-prefix=CHECK-WITHOUT-G %s
 // RUN: %clang -### -S %s -g -target x86_64-linux-gnu 2>&1 \
 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G %s
diff --git a/clang/test/Driver/clang-translation.c 
b/clang/test/Driver/clang-translation.c
index 5ec052a7aaa11..2fbd5a36b913e 100644
--- a/clang/test/Driver/clang-translation.c
+++ b/clang/test/Driver/clang-translation.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // RUN: %clang -target i386-unknown-unknown -### -S -O0 -Os %s -o %t.s 
-fverbose-asm -fvisibility=hidden 2>&1 | FileCheck -check-prefix=I386 %s
 // I386: "-triple" "i386-unknown-unknown"
 // I386: "-Os"
diff --git a/clang/test/Driver/darwin-builtin-modules.c 
b/clang/test/Driver/darwin-builtin-modules.c
index f4c9220b8d577..c69674b626361 100644
--- a/clang/test/Driver/darwin-builtin-modules.c
+++ b/clang/test/Driver/darwin-builtin-modules.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // Check that darwin passes -fbuiltin-headers-in-system-modules
 // when expected.
 
diff --git a/clang/test/Driver/darwin-debug-flags.c 
b/clang/test/Driver/darwin-debug-flags.c
index 90209bb179bfc..242e8fb0fee89 100644
--- a/clang/test/Driver/darwin-debug-flags.c
+++ b/clang/test/Driver/darwin-debug-flags.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // RUN: env RC_DEBUG_OPTIONS=1 %clang -target i386-apple-darwin11 -I "path 
with \spaces" -g -Os %s  -emit-llvm -S -o - | FileCheck %s
 // RUN: touch %t.s
 // RUN: env RC_DEBUG_OPTIONS=1 %clang -### -target i386-apple-darwin11 -c -g 
%t.s 2>&1 | FileCheck -check-prefix=S %s
diff --git a/clang/test/Driver/darwin-header-search-system.cpp 
b/clang/test/Driver/darwin-header-search-system.cpp
index 5fb83b62ce7e6..1549b82f7cc67 100644
--- a/clang/test/Driver/darwin-header-search-system.cpp
+++ b/clang/test/Driver/darwin-header-search-system.cpp
@@ -1,4 +1,6 @@
 // UNSUPPORTED: system-windows
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
 
 // General tests that the system header search paths detected by the driver
 // and passed to CC1 are correct on Darwin platforms.
diff --git a/clang/test/Driver/darwin-ld-platform-version-macos.c 
b/clang/test/Driver/darwin-ld-platform-version-macos.c
index bdd80c8360402..e85ab7946c1df 100644
--- a/clang/test/Driver/darwin-ld-platform-version-macos.c
+++ b/clang/test/Driver/darwin-ld-platform-version-macos.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // RUN: touch %t.o
 
 // RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld \
diff --git a/clang/test/Driver/darwin-ld.c b/clang/test/Driver/darwin-ld.c
index cf89bdd4dac00..8fd0c2c3dc36a 100644
--- a/clang/test/Driver/darwin-ld.c
+++ b/clang/test/Driver/darwin-ld.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // Check that ld gets arch_multiple.
 
 // RUN: %clang -target i386-apple-darwin9 -arch i386 -arch x86_64 %s -### -o 
foo 2> %t.log
diff --git a/clang/test/Driver/darwin-multiarch-arm.c 
b/clang/test/Driver/darwin-multiarch-arm.c
index 0ea5c4bf9a69a..1dd44013600bd 100644
--- a/clang/test/Driver/darwin-multiarch-arm.c
+++ b/clang/test/Driver/darwin-multiarch-arm.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // Check that we compile correctly with multiple ARM -arch options.
 //
 // RUN: %clang -target arm7-apple-darwin10 -### \
diff --git a/clang/test/Driver/darwin-objc-options.m 
b/clang/test/Driver/darwin-objc-options.m
index 8721fbc1ef1e2..9c75187c7ca3b 100644
--- a/clang/test/Driver/darwin-objc-options.m
+++ b/clang/test/Driver/darwin-objc-options.m
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // Check miscellaneous Objective-C options.
 
 // RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
diff --git a/clang/test/Driver/darwin-version.c 
b/clang/test/Driver/darwin-version.c
index 9b9c6034bb75d..aa2fd36fcb037 100644
--- a/clang/test/Driver/darwin-version.c
+++ b/clang/test/Driver/darwin-version.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-IOS %s
 // CHECK-VERSION-IOS: "armv6k-apple-ios5.0.0"
diff --git a/clang/test/Driver/debug-options.c 
b/clang/test/Driver/debug-options.c
index 92179ff9421ad..fe5270957c81b 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // Check to make sure clang is somewhat picky about -g options.
 
 // Linux.
diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
index f6a82d899d5bf..1a00b8146e6a2 100644
--- a/clang/test/Driver/fsanitize.c
+++ b/clang/test/Driver/fsanitize.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // This file contains feature-unspecific common -fsanitize= driver tests.
 // Where possible avoid adding new tests to this file, and instead group tests
 // in feature-specific fsanitize-*.c test files.
diff --git a/clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp 
b/clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp
index 4a2a029c736fc..15739d1209938 100644
--- a/clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp
+++ b/clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // RUN: %clang -### -target arm64-apple-macos10.7 %s 2>&1 | FileCheck 
-check-prefix=ARM64-10_7 %s
 // RUN: %clang -### -target x86_64-apple-macos10.7 %s 2>&1 | FileCheck 
-check-prefix=x86_64-10_7 %s
 // RUN: %clang -### -target arm64-apple-darwin6 %s 2>&1 | FileCheck 
-check-prefix=ARM64-10_7 %s
diff --git a/clang/test/Driver/target-triple-deployment.c 
b/clang/test/Driver/target-triple-deployment.c
index 2e29992502ed4..8eff2c6171817 100644
--- a/clang/test/Driver/target-triple-deployment.c
+++ b/clang/test/Driver/target-triple-deployment.c
@@ -1,3 +1,6 @@
+// XFAIL: xcselect
+// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+
 // RUN: touch %t.o
 // RUN: %clang -fuse-ld= -target x86_64-apple-macosx10.4 -mlinker-version=400 
-### %t.o 2> %t.log
 // RUN: %clang -fuse-ld= -target x86_64-apple-darwin9 -mlinker-version=400 
-### %t.o 2>> %t.log
diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index dac2b76fe73a7..3b0b3092d424e 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -476,10 +476,6 @@ def user_is_root():
 # default configs for the test runs.
 config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"
 
-# Configuring clang with CLANG_USE_XCSELECT=ON breaks some tests, so disable
-# its behaviour while running tests.
-config.environment["CLANG_NO_XCSELECT"] = "1"
-
 if lit_config.update_tests:
     import sys
     import os

>From 908688e547c4a9cb01ca1ac800ad58220af3ebe9 Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <[email protected]>
Date: Thu, 12 Mar 2026 06:14:41 +0800
Subject: [PATCH 6/8] Use xcselect only for `-macosx` triples

Using them for `-darwin*` triples makes many tests fail.
---
 clang/lib/Driver/ToolChains/Darwin.cpp                    | 4 +++-
 clang/test/Driver/arc.c                                   | 3 ---
 clang/test/Driver/clang-g-opts.c                          | 3 ---
 clang/test/Driver/clang-translation.c                     | 3 ---
 clang/test/Driver/darwin-builtin-modules.c                | 3 ---
 clang/test/Driver/darwin-debug-flags.c                    | 3 ---
 clang/test/Driver/darwin-header-search-system.cpp         | 2 --
 clang/test/Driver/darwin-ld-platform-version-macos.c      | 1 +
 clang/test/Driver/darwin-ld.c                             | 3 ---
 clang/test/Driver/darwin-multiarch-arm.c                  | 3 ---
 clang/test/Driver/darwin-objc-options.m                   | 3 ---
 clang/test/Driver/darwin-version.c                        | 3 ---
 clang/test/Driver/debug-options.c                         | 3 ---
 clang/test/Driver/fsanitize.c                             | 3 ---
 clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp | 3 ---
 clang/test/Driver/target-triple-deployment.c              | 3 ---
 clang/test/Driver/xcselect.c                              | 2 +-
 17 files changed, 5 insertions(+), 43 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 7b866d6df47f9..7251f4a92d92d 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2502,7 +2502,9 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) 
const {
     }
   }
 #ifdef CLANG_USE_XCSELECT
-  else if (getTriple().isMacOSX()) {
+  // FIXME: This should check for `getTriple().isMacOSX()`, but this breaks
+  // many tests. See https://github.com/llvm/llvm-project/pull/119670.
+  else if (getTriple().getOS() == llvm::Triple::MacOSX) {
     char *p;
     if (!::xcselect_host_sdk_path(CLANG_XCSELECT_HOST_SDK_POLICY, &p)) {
       Args.append(Args.MakeSeparateArg(
diff --git a/clang/test/Driver/arc.c b/clang/test/Driver/arc.c
index 7f6ac81aad17f..e5d1af5225662 100644
--- a/clang/test/Driver/arc.c
+++ b/clang/test/Driver/arc.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // RUN: not %clang -ObjC -target i386-apple-darwin10 -stdlib=libstdc++ -m32 
-fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
 // RUN: not %clang -x objective-c -target i386-apple-darwin10 
-stdlib=libstdc++ -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
 // RUN: not %clang -x objective-c++ -target i386-apple-darwin10 
-stdlib=libstdc++ -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
diff --git a/clang/test/Driver/clang-g-opts.c b/clang/test/Driver/clang-g-opts.c
index 36cc3820bef16..fdbe0b96420c5 100644
--- a/clang/test/Driver/clang-g-opts.c
+++ b/clang/test/Driver/clang-g-opts.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // RUN: %clang -### -S %s        2>&1 | FileCheck 
--check-prefix=CHECK-WITHOUT-G %s
 // RUN: %clang -### -S %s -g -target x86_64-linux-gnu 2>&1 \
 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G %s
diff --git a/clang/test/Driver/clang-translation.c 
b/clang/test/Driver/clang-translation.c
index 2fbd5a36b913e..5ec052a7aaa11 100644
--- a/clang/test/Driver/clang-translation.c
+++ b/clang/test/Driver/clang-translation.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // RUN: %clang -target i386-unknown-unknown -### -S -O0 -Os %s -o %t.s 
-fverbose-asm -fvisibility=hidden 2>&1 | FileCheck -check-prefix=I386 %s
 // I386: "-triple" "i386-unknown-unknown"
 // I386: "-Os"
diff --git a/clang/test/Driver/darwin-builtin-modules.c 
b/clang/test/Driver/darwin-builtin-modules.c
index c69674b626361..f4c9220b8d577 100644
--- a/clang/test/Driver/darwin-builtin-modules.c
+++ b/clang/test/Driver/darwin-builtin-modules.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // Check that darwin passes -fbuiltin-headers-in-system-modules
 // when expected.
 
diff --git a/clang/test/Driver/darwin-debug-flags.c 
b/clang/test/Driver/darwin-debug-flags.c
index 242e8fb0fee89..90209bb179bfc 100644
--- a/clang/test/Driver/darwin-debug-flags.c
+++ b/clang/test/Driver/darwin-debug-flags.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // RUN: env RC_DEBUG_OPTIONS=1 %clang -target i386-apple-darwin11 -I "path 
with \spaces" -g -Os %s  -emit-llvm -S -o - | FileCheck %s
 // RUN: touch %t.s
 // RUN: env RC_DEBUG_OPTIONS=1 %clang -### -target i386-apple-darwin11 -c -g 
%t.s 2>&1 | FileCheck -check-prefix=S %s
diff --git a/clang/test/Driver/darwin-header-search-system.cpp 
b/clang/test/Driver/darwin-header-search-system.cpp
index 1549b82f7cc67..5fb83b62ce7e6 100644
--- a/clang/test/Driver/darwin-header-search-system.cpp
+++ b/clang/test/Driver/darwin-header-search-system.cpp
@@ -1,6 +1,4 @@
 // UNSUPPORTED: system-windows
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
 
 // General tests that the system header search paths detected by the driver
 // and passed to CC1 are correct on Darwin platforms.
diff --git a/clang/test/Driver/darwin-ld-platform-version-macos.c 
b/clang/test/Driver/darwin-ld-platform-version-macos.c
index e85ab7946c1df..448c6857edf20 100644
--- a/clang/test/Driver/darwin-ld-platform-version-macos.c
+++ b/clang/test/Driver/darwin-ld-platform-version-macos.c
@@ -1,5 +1,6 @@
 // XFAIL: xcselect
 // FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
+// See https://github.com/llvm/llvm-project/pull/119670.
 
 // RUN: touch %t.o
 
diff --git a/clang/test/Driver/darwin-ld.c b/clang/test/Driver/darwin-ld.c
index 8fd0c2c3dc36a..cf89bdd4dac00 100644
--- a/clang/test/Driver/darwin-ld.c
+++ b/clang/test/Driver/darwin-ld.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // Check that ld gets arch_multiple.
 
 // RUN: %clang -target i386-apple-darwin9 -arch i386 -arch x86_64 %s -### -o 
foo 2> %t.log
diff --git a/clang/test/Driver/darwin-multiarch-arm.c 
b/clang/test/Driver/darwin-multiarch-arm.c
index 1dd44013600bd..0ea5c4bf9a69a 100644
--- a/clang/test/Driver/darwin-multiarch-arm.c
+++ b/clang/test/Driver/darwin-multiarch-arm.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // Check that we compile correctly with multiple ARM -arch options.
 //
 // RUN: %clang -target arm7-apple-darwin10 -### \
diff --git a/clang/test/Driver/darwin-objc-options.m 
b/clang/test/Driver/darwin-objc-options.m
index 9c75187c7ca3b..8721fbc1ef1e2 100644
--- a/clang/test/Driver/darwin-objc-options.m
+++ b/clang/test/Driver/darwin-objc-options.m
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // Check miscellaneous Objective-C options.
 
 // RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
diff --git a/clang/test/Driver/darwin-version.c 
b/clang/test/Driver/darwin-version.c
index aa2fd36fcb037..9b9c6034bb75d 100644
--- a/clang/test/Driver/darwin-version.c
+++ b/clang/test/Driver/darwin-version.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-IOS %s
 // CHECK-VERSION-IOS: "armv6k-apple-ios5.0.0"
diff --git a/clang/test/Driver/debug-options.c 
b/clang/test/Driver/debug-options.c
index fe5270957c81b..92179ff9421ad 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // Check to make sure clang is somewhat picky about -g options.
 
 // Linux.
diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
index 1a00b8146e6a2..f6a82d899d5bf 100644
--- a/clang/test/Driver/fsanitize.c
+++ b/clang/test/Driver/fsanitize.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // This file contains feature-unspecific common -fsanitize= driver tests.
 // Where possible avoid adding new tests to this file, and instead group tests
 // in feature-specific fsanitize-*.c test files.
diff --git a/clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp 
b/clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp
index 15739d1209938..4a2a029c736fc 100644
--- a/clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp
+++ b/clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // RUN: %clang -### -target arm64-apple-macos10.7 %s 2>&1 | FileCheck 
-check-prefix=ARM64-10_7 %s
 // RUN: %clang -### -target x86_64-apple-macos10.7 %s 2>&1 | FileCheck 
-check-prefix=x86_64-10_7 %s
 // RUN: %clang -### -target arm64-apple-darwin6 %s 2>&1 | FileCheck 
-check-prefix=ARM64-10_7 %s
diff --git a/clang/test/Driver/target-triple-deployment.c 
b/clang/test/Driver/target-triple-deployment.c
index 8eff2c6171817..2e29992502ed4 100644
--- a/clang/test/Driver/target-triple-deployment.c
+++ b/clang/test/Driver/target-triple-deployment.c
@@ -1,6 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-
 // RUN: touch %t.o
 // RUN: %clang -fuse-ld= -target x86_64-apple-macosx10.4 -mlinker-version=400 
-### %t.o 2> %t.log
 // RUN: %clang -fuse-ld= -target x86_64-apple-darwin9 -mlinker-version=400 
-### %t.o 2>> %t.log
diff --git a/clang/test/Driver/xcselect.c b/clang/test/Driver/xcselect.c
index bdb89dbb966ba..01cd4aca5ec23 100644
--- a/clang/test/Driver/xcselect.c
+++ b/clang/test/Driver/xcselect.c
@@ -1,5 +1,5 @@
 // REQUIRES: xcselect
-// RUN: %clang -target arm64-apple-darwin -c -### %s 2> %t.log
+// RUN: %clang -target arm64-apple-macosx -c -### %s 2> %t.log
 // RUN: FileCheck %s <%t.log
 
 // CHECK: "-isysroot" "{{.*}}/SDKs/MacOSX{{([0-9]+(\.[0-9]+)?)?}}.sdk"

>From 5cbfb7e9d8fa59b2eba675a27b5f8f916d77fd3a Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <[email protected]>
Date: Thu, 12 Mar 2026 06:22:35 +0800
Subject: [PATCH 7/8] Fix test failures with `CLANG_USE_XCSELECT`

---
 .../darwin-ld-platform-version-macos-nosdk.c    | 17 +++++++++++++++++
 .../Driver/darwin-ld-platform-version-macos.c   | 13 +++----------
 2 files changed, 20 insertions(+), 10 deletions(-)
 create mode 100644 clang/test/Driver/darwin-ld-platform-version-macos-nosdk.c

diff --git a/clang/test/Driver/darwin-ld-platform-version-macos-nosdk.c 
b/clang/test/Driver/darwin-ld-platform-version-macos-nosdk.c
new file mode 100644
index 0000000000000..76f601a2f2679
--- /dev/null
+++ b/clang/test/Driver/darwin-ld-platform-version-macos-nosdk.c
@@ -0,0 +1,17 @@
+// UNSUPPORTED: xcselect
+// CLANG_USE_XCSELECT will always have an SDK inferred.
+
+// RUN: touch %t.o
+
+// RUN: %clang -target x86_64-apple-macos10.13 -mlinker-version=520 \
+// RUN:   -### %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=NOSDK %s
+// RUN: %clang -target x86_64-apple-darwin17 -mlinker-version=520 \
+// RUN:   -### %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=NOSDK %s
+// NOSDK: "-platform_version" "macos" "10.13.0" "10.13.0"
+
+// RUN: %clang -target arm64-apple-macos26 -mlinker-version=520 \
+// RUN:   -### %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=VERSION_BUMP %s
+// VERSION_BUMP: "-platform_version" "macos" "26.0.0" "26.0.0"
diff --git a/clang/test/Driver/darwin-ld-platform-version-macos.c 
b/clang/test/Driver/darwin-ld-platform-version-macos.c
index 448c6857edf20..2ba36d527478a 100644
--- a/clang/test/Driver/darwin-ld-platform-version-macos.c
+++ b/clang/test/Driver/darwin-ld-platform-version-macos.c
@@ -1,7 +1,3 @@
-// XFAIL: xcselect
-// FIXME: There's no reason why this should fail with CLANG_USE_XCSELECT.
-// See https://github.com/llvm/llvm-project/pull/119670.
-
 // RUN: touch %t.o
 
 // RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld \
@@ -47,13 +43,10 @@
 
 // RUN: %clang -target x86_64-apple-macos10.13 -mlinker-version=520 \
 // RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=NOSDK %s
+// RUN:   | FileCheck --check-prefix=INFERRED-SDK %s
 // RUN: %clang -target x86_64-apple-darwin17 -mlinker-version=520 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=NOSDK %s
 // NOSDK: "-platform_version" "macos" "10.13.0" "10.13.0"
-
-// RUN: %clang -target arm64-apple-macos26 -mlinker-version=520 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=VERSION_BUMP %s
-// VERSION_BUMP: "-platform_version" "macos" "26.0.0" "26.0.0"
+// RUN:   | FileCheck --check-prefix=INFERRED-SDK %s
+// INFERRED-SDK: "-platform_version" "macos" "10.13.0" "{{[0-9]+(\.[0-9]+)*}}"

>From e404cdf9f4b8319d9ef3490f66fe81067ae61a4b Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <[email protected]>
Date: Thu, 12 Mar 2026 06:23:22 +0800
Subject: [PATCH 8/8] Remove unimportant tests

---
 clang/test/Driver/darwin-ld-platform-version-macos.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/clang/test/Driver/darwin-ld-platform-version-macos.c 
b/clang/test/Driver/darwin-ld-platform-version-macos.c
index 2ba36d527478a..72c50d0b32b44 100644
--- a/clang/test/Driver/darwin-ld-platform-version-macos.c
+++ b/clang/test/Driver/darwin-ld-platform-version-macos.c
@@ -40,13 +40,3 @@
 // ARM64_NEW: "-platform_version" "macos" "11.0.0" "10.15"
 // ARM64_NEW_1: "-platform_version" "macos" "11.1.0" "10.15"
 // ARM64_OLD: "-macosx_version_min" "11.0.0"
-
-// RUN: %clang -target x86_64-apple-macos10.13 -mlinker-version=520 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=INFERRED-SDK %s
-// RUN: %clang -target x86_64-apple-darwin17 -mlinker-version=520 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=NOSDK %s
-// NOSDK: "-platform_version" "macos" "10.13.0" "10.13.0"
-// RUN:   | FileCheck --check-prefix=INFERRED-SDK %s
-// INFERRED-SDK: "-platform_version" "macos" "10.13.0" "{{[0-9]+(\.[0-9]+)*}}"

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to