summaryrefslogtreecommitdiffstats
path: root/test/CodeGenObjC
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-05-04 16:12:48 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-05-04 16:12:48 +0000
commit8aaf5818a64e9f7687798852af5945b053c68a54 (patch)
treed6a70c3518b8dea8be7062438d7e8676820ed17f /test/CodeGenObjC
parent71438373cd57f0d5d8c93bb5cf690844a0fbc9d0 (diff)
downloadFreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.zip
FreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.tar.gz
Update clang to r103004.
Diffstat (limited to 'test/CodeGenObjC')
-rw-r--r--test/CodeGenObjC/atomic-aggregate-property.m28
-rw-r--r--test/CodeGenObjC/blocks.m2
-rw-r--r--test/CodeGenObjC/encode-cstyle-method.m11
-rw-r--r--test/CodeGenObjC/exceptions.m18
-rw-r--r--test/CodeGenObjC/image-info.m10
-rw-r--r--test/CodeGenObjC/metadata-symbols-64.m2
-rw-r--r--test/CodeGenObjC/metadata_symbols.m51
-rw-r--r--test/CodeGenObjC/next-objc-dispatch.m73
-rw-r--r--test/CodeGenObjC/non-lazy-classes.m2
-rw-r--r--test/CodeGenObjC/ns-constant-strings.m33
-rw-r--r--test/CodeGenObjC/objc-gc-aggr-assign.m46
-rw-r--r--test/CodeGenObjC/objc2-legacy-dispatch.m4
-rw-r--r--test/CodeGenObjC/x86_64-struct-return-gc.m2
13 files changed, 210 insertions, 72 deletions
diff --git a/test/CodeGenObjC/atomic-aggregate-property.m b/test/CodeGenObjC/atomic-aggregate-property.m
new file mode 100644
index 0000000..2896d37
--- /dev/null
+++ b/test/CodeGenObjC/atomic-aggregate-property.m
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s
+// rdar: // 7849824
+
+struct s {
+ double a, b, c, d;
+};
+
+struct s1 {
+ int i;
+ id j;
+ id k;
+};
+
+@interface A
+@property (readwrite) double x;
+@property (readwrite) struct s y;
+@property (nonatomic, readwrite) struct s1 z;
+@end
+
+@implementation A
+@synthesize x;
+@synthesize y;
+@synthesize z;
+@end
+
+// CHECK-LP64: call void @objc_copyStruct
+// CHECK-LP64: call void @objc_copyStruct
+// CHECK-LP64: call void @objc_copyStruct
diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m
index 6dc1410..8ba319e 100644
--- a/test/CodeGenObjC/blocks.m
+++ b/test/CodeGenObjC/blocks.m
@@ -29,7 +29,7 @@ void foo(T *P) {
@interface B : A @end
@implementation B
-(void) im1 {
- ^(void) { [super im0]; }();
+ ^(void) { [self im0]; }();
}
@end
diff --git a/test/CodeGenObjC/encode-cstyle-method.m b/test/CodeGenObjC/encode-cstyle-method.m
new file mode 100644
index 0000000..187c9bf
--- /dev/null
+++ b/test/CodeGenObjC/encode-cstyle-method.m
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s
+// rdar: // 7445205
+
+@interface Foo
+- (id)test:(id)one, id two;
+@end
+
+@implementation Foo
+- (id)test:(id )one, id two {return two; } @end
+
+// CHECK-LP64: internal global [11 x i8] c"@24@0:8@16
diff --git a/test/CodeGenObjC/exceptions.m b/test/CodeGenObjC/exceptions.m
new file mode 100644
index 0000000..a74dee9
--- /dev/null
+++ b/test/CodeGenObjC/exceptions.m
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s
+//
+// <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes
+
+// Just check that we don't emit any dead blocks.
+//
+// RUN: grep 'No predecessors' %t | count 0
+
+@interface NSArray @end
+void f0() {
+ @try {
+ @try {
+ @throw @"a";
+ } @catch(NSArray *e) {
+ }
+ } @catch (id e) {
+ }
+}
diff --git a/test/CodeGenObjC/image-info.m b/test/CodeGenObjC/image-info.m
index 8916d00..2777723 100644
--- a/test/CodeGenObjC/image-info.m
+++ b/test/CodeGenObjC/image-info.m
@@ -1,2 +1,8 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s
-// RUN: grep -F '@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular"' %t
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s
+
+// CHECK-FRAGILE: @"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular"
+// CHECK-NONFRAGILE: @"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__DATA, __objc_imageinfo, regular, no_dead_strip"
diff --git a/test/CodeGenObjC/metadata-symbols-64.m b/test/CodeGenObjC/metadata-symbols-64.m
index 886d53a..dbc06d7 100644
--- a/test/CodeGenObjC/metadata-symbols-64.m
+++ b/test/CodeGenObjC/metadata-symbols-64.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed -emit-llvm -o %t %s
// RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s &&
// RUN: grep '@"OBJC_CLASS_$_A" = global' %t
diff --git a/test/CodeGenObjC/metadata_symbols.m b/test/CodeGenObjC/metadata_symbols.m
index dc65382..921168c 100644
--- a/test/CodeGenObjC/metadata_symbols.m
+++ b/test/CodeGenObjC/metadata_symbols.m
@@ -1,25 +1,40 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
-
-// RUN: grep '@"OBJC_METACLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t
-// RUN: grep '@"OBJC_CLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH1" = weak global .*section "__DATA,__datacoal_nt,coalesced", align 8' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH2" = external global' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH3" = global .*section "__DATA,__objc_const", align 8' %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: FileCheck -check-prefix=CHECK-X86_64 < %t %s
// RUN: grep '@"OBJC_EHTYPE_$_EH3"' %t | count 3
-// RUN: grep '@"\\01L_OBJC_CLASS_NAME_" =.*section "__TEXT,__cstring,cstring_literals", align 1' %t | count 1
-// RUN: grep -F 'define internal void @"\01-[A im0]"' %t
-// RUN: grep -F 'define internal void @"\01-[A(Cat) im1]"' %t
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s
+// CHECK-X86_64: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 8
+// CHECK-X86_64: @"OBJC_METACLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 8
+// CHECK-X86_64: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__cstring,cstring_literals", align 1
+// CHECK-X86_64: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 8
+// CHECK-X86_64: @"OBJC_EHTYPE_$_EH2" = external global
+// CHECK-X86_64: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 8
+// CHECK-X86_64: @"\01L_OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 8
+// CHECK-X86_64: define internal void @"\01-[A im0]"
+// CHECK-X86_64: define internal void @"\01-[A(Cat) im1]"
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s
+// RUN: FileCheck -check-prefix=CHECK-X86_64-HIDDEN < %t %s
+
+// CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
+// CHECK-X86_64-HIDDEN: @"OBJC_METACLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
+// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH1" = weak hidden global {{.*}}, section "__DATA,__datacoal_nt,coalesced"
+// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH2" = external global
+// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH3" = hidden global {{.*}}, section "__DATA,__objc_const", align 8
+// CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]"
+// CHECK-X86_64-HIDDEN: define internal void @"\01-[A(Cat) im1]"
-// RUN: grep '@"OBJC_METACLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t
-// RUN: grep '@"OBJC_CLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH1" = weak hidden global .*section "__DATA,__datacoal_nt,coalesced"' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH2" = external global' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH3" = hidden global .*section "__DATA,__objc_const", align 8' %t
-// RUN: grep -F 'define internal void @"\01-[A im0]"' %t
-// RUN: grep -F 'define internal void @"\01-[A(Cat) im1]"' %t
+// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: FileCheck -check-prefix=CHECK-ARMV6 < %t %s
+// CHECK-ARMV6: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4
+// CHECK-ARMV6: @"OBJC_METACLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4
+// CHECK-ARMV6: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__cstring,cstring_literals", align 1
+// CHECK-ARMV6: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 4
+// CHECK-ARMV6: @"OBJC_EHTYPE_$_EH2" = external global
+// CHECK-ARMV6: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 4
+// CHECK-ARMV6: @"\01L_OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 4
+// CHECK-ARMV6: define internal arm_apcscc void @"\01-[A im0]"
+// CHECK-ARMV6: define internal arm_apcscc void @"\01-[A(Cat) im1]"
@interface A
@end
diff --git a/test/CodeGenObjC/next-objc-dispatch.m b/test/CodeGenObjC/next-objc-dispatch.m
new file mode 100644
index 0000000..a3e8e19
--- /dev/null
+++ b/test/CodeGenObjC/next-objc-dispatch.m
@@ -0,0 +1,73 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
+// RUN: -fobjc-dispatch-method=legacy | \
+// RUN: FileCheck -check-prefix CHECK-FRAGILE_LEGACY %s
+//
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
+// RUN: -fobjc-nonfragile-abi -fobjc-dispatch-method=legacy | \
+// RUN: FileCheck -check-prefix CHECK-NONFRAGILE_LEGACY %s
+//
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
+// RUN: -fobjc-nonfragile-abi -fobjc-dispatch-method=non-legacy | \
+// RUN: FileCheck -check-prefix CHECK-NONFRAGILE_NONLEGACY %s
+//
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
+// RUN: -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed | \
+// RUN: FileCheck -check-prefix CHECK-NONFRAGILE_MIXED %s
+//
+// <rdar://problem/7866951>
+
+// There are basically four ways that we end up doing message dispatch for the
+// NeXT runtime. They are:
+// (1) fragile ABI, legacy dispatch
+// (2) non-fragile ABI, legacy dispatch
+// (2) non-fragile ABI, non-legacy dispatch
+// (2) non-fragile ABI, mixed dispatch
+//
+// Note that fragile ABI and non-fragile ABI legacy dispatch are not the same,
+// they use some different API calls (objc_msgSendSuper vs objc_msgSendSuper2).
+
+// CHECK-FRAGILE_LEGACY: ModuleID
+// CHECK-FRAGILE_LEGACY-NOT: declare i8* @objc_msgSendSuper2_fixup(
+// CHECK-FRAGILE_LEGACY-NOT: declare i8* @objc_msgSend_fixup(
+// CHECK-FRAGILE_LEGACY: declare i8* @objc_msgSendSuper(
+// CHECK-FRAGILE_LEGACY: declare i8* @objc_msgSend(
+
+// CHECK-NONFRAGILE_LEGACY: ModuleID
+// CHECK-NONFRAGILE_LEGACY-NOT: declare i8* @objc_msgSendSuper2_fixup(
+// CHECK-NONFRAGILE_LEGACY-NOT: declare i8* @objc_msgSend_fixup(
+// CHECK-NONFRAGILE_LEGACY: declare i8* @objc_msgSendSuper2(
+// CHECK-NONFRAGILE_LEGACY: declare i8* @objc_msgSend(
+
+// CHECK-NONFRAGILE_NONLEGACY: ModuleID
+// CHECK-NONFRAGILE_NONLEGACY: declare i8* @objc_msgSendSuper2_fixup(
+// CHECK-NONFRAGILE_NONLEGACY: declare i8* @objc_msgSend_fixup(
+
+// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSendSuper2_fixup(
+// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSendSuper2(
+// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSend_fixup(
+// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSend(
+
+@interface NSObject
++ (id)alloc;
+- (id)init;
+@end
+
+@interface I0 : NSObject
+-(void) im0;
+@end
+
+@implementation I0
++(id) alloc {
+ return [super alloc];
+}
+-(id) init {
+ [super init];
+ return self;
+}
+-(void) im0 {}
+@end
+
+void f0(I0 *a) {
+ [I0 alloc];
+ [a im0];
+}
diff --git a/test/CodeGenObjC/non-lazy-classes.m b/test/CodeGenObjC/non-lazy-classes.m
index 021db97..512ad89 100644
--- a/test/CodeGenObjC/non-lazy-classes.m
+++ b/test/CodeGenObjC/non-lazy-classes.m
@@ -1,5 +1,5 @@
// RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s &&
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CLASS_$" = internal global \[1 x .*\] .*@"OBJC_CLASS_$_A".*, section "__DATA, __objc_nlclslist, regular, no_dead_strip", align 8' %t
// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CATEGORY_$" = internal global \[1 x .*\] .*@".01l_OBJC_$_CATEGORY_A_$_Cat".*, section "__DATA, __objc_nlcatlist, regular, no_dead_strip", align 8' %t
diff --git a/test/CodeGenObjC/ns-constant-strings.m b/test/CodeGenObjC/ns-constant-strings.m
new file mode 100644
index 0000000..3ef5f55
--- /dev/null
+++ b/test/CodeGenObjC/ns-constant-strings.m
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fno-constant-cfstrings -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fno-constant-cfstrings -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s
+
+@interface NSString @end
+
+@interface NSSimpleCString : NSString {
+@protected
+ char *bytes;
+ unsigned int numBytes;
+}
+@end
+
+@interface NSConstantString : NSSimpleCString
+@end
+
+#if OBJC_API_VERSION >= 2
+extern Class _NSConstantStringClassReference;
+#else
+extern struct objc_class _NSConstantStringClassReference;
+#endif
+
+const NSConstantString *appKey = @"MyApp";
+
+int main() {
+ const NSConstantString *appKey = @"MyApp";
+ const NSConstantString *appKey1 = @"MyApp1";
+}
+
+// CHECK-FRAGILE: @_NSConstantStringClassReference = external global
+// CHECK-NONFRAGILE: @"OBJC_CLASS_$_NSConstantString" = external global
diff --git a/test/CodeGenObjC/objc-gc-aggr-assign.m b/test/CodeGenObjC/objc-gc-aggr-assign.m
deleted file mode 100644
index e127242..0000000
--- a/test/CodeGenObjC/objc-gc-aggr-assign.m
+++ /dev/null
@@ -1,46 +0,0 @@
-// RUN: %clang_cc1 -fobjc-gc -emit-llvm -o %t %s
-// RUN: grep objc_memmove_collectable %t | grep call | count 3
-
-static int count;
-
-typedef struct S {
- int ii;
-} SS;
-
-struct type_s {
- SS may_recurse;
- id id_val;
-};
-
-@interface NamedObject
-{
- struct type_s type_s_ivar;
-}
-- (void) setSome : (struct type_s) arg;
-- (struct type_s) getSome;
-@property(assign) struct type_s aggre_prop;
-@end
-
-@implementation NamedObject
-- (void) setSome : (struct type_s) arg
- {
- type_s_ivar = arg;
- }
-- (struct type_s) getSome
- {
- return type_s_ivar;
- }
-@synthesize aggre_prop = type_s_ivar;
-@end
-
-struct type_s some = {{1234}, (id)0};
-
-struct type_s get(void)
-{
- return some;
-}
-
-void f(const struct type_s *in, struct type_s *out) {
- *out = *in;
-}
-
diff --git a/test/CodeGenObjC/objc2-legacy-dispatch.m b/test/CodeGenObjC/objc2-legacy-dispatch.m
index 4c37573..7a99d15 100644
--- a/test/CodeGenObjC/objc2-legacy-dispatch.m
+++ b/test/CodeGenObjC/objc2-legacy-dispatch.m
@@ -1,11 +1,11 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed -triple i386-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s
//
// CHECK_NEW_DISPATCH: define void @f0
// CHECK_NEW_DISPATCH: bitcast {{.*}}objc_msgSend_fixup_alloc
// CHECK_NEW_DISPATCH: define void @f1
// CHECK_NEW_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
//
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-legacy-dispatch -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-dispatch-method=legacy -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s
//
// CHECK_OLD_DISPATCH: define void @f0
// CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
diff --git a/test/CodeGenObjC/x86_64-struct-return-gc.m b/test/CodeGenObjC/x86_64-struct-return-gc.m
index 32a321c..c62a33f 100644
--- a/test/CodeGenObjC/x86_64-struct-return-gc.m
+++ b/test/CodeGenObjC/x86_64-struct-return-gc.m
@@ -25,7 +25,7 @@ struct Indirect indirect_func(void);
void Indirect_test(void) {
struct Indirect i;
- // CHECK: call void @indirect_func(%struct.Indirect* noalias sret
+ // CHECK: call void @indirect_func(%struct.Indirect* sret
// CHECK: call i8* @objc_memmove_collectable(
i = indirect_func();
}
OpenPOWER on IntegriCloud