xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/property-object-conditional-exp.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambucstruct CGRect {
4*f4a2713aSLionel Sambuc  char* origin;
5*f4a2713aSLionel Sambuc  unsigned size;
6*f4a2713aSLionel Sambuc};
7*f4a2713aSLionel Sambuctypedef struct CGRect CGRect;
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambucextern "C" bool CGRectIsEmpty(CGRect);
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel Sambuc@interface Foo {
12*f4a2713aSLionel Sambuc  CGRect out;
13*f4a2713aSLionel Sambuc}
14*f4a2713aSLionel Sambuc@property CGRect bounds;
15*f4a2713aSLionel Sambuc- (CGRect) out;
16*f4a2713aSLionel Sambuc@end
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc@implementation Foo
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc- (void)bar {
22*f4a2713aSLionel Sambuc    CGRect dataRect;
23*f4a2713aSLionel Sambuc    CGRect virtualBounds;
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambuc// CHECK: [[SRC:%.*]] = call { i8*, i32 } bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
26*f4a2713aSLionel Sambuc// CHECK-NEXT: bitcast
27*f4a2713aSLionel Sambuc// CHECK-NEXT:getelementptr { i8*, i32 }* [[SRC:%.*]]
28*f4a2713aSLionel Sambuc// CHECK-NEXT:extractvalue
29*f4a2713aSLionel Sambuc// CHECK-NEXT:store
30*f4a2713aSLionel Sambuc// CHECK-NEXT:getelementptr { i8*, i32 }* [[SRC:%.*]]
31*f4a2713aSLionel Sambuc// CHECK-NEXT:extractvalue
32*f4a2713aSLionel Sambuc// CHECK-NEXT:store
33*f4a2713aSLionel Sambuc  dataRect = CGRectIsEmpty(virtualBounds) ? self.bounds : virtualBounds;
34*f4a2713aSLionel Sambuc  dataRect = CGRectIsEmpty(virtualBounds) ? [self bounds] : virtualBounds;
35*f4a2713aSLionel Sambuc  dataRect = CGRectIsEmpty(virtualBounds) ? virtualBounds : self.bounds;
36*f4a2713aSLionel Sambuc
37*f4a2713aSLionel Sambuc  dataRect = CGRectIsEmpty(virtualBounds) ? self.out : virtualBounds;
38*f4a2713aSLionel Sambuc  dataRect = CGRectIsEmpty(virtualBounds) ? [self out] : virtualBounds;
39*f4a2713aSLionel Sambuc  dataRect = CGRectIsEmpty(virtualBounds) ? virtualBounds : self.out;
40*f4a2713aSLionel Sambuc}
41*f4a2713aSLionel Sambuc
42*f4a2713aSLionel Sambuc@dynamic bounds;
43*f4a2713aSLionel Sambuc- (CGRect) out { return out; }
44*f4a2713aSLionel Sambuc@end
45