1 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s
4 @interface WeakPropertyTest {
7 @property () __weak id PROP;
10 @implementation WeakPropertyTest
14 // CHECK: define internal i8* @"\01-[WeakPropertyTest PROP]"
15 // CHECK: [[SELF:%.*]] = alloca [[WPT:%.*]]*,
16 // CHECK-NEXT: [[CMD:%.*]] = alloca i8*,
17 // CHECK-NEXT: store [[WPT]]* {{%.*}}, [[WPT]]** [[SELF]]
18 // CHECK-NEXT: store i8* {{%.*}}, i8** [[CMD]]
19 // CHECK-NEXT: [[T0:%.*]] = load [[WPT]]*, [[WPT]]** [[SELF]]
20 // CHECK-NEXT: [[T1:%.*]] = load i64, i64* @"OBJC_IVAR_$_WeakPropertyTest.PROP"
21 // CHECK-NEXT: [[T2:%.*]] = bitcast [[WPT]]* [[T0]] to i8*
22 // CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8, i8* [[T2]], i64 [[T1]]
23 // CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i8**
24 // CHECK-NEXT: [[T5:%.*]] = call i8* @llvm.objc.loadWeakRetained(i8** [[T4]])
25 // CHECK-NEXT: [[T6:%.*]] = tail call i8* @llvm.objc.autoreleaseReturnValue(i8* [[T5]])
26 // CHECK-NEXT: ret i8* [[T6]]
28 // CHECK: define internal void @"\01-[WeakPropertyTest setPROP:]"
29 // CHECK: [[SELF:%.*]] = alloca [[WPT:%.*]]*,
30 // CHECK-NEXT: [[CMD:%.*]] = alloca i8*,
31 // CHECK-NEXT: [[PROP:%.*]] = alloca i8*,
32 // CHECK-NEXT: store [[WPT]]* {{%.*}}, [[WPT]]** [[SELF]]
33 // CHECK-NEXT: store i8* {{%.*}}, i8** [[CMD]]
34 // CHECK-NEXT: store i8* {{%.*}}, i8** [[PROP]]
35 // CHECK-NEXT: [[V:%.*]] = load i8*, i8** [[PROP]]
36 // CHECK-NEXT: [[T0:%.*]] = load [[WPT]]*, [[WPT]]** [[SELF]]
37 // CHECK-NEXT: [[T1:%.*]] = load i64, i64* @"OBJC_IVAR_$_WeakPropertyTest.PROP"
38 // CHECK-NEXT: [[T2:%.*]] = bitcast [[WPT]]* [[T0]] to i8*
39 // CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8, i8* [[T2]], i64 [[T1]]
40 // CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i8**
41 // CHECK-NEXT: call i8* @llvm.objc.storeWeak(i8** [[T4]], i8* [[V]])
42 // CHECK-NEXT: ret void
44 // CHECK: define internal void @"\01-[WeakPropertyTest .cxx_destruct]"
45 // CHECK: [[SELF:%.*]] = alloca [[WPT:%.*]]*,
46 // CHECK-NEXT: [[CMD:%.*]] = alloca i8*,
47 // CHECK-NEXT: store [[WPT]]* {{%.*}}, [[WPT]]** [[SELF]]
48 // CHECK-NEXT: store i8* {{%.*}}, i8** [[CMD]]
49 // CHECK-NEXT: [[T0:%.*]] = load [[WPT]]*, [[WPT]]** [[SELF]]
50 // CHECK-NEXT: [[T1:%.*]] = load i64, i64* @"OBJC_IVAR_$_WeakPropertyTest.PROP"
51 // CHECK-NEXT: [[T2:%.*]] = bitcast [[WPT]]* [[T0]] to i8*
52 // CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8, i8* [[T2]], i64 [[T1]]
53 // CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i8**
54 // CHECK-NEXT: call void @llvm.objc.destroyWeak(i8** [[T4]])
55 // CHECK-NEXT: ret void