diff options
Diffstat (limited to 'lib/Driver/ToolChains/Darwin.cpp')
-rw-r--r-- | lib/Driver/ToolChains/Darwin.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp index 3db84ee1e6..ad8e9eae79 100644 --- a/lib/Driver/ToolChains/Darwin.cpp +++ b/lib/Driver/ToolChains/Darwin.cpp @@ -1174,13 +1174,12 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { unsigned Major, Minor, Micro; bool HadExtra; - // iOS 10 is the maximum deployment target for 32-bit targets. - if (iOSVersion && getTriple().isArch32Bit() && - Driver::GetReleaseVersion(iOSVersion->getValue(), Major, Minor, Micro, - HadExtra) && - Major > 10) - getDriver().Diag(diag::warn_invalid_ios_deployment_target) - << iOSVersion->getAsString(Args); + // The iOS deployment target that is explicitly specified via a command line + // option or an environment variable. + std::string ExplicitIOSDeploymentTargetStr; + + if (iOSVersion) + ExplicitIOSDeploymentTargetStr = iOSVersion->getAsString(Args); // Add a macro to differentiate between m(iphone|tv|watch)os-version-min=X.Y and // -m(iphone|tv|watch)simulator-version-min=X.Y. @@ -1223,13 +1222,9 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { if (char *env = ::getenv("WATCHOS_DEPLOYMENT_TARGET")) WatchOSTarget = env; - // iOS 10 is the maximum deployment target for 32-bit targets. - if (!iOSTarget.empty() && getTriple().isArch32Bit() && - Driver::GetReleaseVersion(iOSTarget.c_str(), Major, Minor, Micro, - HadExtra) && - Major > 10) - getDriver().Diag(diag::warn_invalid_ios_deployment_target) - << std::string("IPHONEOS_DEPLOYMENT_TARGET=") + iOSTarget; + if (!iOSTarget.empty()) + ExplicitIOSDeploymentTargetStr = + std::string("IPHONEOS_DEPLOYMENT_TARGET=") + iOSTarget; // If there is no command-line argument to specify the Target version and // no environment variable defined, see if we can set the default based @@ -1298,15 +1293,6 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { break; case llvm::Triple::IOS: getTriple().getiOSVersion(Major, Minor, Micro); - - // iOS 10 is the maximum deployment target for 32-bit targets. If the - // inferred deployment target is iOS 11 or later, set it to 10.99. - if (getTriple().isArch32Bit() && Major >= 11) { - Major = 10; - Minor = 99; - Micro = 99; - } - OSTarget = &iOSTarget; break; case llvm::Triple::TvOS: @@ -1402,6 +1388,20 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { HadExtra || Major >= 100 || Minor >= 100 || Micro >= 100) getDriver().Diag(diag::err_drv_invalid_version_number) << iOSVersion->getAsString(Args); + // For 32-bit targets, the deployment target for iOS has to be earlier than + // iOS 11. + if (getTriple().isArch32Bit() && Major >= 11) { + // If the deployment target is explicitly specified, print a diagnostic. + if (!ExplicitIOSDeploymentTargetStr.empty()) { + getDriver().Diag(diag::warn_invalid_ios_deployment_target) + << ExplicitIOSDeploymentTargetStr; + // Otherwise, set it to 10.99.99. + } else { + Major = 10; + Minor = 99; + Micro = 99; + } + } } else if (Platform == TvOS) { if (!Driver::GetReleaseVersion(TvOSVersion->getValue(), Major, Minor, Micro, HadExtra) || HadExtra || |