From 326efeb95a3a64c9f20229dd769ff6ff8ac1ac5d Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Sat, 28 Jan 2012 18:46:31 +0000 Subject: 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 --- clang/test/CodeGenObjC/arc.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'clang/test/CodeGenObjC/arc.m') 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 -- cgit v1.2.3