@@ -2261,7 +2261,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
22612261 // Warn if the path does not exist.
22622262 if (!getVFS ().exists (A->getValue ()))
22632263 getDriver ().Diag (clang::diag::warn_missing_sysroot) << A->getValue ();
2264- } else if (const char *env = ::getenv (" SDKROOT" ); env && *env ) {
2264+ } else if (const char *env = ::getenv (" SDKROOT" )) {
22652265 // We only use this value as the default if it is an absolute path,
22662266 // exists, and it is not the root path.
22672267 if (llvm::sys::path::is_absolute (env) && getVFS ().exists (env) &&
@@ -2271,13 +2271,16 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
22712271 }
22722272 }
22732273#ifdef CLANG_USE_XCSELECT
2274- else if (const char *env = ::getenv (" CLANG_NO_XCSELECT" );
2275- getTriple ().isMacOSX () && (!env || !*env)) {
2276- if (char *p;
2277- !::xcselect_host_sdk_path (CLANG_XCSELECT_HOST_SDK_POLICY, &p)) {
2278- Args.append (Args.MakeSeparateArg (
2279- nullptr , Opts.getOption (options::OPT_isysroot), p));
2280- ::free (p);
2274+ else if (getTriple ().isMacOSX ()) {
2275+ const char *env = ::getenv (" CLANG_NO_XCSELECT" );
2276+
2277+ if (!env || !*env) {
2278+ char *p;
2279+ if (!::xcselect_host_sdk_path (CLANG_XCSELECT_HOST_SDK_POLICY, &p)) {
2280+ Args.append (Args.MakeSeparateArg (
2281+ nullptr , Opts.getOption (options::OPT_isysroot), p));
2282+ ::free (p);
2283+ }
22812284 }
22822285 }
22832286#endif
0 commit comments