summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjC/messages-2.m
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-02-26 09:12:15 +0000
committerJohn McCall <rjmccall@apple.com>2011-02-26 09:12:15 +0000
commit71309be80a246a2f06842bd32ee53b3d5f007b82 (patch)
tree91a126e9941aac24debce2509ea101248bccfeff /clang/test/CodeGenObjC/messages-2.m
parent8a3c55567e0ba3323b47abdd88026f19d7e68b60 (diff)
downloadbcm5719-llvm-71309be80a246a2f06842bd32ee53b3d5f007b82.tar.gz
bcm5719-llvm-71309be80a246a2f06842bd32ee53b3d5f007b82.zip
Zero-initialize the struct-return slot of an Objective-C message
send before making the call. Fixes rdar://problem/7854674 llvm-svn: 126543
Diffstat (limited to 'clang/test/CodeGenObjC/messages-2.m')
-rw-r--r--clang/test/CodeGenObjC/messages-2.m23
1 files changed, 22 insertions, 1 deletions
diff --git a/clang/test/CodeGenObjC/messages-2.m b/clang/test/CodeGenObjC/messages-2.m
index 05e30ab131a..5ef2261b198 100644
--- a/clang/test/CodeGenObjC/messages-2.m
+++ b/clang/test/CodeGenObjC/messages-2.m
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NF
+
+// Most of this test is apparently just verifying that we don't crash.
int printf(const char *, ...);
@@ -140,3 +143,21 @@ typedef struct {
return 5;
}
@end
+
+// rdar://problem/7854674
+// CHECK: define void @test0([[A:%.*]]*
+// CHECK-NF: define void @test0([[A:%.*]]*
+void test0(A *a) {
+ // CHECK: alloca [[A]]*
+ // CHECK-NEXT: [[POINT:%.*]] = alloca [[POINT_T:%.*]],
+ // CHECK-NF: alloca [[A]]*
+ // CHECK-NF-NEXT: [[POINT:%.*]] = alloca [[POINT_T:%.*]],
+
+ // CHECK: [[T0:%.*]] = bitcast [[POINT_T]]* [[POINT]] to i8*
+ // CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[T0]], i8 0, i64 48, i32 4, i1 false)
+ // CHECK-NEXT: call {{.*}} @objc_msgSend_stret to
+ // CHECK-NF: [[T0:%.*]] = bitcast [[POINT_T]]* [[POINT]] to i8*
+ // CHECK-NF-NEXT: call void @llvm.memset.p0i8.i64(i8* [[T0]], i8 0, i64 48, i32 4, i1 false)
+ // CHECK-NF-NEXT: call {{.*}} @objc_msgSend_stret to
+ MyPoint point = [a returnAPoint];
+}
OpenPOWER on IntegriCloud