[Driver] Simplify code choosing between MacOS and iOS platforms. NFC.

llvm-svn: 239980
This commit is contained in:
Alexey Samsonov 2015-06-18 00:36:38 +00:00
parent 24c5fd0419
commit fd0bb3a9ac
1 changed files with 10 additions and 12 deletions

View File

@ -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);
}
}