aboutsummaryrefslogtreecommitdiff
path: root/test/Driver
diff options
context:
space:
mode:
Diffstat (limited to 'test/Driver')
-rw-r--r--test/Driver/darwin-iphone-defaults.m30
-rw-r--r--test/Driver/darwin-ld.c33
-rw-r--r--test/Driver/darwin-version.c21
-rw-r--r--test/Driver/rewrite-objc.m11
4 files changed, 93 insertions, 2 deletions
diff --git a/test/Driver/darwin-iphone-defaults.m b/test/Driver/darwin-iphone-defaults.m
new file mode 100644
index 000000000000..97ac4a42a54b
--- /dev/null
+++ b/test/Driver/darwin-iphone-defaults.m
@@ -0,0 +1,30 @@
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -arch armv7 -flto -S -o - %s | FileCheck %s
+
+// CHECK: @f0
+// CHECK-NOT: ssp
+// CHECK: ) {
+// CHECK: @__f0_block_invoke
+// CHECK: void @f1
+// CHECK-NOT: msgSend_fixup_alloc
+// CHECK: OBJC_SELECTOR_REFERENCES
+
+int f0() {
+ return ^(){ return 0; }();
+}
+
+@interface I0
+@property (assign) int p0;
+@end
+
+@implementation I0
+@synthesize p0 = __sythesized_p0;
+@end
+
+@interface I1
++(id) alloc;
+@end
+
+void f1() {
+ [I1 alloc];
+}
+
diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c
index de751a67d965..d34d566d1878 100644
--- a/test/Driver/darwin-ld.c
+++ b/test/Driver/darwin-ld.c
@@ -39,5 +39,38 @@
// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch i386 -arch x86_64 -g %s 2> %t.log
// RUN: grep dsymutil %t.log | count 0
+// Check linker changes that came with new linkedit format.
+// RUN: touch %t.o
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 %t.o 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 -dynamiclib %t.o 2>> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 -bundle %t.o 2>> %t.log
+// RUN: FileCheck -check-prefix=LINK_IPHONE_3_0 %s < %t.log
+// LINK_IPHONE_3_0: ld"
+// LINK_IPHONE_3_0-NOT: -lcrt1.3.1.o
+// LINK_IPHONE_3_0: -lcrt1.o
+// LINK_IPHONE_3_0: -lSystem
+// LINK_IPHONE_3_0: ld"
+// LINK_IPHONE_3_0: -dylib
+// LINK_IPHONE_3_0: -ldylib1.o
+// LINK_IPHONE_3_0: -lSystem
+// LINK_IPHONE_3_0: ld"
+// LINK_IPHONE_3_0: -lbundle1.o
+// LINK_IPHONE_3_0: -lSystem
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 %t.o 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 -dynamiclib %t.o 2>> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 -bundle %t.o 2>> %t.log
+// RUN: FileCheck -check-prefix=LINK_IPHONE_3_1 %s < %t.log
+
+// LINK_IPHONE_3_1: ld"
+// LINK_IPHONE_3_1-NOT: -lcrt1.o
+// LINK_IPHONE_3_1: -lcrt1.3.1.o
+// LINK_IPHONE_3_1: -lSystem
+// LINK_IPHONE_3_1: ld"
+// LINK_IPHONE_3_1: -dylib
+// LINK_IPHONE_3_1-NOT: -ldylib1.o
+// LINK_IPHONE_3_1: -lSystem
+// LINK_IPHONE_3_1: ld"
+// LINK_IPHONE_3_1-NOT: -lbundle1.o
+// LINK_IPHONE_3_1: -lSystem
diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c
index e69a8447c4a7..84533a625246 100644
--- a/test/Driver/darwin-version.c
+++ b/test/Driver/darwin-version.c
@@ -1,6 +1,23 @@
-// RUN: env MACOSX_DEPLOYMENT_TARGET=10.1 %clang -ccc-host-triple i386-apple-darwin9 -E %s
-
+// RUN: env MACOSX_DEPLOYMENT_TARGET=10.1 \
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -DTEST0 -E %s
+#ifdef TEST0
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010
#error Invalid version
#endif
+#endif
+// RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.0 \
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -DTEST1 -E %s
+#ifdef TEST1
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 20000
+#error Invalid version
+#endif
+#endif
+
+// RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.3.1 \
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -DTEST2 -E %s
+#ifdef TEST2
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 20301
+#error Invalid version
+#endif
+#endif
diff --git a/test/Driver/rewrite-objc.m b/test/Driver/rewrite-objc.m
new file mode 100644
index 000000000000..38993fc8978c
--- /dev/null
+++ b/test/Driver/rewrite-objc.m
@@ -0,0 +1,11 @@
+// RUN: %clang -ccc-host-triple unknown -rewrite-objc %s -o - -### 2>&1 | \
+// RUN: FileCheck -check-prefix=TEST0 %s
+// TEST0: clang{{.*}}" "-rewrite-objc"
+
+// RUN: not %clang -ccc-no-clang -ccc-host-triple unknown -rewrite-objc %s -o - -### 2>&1 | \
+// RUN: FileCheck -check-prefix=TEST1 %s
+// TEST1: invalid output type 'rewritten-objc' for use with gcc
+
+// RUN: not %clang -ccc-no-clang -ccc-host-triple i386-apple-darwin10 -rewrite-objc %s -o - -### 2>&1 | \
+// RUN: FileCheck -check-prefix=TEST2 %s
+// TEST2: invalid output type 'rewritten-objc' for use with gcc