From: Alexey Samsonov Date: Thu, 18 Jun 2015 00:36:38 +0000 (+0000) Subject: [Driver] Simplify code choosing between MacOS and iOS platforms. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ac4e84415c2c8f287427a2afe3c387b64d435f7;p=clang [Driver] Simplify code choosing between MacOS and iOS platforms. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239980 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index e3dab2040f..25a3d8e475 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -515,13 +515,17 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { } } - // If no OSX or iOS target has been specified and we're compiling for armv7, - // go ahead as assume we're targeting iOS. - StringRef MachOArchName = getMachOArchName(Args); - if (OSXTarget.empty() && iOSTarget.empty() && - (MachOArchName == "armv7" || MachOArchName == "armv7s" || - MachOArchName == "arm64")) + // If no OSX or iOS target has been specified, try to guess platform + // from arch name. + if (OSXTarget.empty() && iOSTarget.empty()) { + StringRef MachOArchName = getMachOArchName(Args); + if (MachOArchName == "armv7" || MachOArchName == "armv7s" || + MachOArchName == "arm64") iOSTarget = iOSVersionMin; + else if (MachOArchName != "armv6m" && MachOArchName != "armv7m" && + MachOArchName != "armv7em") + OSXTarget = MacosxVersionMin; + } // Allow conflicts among OSX and iOS for historical reasons, but choose the // default platform. @@ -542,12 +546,6 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { const Option O = Opts.getOption(options::OPT_miphoneos_version_min_EQ); iOSVersion = Args.MakeJoinedArg(nullptr, O, iOSTarget); Args.append(iOSVersion); - } else if (MachOArchName != "armv6m" && MachOArchName != "armv7m" && - MachOArchName != "armv7em") { - // Otherwise, assume we are targeting OS X. - const Option O = Opts.getOption(options::OPT_mmacosx_version_min_EQ); - OSXVersion = Args.MakeJoinedArg(nullptr, O, MacosxVersionMin); - Args.append(OSXVersion); } }