1 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -disable-llvm-passes -o - %s | FileCheck %s
3 // Test that we're properly retaining lifetime-qualified pointers
4 // initialized statically and wrapping up those initialization in an
8 // CHECK-LABEL: define internal void @__cxx_global_var_init
9 // CHECK: call noundef i8* @_Z9getObjectv{{.*}} [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
10 // CHECK-NEXT: call void (...) @llvm.objc.clang.arc.noop.use
11 // CHECK-NEXT: {{store i8*.*@global_obj}}
12 // CHECK-NEXT: ret void
13 id global_obj = getObject();
15 // CHECK-LABEL: define internal void @__cxx_global_var_init
16 // CHECK: call noundef i8* @_Z9getObjectv{{.*}} [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
17 // CHECK-NEXT: call void (...) @llvm.objc.clang.arc.noop.use
18 // CHECK-NEXT: {{store i8*.*@global_obj2}}
19 // CHECK-NEXT: ret void
20 id global_obj2 = getObject();
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