Home | History | Annotate | Download | only in CodeGenObjCXX
      1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
      2 
      3 class S {
      4 public:
      5 	S& operator = (const S&);
      6 	S (const S&);
      7 	S ();
      8 };
      9 
     10 struct CGRect {
     11 	CGRect & operator = (const CGRect &);
     12 };
     13 
     14 @interface I {
     15   S position;
     16   CGRect bounds;
     17 }
     18 
     19 @property(assign, nonatomic) S position;
     20 @property CGRect bounds;
     21 @property CGRect frame;
     22 - (void)setFrame:(CGRect)frameRect;
     23 - (CGRect)frame;
     24 - (void) initWithOwner;
     25 - (CGRect)extent;
     26 - (void)dealloc;
     27 @end
     28 
     29 @implementation I
     30 @synthesize position;
     31 @synthesize bounds;
     32 @synthesize frame;
     33 
     34 // CHECK: define internal void @"\01-[I setPosition:]"
     35 // CHECK: call nonnull %class.S* @_ZN1SaSERKS_
     36 // CHECK-NEXT: ret void
     37 
     38 - (void)setFrame:(CGRect)frameRect {}
     39 - (CGRect)frame {return bounds;}
     40 
     41 - (void)initWithOwner {
     42   I* _labelLayer;
     43   CGRect labelLayerFrame = self.bounds;
     44   labelLayerFrame = self.bounds;
     45   _labelLayer.frame = labelLayerFrame;
     46 }
     47 
     48 // rdar://8366604
     49 - (void)dealloc
     50   {
     51       CGRect cgrect = self.extent;
     52   }
     53 - (struct CGRect)extent {return bounds;}
     54 
     55 @end
     56 
     57 // CHECK-LABEL: define i32 @main
     58 // CHECK: call void @_ZN1SC1ERKS_(%class.S* [[AGGTMP:%[a-zA-Z0-9\.]+]], %class.S* nonnull {{%[a-zA-Z0-9\.]+}})
     59 // CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %class.S*)*)(i8* {{%[a-zA-Z0-9\.]+}}, i8* {{%[a-zA-Z0-9\.]+}}, %class.S* [[AGGTMP]])
     60 // CHECK-NEXT: ret i32 0
     61 int main() {
     62   I *i;
     63   S s1;
     64   i.position = s1;
     65   return 0;
     66 }
     67 
     68 // rdar://8379892
     69 // CHECK-LABEL: define void @_Z1fP1A
     70 // CHECK: call void @_ZN1XC1Ev(%struct.X* [[LVTEMP:%[a-zA-Z0-9\.]+]])
     71 // CHECK: call void @_ZN1XC1ERKS_(%struct.X* [[AGGTMP:%[a-zA-Z0-9\.]+]], %struct.X* nonnull [[LVTEMP]])
     72 // CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %struct.X*)*)({{.*}} %struct.X* [[AGGTMP]])
     73 struct X {
     74   X();
     75   X(const X&);
     76   ~X();
     77 };
     78 
     79 @interface A {
     80   X xval;
     81 }
     82 - (X)x;
     83 - (void)setX:(X)x;
     84 @end
     85 
     86 void f(A* a) {
     87   a.x = X();
     88 }
     89