[llvm-branch-commits] [cfe-branch] r195225 - Merging r195149:

Bill Wendling isanbard at gmail.com
Tue Nov 19 22:44:29 PST 2013


Author: void
Date: Wed Nov 20 00:44:29 2013
New Revision: 195225

URL: http://llvm.org/viewvc/llvm-project?rev=195225&view=rev
Log:
Merging r195149:
------------------------------------------------------------------------
r195149 | grosbach | 2013-11-19 12:18:39 -0800 (Tue, 19 Nov 2013) | 6 lines

ARM: embedded v7 'darwin' doesn't get min-version defines.

Make sure armv7 doesn't get the iOS deployment version definitions when
it's being used for non-iOS.

rdar://15497681
------------------------------------------------------------------------

Modified:
    cfe/branches/release_34/   (props changed)
    cfe/branches/release_34/lib/Basic/Targets.cpp
    cfe/branches/release_34/test/Frontend/darwin-eabi.c

Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 20 00:44:29 2013
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128,195135-195136,195146,195158,195163
+/cfe/trunk:195126,195128,195135-195136,195146,195149,195158,195163
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_34/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/Basic/Targets.cpp?rev=195225&r1=195224&r2=195225&view=diff
==============================================================================
--- cfe/branches/release_34/lib/Basic/Targets.cpp (original)
+++ cfe/branches/release_34/lib/Basic/Targets.cpp Wed Nov 20 00:44:29 2013
@@ -138,33 +138,37 @@ static void getDarwinDefines(MacroBuilde
     return;
   }
 
-  // Set the appropriate OS version define.
-  if (Triple.isiOS()) {
-    assert(Maj < 10 && Min < 100 && Rev < 100 && "Invalid version!");
-    char Str[6];
-    Str[0] = '0' + Maj;
-    Str[1] = '0' + (Min / 10);
-    Str[2] = '0' + (Min % 10);
-    Str[3] = '0' + (Rev / 10);
-    Str[4] = '0' + (Rev % 10);
-    Str[5] = '\0';
-    Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__", Str);
-  } else if (Triple.getArchName() != "thumbv6m" &&
-             Triple.getArchName() != "thumbv7m" &&
-             Triple.getArchName() != "thumbv7em") {
-    // Note that the Driver allows versions which aren't representable in the
-    // define (because we only get a single digit for the minor and micro
-    // revision numbers). So, we limit them to the maximum representable
-    // version.
-    assert(Triple.getEnvironmentName().empty() && "Invalid environment!");
-    assert(Maj < 100 && Min < 100 && Rev < 100 && "Invalid version!");
-    char Str[5];
-    Str[0] = '0' + (Maj / 10);
-    Str[1] = '0' + (Maj % 10);
-    Str[2] = '0' + std::min(Min, 9U);
-    Str[3] = '0' + std::min(Rev, 9U);
-    Str[4] = '\0';
-    Builder.defineMacro("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__", Str);
+  // If there's an environment specified in the triple, that means we're dealing
+  // with an embedded variant of some sort and don't want the platform
+  // version-min defines, so only add them if there's not one.
+  if (Triple.getEnvironmentName().empty()) {
+    // Set the appropriate OS version define.
+    if (Triple.isiOS()) {
+      assert(Maj < 10 && Min < 100 && Rev < 100 && "Invalid version!");
+      char Str[6];
+      Str[0] = '0' + Maj;
+      Str[1] = '0' + (Min / 10);
+      Str[2] = '0' + (Min % 10);
+      Str[3] = '0' + (Rev / 10);
+      Str[4] = '0' + (Rev % 10);
+      Str[5] = '\0';
+      Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__",
+                          Str);
+    } else {
+      // Note that the Driver allows versions which aren't representable in the
+      // define (because we only get a single digit for the minor and micro
+      // revision numbers). So, we limit them to the maximum representable
+      // version.
+      assert(Triple.getEnvironmentName().empty() && "Invalid environment!");
+      assert(Maj < 100 && Min < 100 && Rev < 100 && "Invalid version!");
+      char Str[5];
+      Str[0] = '0' + (Maj / 10);
+      Str[1] = '0' + (Maj % 10);
+      Str[2] = '0' + std::min(Min, 9U);
+      Str[3] = '0' + std::min(Rev, 9U);
+      Str[4] = '\0';
+      Builder.defineMacro("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__", Str);
+    }
   }
 
   PlatformMinVersion = VersionTuple(Maj, Min, Rev);

Modified: cfe/branches/release_34/test/Frontend/darwin-eabi.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/test/Frontend/darwin-eabi.c?rev=195225&r1=195224&r2=195225&view=diff
==============================================================================
--- cfe/branches/release_34/test/Frontend/darwin-eabi.c (original)
+++ cfe/branches/release_34/test/Frontend/darwin-eabi.c Wed Nov 20 00:44:29 2013
@@ -1,6 +1,7 @@
-// RUN: %clang -target x86_64-apple-darwin -arch armv6m -dM -E %s | FileCheck %s
-// RUN: %clang -target x86_64-apple-darwin -arch armv7m -dM -E %s | FileCheck %s
-// RUN: %clang -target x86_64-apple-darwin -arch armv7em -dM -E %s | FileCheck %s
+// RUN: %clang -arch armv6m -dM -E %s | FileCheck %s
+// RUN: %clang -arch armv7m -dM -E %s | FileCheck %s
+// RUN: %clang -arch armv7em -dM -E %s | FileCheck %s
+// RUN: %clang -arch armv7 -target thumbv7-apple-darwin-eabi -dM -E %s | FileCheck %s
 
 // CHECK-NOT: __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
 // CHECK-NOT: __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__





More information about the llvm-branch-commits mailing list