[llvm-branch-commits] [cfe-branch] r310676 - Merging r309633, r309636 and r309640:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 10 18:45:48 PDT 2017


Author: hans
Date: Thu Aug 10 18:45:48 2017
New Revision: 310676

URL: http://llvm.org/viewvc/llvm-project?rev=310676&view=rev
Log:
Merging r309633, r309636 and r309640:
------------------------------------------------------------------------
r309633 | ahatanak | 2017-07-31 15:19:34 -0700 (Mon, 31 Jul 2017) | 6 lines

[Driver] Make sure the deployment target is earlier than iOS 11 when
it is inferred from -isysroot.

This fixes a change that was inadvertently introduced in r309607.

rdar://problem/32230613
------------------------------------------------------------------------

------------------------------------------------------------------------
r309636 | ahatanak | 2017-07-31 15:46:00 -0700 (Mon, 31 Jul 2017) | 1 line

Silence warning -Wmissing-sysroot.
------------------------------------------------------------------------

------------------------------------------------------------------------
r309640 | ahatanak | 2017-07-31 16:08:52 -0700 (Mon, 31 Jul 2017) | 1 line

Use -target instead of -arch in test case.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_50/   (props changed)
    cfe/branches/release_50/lib/Driver/ToolChains/Darwin.cpp
    cfe/branches/release_50/test/Driver/darwin-version.c

Propchange: cfe/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 10 18:45:48 2017
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:308455,308722,308824,308897,308996,309058,309112-309113,309226,309263,309327,309382-309383,309488,309503,309523,309569,309607,309722,309752,309975,310057,310158,310191,310359
+/cfe/trunk:308455,308722,308824,308897,308996,309058,309112-309113,309226,309263,309327,309382-309383,309488,309503,309523,309569,309607,309633,309636,309640,309722,309752,309975,310057,310158,310191,310359
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_50/lib/Driver/ToolChains/Darwin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/lib/Driver/ToolChains/Darwin.cpp?rev=310676&r1=310675&r2=310676&view=diff
==============================================================================
--- cfe/branches/release_50/lib/Driver/ToolChains/Darwin.cpp (original)
+++ cfe/branches/release_50/lib/Driver/ToolChains/Darwin.cpp Thu Aug 10 18:45:48 2017
@@ -1174,13 +1174,12 @@ void Darwin::AddDeploymentTarget(Derived
   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(Derived
     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(Derived
           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(Derived
         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 ||

Modified: cfe/branches/release_50/test/Driver/darwin-version.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/test/Driver/darwin-version.c?rev=310676&r1=310675&r2=310676&view=diff
==============================================================================
--- cfe/branches/release_50/test/Driver/darwin-version.c (original)
+++ cfe/branches/release_50/test/Driver/darwin-version.c Thu Aug 10 18:45:48 2017
@@ -26,6 +26,8 @@
 
 // RUN: %clang -target armv7-apple-ios11.1 -c -### %s 2>&1 | \
 // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s
+// RUN: %clang -target armv7-apple-ios9 -Wno-missing-sysroot -isysroot SDKs/iPhoneOS11.0.sdk -c -### %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s
 // CHECK-VERSION-IOS7: thumbv7-apple-ios10.99.99
 
 // RUN: env IPHONEOS_DEPLOYMENT_TARGET=11.0 \




More information about the llvm-branch-commits mailing list