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