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