]> granicus.if.org Git - clang/commitdiff
If no -miphoneos-version-min specified, see if we can set the default based on
authorChad Rosier <mcrosier@apple.com>
Mon, 8 Aug 2011 23:39:34 +0000 (23:39 +0000)
committerChad Rosier <mcrosier@apple.com>
Mon, 8 Aug 2011 23:39:34 +0000 (23:39 +0000)
-isysroot.
rdar://9837120

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137075 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp

index 5ed4b7f4d3f121b6658091e09e510a7bcf724bbb..f34423b278b0452a208e6931dea3d829525f9f3f 100644 (file)
@@ -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