xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/property-dot-reference.mm (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s
2f4a2713aSLionel Sambuc// rdar://8409336
3f4a2713aSLionel Sambuc
4f4a2713aSLionel Sambucstruct TFENode {
5f4a2713aSLionel Sambucvoid GetURL() const;
6f4a2713aSLionel Sambuc};
7f4a2713aSLionel Sambuc
8f4a2713aSLionel Sambuc@interface TNodeIconAndNameCell
9f4a2713aSLionel Sambuc- (const TFENode&) node;
10f4a2713aSLionel Sambuc@end
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambuc@implementation TNodeIconAndNameCell
13f4a2713aSLionel Sambuc- (const TFENode&) node {
14*0a6a1f1dSLionel Sambuc// CHECK: call dereferenceable({{[0-9]+}}) %struct.TFENode* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
15f4a2713aSLionel Sambuc// CHECK-NEXT: call void @_ZNK7TFENode6GetURLEv(%struct.TFENode* %{{.*}})
16f4a2713aSLionel Sambuc	self.node.GetURL();
17f4a2713aSLionel Sambuc}	// expected-warning {{control reaches end of non-void function}}
18f4a2713aSLionel Sambuc@end
19f4a2713aSLionel Sambuc
20f4a2713aSLionel Sambuc// rdar://8437240
21f4a2713aSLionel Sambucstruct X {
22f4a2713aSLionel Sambuc  int x;
23f4a2713aSLionel Sambuc};
24f4a2713aSLionel Sambuc
25f4a2713aSLionel Sambucvoid f0(const X &parent);
26f4a2713aSLionel Sambuc@interface A
27f4a2713aSLionel Sambuc- (const X&) target;
28f4a2713aSLionel Sambuc@end
29f4a2713aSLionel Sambucvoid f1(A *a) {
30*0a6a1f1dSLionel Sambuc// CHECK: [[PRP:%.*]] = call dereferenceable({{[0-9]+}}) %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
31*0a6a1f1dSLionel Sambuc// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* dereferenceable({{[0-9]+}}) [[PRP]])
32f4a2713aSLionel Sambuc  f0(a.target);
33f4a2713aSLionel Sambuc
34*0a6a1f1dSLionel Sambuc// CHECK: [[MSG:%.*]] = call dereferenceable({{[0-9]+}}) %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
35*0a6a1f1dSLionel Sambuc// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* dereferenceable({{[0-9]+}}) [[MSG]])
36f4a2713aSLionel Sambuc  f0([a target]);
37f4a2713aSLionel Sambuc}
38f4a2713aSLionel Sambuc
39f4a2713aSLionel Sambuc@interface Test2
40f4a2713aSLionel Sambuc@property (readonly) int myProperty;
41f4a2713aSLionel Sambuc- (int) myProperty;
42f4a2713aSLionel Sambuc- (double) myGetter;
43f4a2713aSLionel Sambuc@end
44f4a2713aSLionel Sambucvoid test2() {
45f4a2713aSLionel Sambuc    Test2 *obj;
46f4a2713aSLionel Sambuc    (void) obj.myProperty;
47f4a2713aSLionel Sambuc    (void) obj.myGetter;
48f4a2713aSLionel Sambuc    static_cast<void>(obj.myProperty);
49f4a2713aSLionel Sambuc    static_cast<void>(obj.myGetter);
50f4a2713aSLionel Sambuc    void(obj.myProperty);
51f4a2713aSLionel Sambuc    void(obj.myGetter);
52f4a2713aSLionel Sambuc}
53f4a2713aSLionel Sambuc// CHECK-LABEL: define void @_Z5test2v()
54f4a2713aSLionel Sambuc// CHECK: call i32 bitcast
55f4a2713aSLionel Sambuc// CHECK: call double bitcast
56f4a2713aSLionel Sambuc// CHECK: call i32 bitcast
57f4a2713aSLionel Sambuc// CHECK: call double bitcast
58f4a2713aSLionel Sambuc// CHECK: call i32 bitcast
59f4a2713aSLionel Sambuc// CHECK: call double bitcast
60f4a2713aSLionel Sambuc
61f4a2713aSLionel Sambuc// PR8751
62f4a2713aSLionel Sambucint test3(Test2 *obj) { return obj.myProperty; }
63