1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fobjc-arc -fblocks -emit-llvm %s -o - | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuctypedef void (^block_t)(void); 4*f4a2713aSLionel Sambucvoid use_block(block_t); 5*f4a2713aSLionel Sambucvoid use_int(int); 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc// rdar://problem/10211676 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambucvoid test0(int i) { 10*f4a2713aSLionel Sambuc block_t block = ^{ use_int(i); }; 11*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @test0( 12*f4a2713aSLionel Sambuc // CHECK: call i8* @objc_retainBlock(i8* {{%.*}}) [[NUW:#[0-9]+]], !clang.arc.copy_on_escape 13*f4a2713aSLionel Sambuc // CHECK: ret void 14*f4a2713aSLionel Sambuc} 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambucvoid test1(int i) { 17*f4a2713aSLionel Sambuc id block = ^{ use_int(i); }; 18*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @test1( 19*f4a2713aSLionel Sambuc // CHECK: call i8* @objc_retainBlock(i8* {{%.*}}) [[NUW]] 20*f4a2713aSLionel Sambuc // CHECK-NOT: !clang.arc.copy_on_escape 21*f4a2713aSLionel Sambuc // CHECK: ret void 22*f4a2713aSLionel Sambuc} 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc// CHECK: attributes [[NUW]] = { nounwind } 25