diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-01-28 18:46:31 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-01-28 18:46:31 +0000 |
commit | 326efeb95a3a64c9f20229dd769ff6ff8ac1ac5d (patch) | |
tree | 5a8b5a99bfaa65acd22d636311d08309f0b3f61d /clang/test/CodeGenObjC/arc.m | |
parent | 1412816686bd4a7b9d7fe72b14c5c4e62d8d4062 (diff) | |
download | bcm5719-llvm-326efeb95a3a64c9f20229dd769ff6ff8ac1ac5d.tar.gz bcm5719-llvm-326efeb95a3a64c9f20229dd769ff6ff8ac1ac5d.zip |
objc-arc: Perform null check on receiver before sending methods which
consume one or more of their arguments. If not done, this will cause a leak
as method will not consume the argument when receiver is null.
// rdar://10444474
llvm-svn: 149184
Diffstat (limited to 'clang/test/CodeGenObjC/arc.m')
-rw-r--r-- | clang/test/CodeGenObjC/arc.m | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/test/CodeGenObjC/arc.m b/clang/test/CodeGenObjC/arc.m index 492c1b89da1..8fd1a91cd7d 100644 --- a/clang/test/CodeGenObjC/arc.m +++ b/clang/test/CodeGenObjC/arc.m @@ -1500,12 +1500,16 @@ void test66(void) { // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST66]]* [[T0]] to i8* // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST66]]* -// CHECK-NEXT: [[T4:%.*]] = call i8* @test66_arg() +// CHECK-NEXT: [[THREE:%.*]] = icmp eq [[TEST23:%.*]]* [[T3]], null +// CHECK-NEXT: br i1 [[THREE]], label [[NULINIT:%.*]], label [[MSGCALL:%.*]] +// CHECK: [[T4:%.*]] = call i8* @test66_arg() // CHECK-NEXT: [[T5:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T4]]) // CHECK-NEXT: [[T6:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES // CHECK-NEXT: [[T7:%.*]] = bitcast [[TEST66]]* [[T3]] to i8* // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*)*)(i8* [[T7]], i8* [[T6]], i8* [[T5]]) -// CHECK-NEXT: [[T8:%.*]] = bitcast [[TEST66]]* [[T3]] to i8* +// CHECK-NEXT: br label [[MSGCONT:%.*]] +// CHECK: br label [[MSGCONT:%.*]] +// CHECK: [[T8:%.*]] = bitcast [[TEST66]]* [[T3]] to i8* // CHECK-NEXT: call void @objc_release(i8* [[T8]]) // CHECK-NEXT: ret void |