1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -disable-llvm-passes -o - %s | FileCheck %s 2 3// Test that we're properly retaining lifetime-qualified pointers 4// initialized statically and wrapping up those initialization in an 5// autorelease pool. 6id getObject(); 7 8// CHECK-LABEL: define internal void @__cxx_global_var_init 9// CHECK: call i8* @_Z9getObjectv 10// CHECK-NEXT: call i8* @llvm.objc.retainAutoreleasedReturnValue 11// CHECK-NEXT: {{store i8*.*@global_obj}} 12// CHECK-NEXT: ret void 13id global_obj = getObject(); 14 15// CHECK-LABEL: define internal void @__cxx_global_var_init 16// CHECK: call i8* @_Z9getObjectv 17// CHECK-NEXT: call i8* @llvm.objc.retainAutoreleasedReturnValue 18// CHECK-NEXT: {{store i8*.*@global_obj2}} 19// CHECK-NEXT: ret void 20id global_obj2 = getObject(); 21 22// CHECK-LABEL: define internal void @_GLOBAL__sub_I_arc_globals.mm 23// CHECK: call i8* @llvm.objc.autoreleasePoolPush() 24// CHECK-NEXT: call void @__cxx_global_var_init 25// CHECK-NEXT: call void @__cxx_global_var_init.1 26// CHECK-NEXT: call void @llvm.objc.autoreleasePoolPop( 27// CHECK-NEXT: ret void 28