xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/property-object-reference.mm (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - | FileCheck %s
2f4a2713aSLionel Sambuc// rdar://10188258
3f4a2713aSLionel Sambuc
4f4a2713aSLionel Sambucstruct Foo {int i;};
5f4a2713aSLionel Sambucstatic Foo gFoo;
6f4a2713aSLionel Sambuc
7f4a2713aSLionel Sambuc
8f4a2713aSLionel Sambuc@interface ObjCTest  { }
9f4a2713aSLionel Sambuc@property (nonatomic, readonly) Foo& FooRefProperty;
10f4a2713aSLionel Sambuc@property (nonatomic) Foo  FooProperty;
11f4a2713aSLionel Sambuc- (Foo &) FooProperty;
12f4a2713aSLionel Sambuc- (void)setFooProperty : (Foo &) arg;
13f4a2713aSLionel Sambuc@end
14f4a2713aSLionel Sambuc
15f4a2713aSLionel Sambuc
16f4a2713aSLionel Sambuc@implementation ObjCTest
17f4a2713aSLionel Sambuc@dynamic FooRefProperty;
18f4a2713aSLionel Sambuc
19f4a2713aSLionel Sambuc-(void) test {
20f4a2713aSLionel Sambuc    Foo& f = self.FooRefProperty;
21f4a2713aSLionel Sambuc    Foo& f1 = self.FooProperty;
22f4a2713aSLionel Sambuc}
23f4a2713aSLionel Sambuc- (Foo &) FooProperty { return gFoo; }
24f4a2713aSLionel Sambuc- (void)setFooProperty : (Foo &) arg {  };
25f4a2713aSLionel Sambuc@end
26f4a2713aSLionel Sambuc
27f4a2713aSLionel Sambuc// CHECK: [[T0:%.*]] = load {{%.*}} [[S0:%.*]]
28*0a6a1f1dSLionel Sambuc// CHECK: load i8** @OBJC_SELECTOR_REFERENCES_
29f4a2713aSLionel Sambuc// CHECK:  [[T2:%.*]]  = bitcast {{%.*}} [[T0]] to i8*
30f4a2713aSLionel Sambuc// CHECK:  @objc_msgSend
31f4a2713aSLionel Sambuc// CHECK: [[R0:%.*]] = load {{%.*}} [[U0:%.*]]
32*0a6a1f1dSLionel Sambuc// CHECK: load i8** @OBJC_SELECTOR_REFERENCES_
33f4a2713aSLionel Sambuc// CHECK:  [[R2:%.*]]  = bitcast {{%.*}} [[R0]] to i8*
34f4a2713aSLionel Sambuc// CHECK:  @objc_msgSend
35f4a2713aSLionel Sambuc
36