[clang] [clang][Driver][Darwin] Optionally use xcselect to find macOS SDK (PR #119670)

Carlo Cabrera via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 13 10:05:59 PST 2024


================
@@ -2257,17 +2261,25 @@ 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")) {
+    // 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 (getTriple().isMacOSX()) {
----------------
carlocab wrote:

Yes, thanks, applied in c51df70d1380c3c7476f5314b0d34605e6fa8ac6

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


More information about the cfe-commits mailing list