blob: e64b397cc026a5dee3854225ddc21f71348439f4 [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s
Fariborz Jahanian0339d722010-09-10 18:56:35 +00002// rdar://8409336
3
4struct TFENode {
5void GetURL() const;
6};
7
8@interface TNodeIconAndNameCell
9- (const TFENode&) node;
10@end
11
12@implementation TNodeIconAndNameCell
13- (const TFENode&) node {
Fariborz Jahanianbf1f8262011-02-28 21:19:34 +000014// CHECK: call %struct.TFENode* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
Fariborz Jahanian0339d722010-09-10 18:56:35 +000015// CHECK-NEXT: call void @_ZNK7TFENode6GetURLEv(%struct.TFENode* %{{.*}})
16 self.node.GetURL();
17} // expected-warning {{control reaches end of non-void function}}
18@end
Fariborz Jahaniandc5ea092010-09-18 20:47:25 +000019
20// rdar://8437240
21struct X {
22 int x;
23};
24
25void f0(const X &parent);
26@interface A
27- (const X&) target;
28@end
29void f1(A *a) {
Fariborz Jahanianbf1f8262011-02-28 21:19:34 +000030// CHECK: [[PRP:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
Fariborz Jahaniandc5ea092010-09-18 20:47:25 +000031// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* [[PRP]])
32 f0(a.target);
33
Fariborz Jahanianbf1f8262011-02-28 21:19:34 +000034// CHECK: [[MSG:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
Fariborz Jahaniandc5ea092010-09-18 20:47:25 +000035// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* [[MSG]])
36 f0([a target]);
37}
38
John McCallf6a16482010-12-04 03:47:34 +000039@interface Test2
40@property (readonly) int myProperty;
41- (int) myProperty;
42- (double) myGetter;
43@end
44void test2() {
45 Test2 *obj;
46 (void) obj.myProperty;
47 (void) obj.myGetter;
48 static_cast<void>(obj.myProperty);
49 static_cast<void>(obj.myGetter);
50 void(obj.myProperty);
51 void(obj.myGetter);
52}
53// CHECK: define void @_Z5test2v()
54// CHECK: call i32 bitcast
55// CHECK: call double bitcast
56// CHECK: call i32 bitcast
57// CHECK: call double bitcast
58// CHECK: call i32 bitcast
59// CHECK: call double bitcast
John McCalld50187d2010-12-07 22:55:51 +000060
61// PR8751
62int test3(Test2 *obj) { return obj.myProperty; }