aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-08-08 23:39:34 +0000
committerChad Rosier <mcrosier@apple.com>2011-08-08 23:39:34 +0000
commit98fdfd30c9f640d220aaf4e88c0e9a7dfa337c06 (patch)
treeb4034d0b146f0b5a2cb5904032c7d993ec2e1ad5 /lib/Driver/ToolChains.cpp
parentde091aeb4658e986ed8fa5fbce7ab35ef2ae26ec (diff)
If no -miphoneos-version-min specified, see if we can set the default based on
-isysroot. rdar://9837120 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137075 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r--lib/Driver/ToolChains.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 5ed4b7f4d3..f34423b278 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -490,6 +490,21 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
Arg *iOSSimVersion = Args.getLastArg(
options::OPT_mios_simulator_version_min_EQ);
+ // If no '-miphoneos-version-min' specified, see if we can set the default
+ // based on isysroot.
+ if (!iOSVersion) {
+ if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
+ StringRef first, second;
+ StringRef isysroot = A->getValue(Args);
+ llvm::tie(first, second) = isysroot.split(StringRef("SDKs/iPhoneOS"));
+ if (second != "") {
+ const Option *O = Opts.getOption(options::OPT_miphoneos_version_min_EQ);
+ iOSVersion = Args.MakeJoinedArg(0, O, second.substr(0,3));
+ Args.append(iOSVersion);
+ }
+ }
+ }
+
// FIXME: HACK! When compiling for the simulator we don't get a
// '-miphoneos-version-min' to help us know whether there is an ARC runtime
// or not; try to parse a __IPHONE_OS_VERSION_MIN_REQUIRED