[PATCH] D43787: Fix which Darwin versions have ObjC runtime with full subscripting support.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 26 14:23:45 PST 2018


vsapsai created this revision.
vsapsai added reviewers: vsk, kubamracek.
Herald added a subscriber: jkorous-apple.

Update min deployment target in some tests so that they don't try
to link against libarclite and don't fail when it's not available.

rdar://problem/29253617


https://reviews.llvm.org/D43787

Files:
  clang/include/clang/Basic/ObjCRuntime.h
  clang/test/Driver/arclite-link.c
  compiler-rt/test/lit.common.cfg
  compiler-rt/test/tsan/Darwin/norace-objcxx-run-time.mm


Index: compiler-rt/test/tsan/Darwin/norace-objcxx-run-time.mm
===================================================================
--- compiler-rt/test/tsan/Darwin/norace-objcxx-run-time.mm
+++ compiler-rt/test/tsan/Darwin/norace-objcxx-run-time.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_tsan %s -lc++ -fobjc-arc -lobjc -o %t -framework Foundation
+// RUN: %clang_tsan %s -lc++ -fobjc-arc -lobjc -o %t -framework Foundation %darwin_min_target_with_full_runtime_arc_support
 // RUN: %run %t 2>&1 | FileCheck %s
 
 // Check that we do not report races between:
Index: compiler-rt/test/lit.common.cfg
===================================================================
--- compiler-rt/test/lit.common.cfg
+++ compiler-rt/test/lit.common.cfg
@@ -197,8 +197,14 @@
     pass
 
   config.substitutions.append( ("%macos_min_target_10_11", "-mmacosx-version-min=10.11") )
+
+  isIOS = getattr(config, 'ios', False)
+  # rdar://problem/22207160
+  config.substitutions.append( ("%darwin_min_target_with_full_runtime_arc_support",
+      "-miphoneos-version-min=9.0" if isIOS else "-mmacosx-version-min=10.11") )
 else:
   config.substitutions.append( ("%macos_min_target_10_11", "") )
+  config.substitutions.append( ("%darwin_min_target_with_full_runtime_arc_support", "") )
 
 if config.android:
   adb = os.environ.get('ADB', 'adb')
Index: clang/test/Driver/arclite-link.c
===================================================================
--- clang/test/Driver/arclite-link.c
+++ clang/test/Driver/arclite-link.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
-// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -lfoo -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s
-// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.8 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -lfoo -mmacosx-version-min=10.10 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.11 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
 // RUN: %clang -### -target i386-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
 // RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -nostdlib %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOSTDLIB %s
 
@@ -12,6 +12,6 @@
 // CHECK-NOARCLITE-NOT: libarclite
 // CHECK-NOSTDLIB-NOT: -lobjc
 
-// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -fobjc-arc -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=CHECK-UNUSED %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -fobjc-arc -mmacosx-version-min=10.10 %s 2>&1 | FileCheck -check-prefix=CHECK-UNUSED %s
 
 // CHECK-UNUSED-NOT: warning: argument unused during compilation: '-fobjc-link-runtime'
Index: clang/include/clang/Basic/ObjCRuntime.h
===================================================================
--- clang/include/clang/Basic/ObjCRuntime.h
+++ clang/include/clang/Basic/ObjCRuntime.h
@@ -207,8 +207,8 @@
   bool hasSubscripting() const {
     switch (getKind()) {
     case FragileMacOSX: return false;
-    case MacOSX: return getVersion() >= VersionTuple(10, 8);
-    case iOS: return getVersion() >= VersionTuple(6);
+    case MacOSX: return getVersion() >= VersionTuple(10, 11);
+    case iOS: return getVersion() >= VersionTuple(9);
     case WatchOS: return true;
 
     // This is really a lie, because some implementations and versions


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43787.135985.patch
Type: text/x-patch
Size: 3607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180226/cfe57cdf/attachment-0001.bin>


More information about the cfe-commits mailing list