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