[clang] [clang][Driver][Darwin] Optionally use xcselect to find macOS SDK (PR #119670)
Steven Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 12 10:14:57 PST 2024
================
@@ -2257,17 +2261,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");
----------------
cachemeifyoucan wrote:
Don't write if conditions with multiple statements. Same as below.
https://github.com/llvm/llvm-project/pull/119670
More information about the cfe-commits
mailing list