xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/property-object-reference-2.mm (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-10.7 -emit-llvm -o - | FileCheck %s
2f4a2713aSLionel Sambuc// RUN: %clang_cc1 %s -triple x86_64-unknown-freebsd -fobjc-runtime=gnustep-1.7 -emit-llvm -o - | FileCheck -check-prefix=CHECK-GNUSTEP %s
3f4a2713aSLionel Sambuc// rdar://6137845
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambucextern int DEFAULT();
6f4a2713aSLionel Sambuc
7f4a2713aSLionel Sambucstruct TCPPObject
8f4a2713aSLionel Sambuc{
9f4a2713aSLionel Sambuc TCPPObject();
10f4a2713aSLionel Sambuc ~TCPPObject();
11f4a2713aSLionel Sambuc TCPPObject(const TCPPObject& inObj, int i = DEFAULT());
12f4a2713aSLionel Sambuc TCPPObject& operator=(const TCPPObject& inObj);
13f4a2713aSLionel Sambuc int filler[64];
14f4a2713aSLionel Sambuc};
15f4a2713aSLionel Sambuc
16f4a2713aSLionel Sambuc
17f4a2713aSLionel Sambuc@interface MyDocument
18f4a2713aSLionel Sambuc{
19f4a2713aSLionel Sambuc@private
20f4a2713aSLionel Sambuc TCPPObject _cppObject;
21f4a2713aSLionel Sambuc TCPPObject _cppObject1;
22f4a2713aSLionel Sambuc}
23f4a2713aSLionel Sambuc@property (assign, readwrite, atomic) const TCPPObject MyProperty;
24f4a2713aSLionel Sambuc@property (assign, readwrite, atomic) const TCPPObject MyProperty1;
25f4a2713aSLionel Sambuc@end
26f4a2713aSLionel Sambuc
27f4a2713aSLionel Sambuc@implementation MyDocument
28f4a2713aSLionel Sambuc  @synthesize MyProperty = _cppObject;
29f4a2713aSLionel Sambuc  @synthesize MyProperty1 = _cppObject1;
30f4a2713aSLionel Sambuc@end
31f4a2713aSLionel Sambuc
32f4a2713aSLionel Sambuc// CHECK-LABEL: define internal void @__copy_helper_atomic_property_(
33f4a2713aSLionel Sambuc// CHECK: [[TWO:%.*]] = load %struct.TCPPObject** [[ADDR:%.*]], align 8
34f4a2713aSLionel Sambuc// CHECK: [[THREE:%.*]] = load %struct.TCPPObject** [[ADDR1:%.*]], align 8
35f4a2713aSLionel Sambuc// CHECK: [[CALL:%.*]] = call i32 @_Z7DEFAULTv()
36*0a6a1f1dSLionel Sambuc// CHECK:  call void @_ZN10TCPPObjectC1ERKS_i(%struct.TCPPObject* [[TWO]], %struct.TCPPObject* dereferenceable({{[0-9]+}}) [[THREE]], i32 [[CALL]])
37f4a2713aSLionel Sambuc// CHECK:  ret void
38f4a2713aSLionel Sambuc
39f4a2713aSLionel Sambuc// CHECK: define internal void @"\01-[MyDocument MyProperty]"(
40f4a2713aSLionel Sambuc// CHECK: [[ONE:%.*]] = bitcast i8* [[ADDPTR:%.*]] to %struct.TCPPObject*
41f4a2713aSLionel Sambuc// CHECK: [[TWO:%.*]] = bitcast %struct.TCPPObject* [[ONE]] to i8*
42f4a2713aSLionel Sambuc// CHECK: [[THREE:%.*]] = bitcast %struct.TCPPObject* [[AGGRESULT:%.*]] to i8*
43f4a2713aSLionel Sambuc// CHECK: call void @objc_copyCppObjectAtomic(i8* [[THREE]], i8* [[TWO]], i8* bitcast (void (%struct.TCPPObject*, %struct.TCPPObject*)* @__copy_helper_atomic_property_ to i8*))
44f4a2713aSLionel Sambuc// CHECK: ret void
45f4a2713aSLionel Sambuc
46f4a2713aSLionel Sambuc// CHECK-LABEL: define internal void @__assign_helper_atomic_property_(
47f4a2713aSLionel Sambuc// CHECK: [[TWO:%.*]] = load %struct.TCPPObject** [[ADDR:%.*]], align 8
48f4a2713aSLionel Sambuc// CHECK: [[THREE:%.*]] = load %struct.TCPPObject** [[ADDR1:%.*]], align 8
49*0a6a1f1dSLionel Sambuc// CHECK: [[CALL:%.*]] = call dereferenceable({{[0-9]+}}) %struct.TCPPObject* @_ZN10TCPPObjectaSERKS_(%struct.TCPPObject* [[TWO]], %struct.TCPPObject* dereferenceable({{[0-9]+}}) [[THREE]])
50f4a2713aSLionel Sambuc// CHECK:  ret void
51f4a2713aSLionel Sambuc
52f4a2713aSLionel Sambuc// CHECK: define internal void @"\01-[MyDocument setMyProperty:]"(
53f4a2713aSLionel Sambuc// CHECK: [[ONE:%.*]] = bitcast i8* [[ADDRPTR:%.*]] to %struct.TCPPObject*
54f4a2713aSLionel Sambuc// CHECK: [[TWO:%.*]] = bitcast %struct.TCPPObject* [[ONE]] to i8*
55f4a2713aSLionel Sambuc// CHECK: [[THREE:%.*]] = bitcast %struct.TCPPObject* [[MYPROPERTY:%.*]] to i8*
56f4a2713aSLionel Sambuc// CHECK: call void @objc_copyCppObjectAtomic(i8* [[TWO]], i8* [[THREE]], i8* bitcast (void (%struct.TCPPObject*, %struct.TCPPObject*)* @__assign_helper_atomic_property_ to i8*))
57f4a2713aSLionel Sambuc// CHECK: ret void
58f4a2713aSLionel Sambuc
59f4a2713aSLionel Sambuc// CHECK-GNUSTEP: objc_getCppObjectAtomic
60f4a2713aSLionel Sambuc// CHECK-GNUSTEP: objc_setCppObjectAtomic
61