1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -disable-llvm-optzns -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. 6 id getObject(); 7 8 // CHECK-LABEL: define internal void @__cxx_global_var_init 9 // CHECK: call i8* @_Z9getObjectv 10 // CHECK-NEXT: call i8* @objc_retainAutoreleasedReturnValue 11 // CHECK-NEXT: {{store i8*.*@global_obj}} 12 // CHECK-NEXT: ret void 13 id global_obj = getObject(); 14 15 // CHECK-LABEL: define internal void @__cxx_global_var_init 16 // CHECK: call i8* @_Z9getObjectv 17 // CHECK-NEXT: call i8* @objc_retainAutoreleasedReturnValue 18 // CHECK-NEXT: {{store i8*.*@global_obj2}} 19 // CHECK-NEXT: ret void 20 id global_obj2 = getObject(); 21 22 // CHECK-LABEL: define internal void @_GLOBAL__sub_I_arc_globals.mm 23 // CHECK: call i8* @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 @objc_autoreleasePoolPop( 27 // CHECK-NEXT: ret void 28