From: Chad Rosier Date: Mon, 8 Aug 2011 23:39:34 +0000 (+0000) Subject: If no -miphoneos-version-min specified, see if we can set the default based on X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98fdfd30c9f640d220aaf4e88c0e9a7dfa337c06;p=clang 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 --- 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