Home | History | Annotate | Download | only in CodeGenObjCXX
      1 // RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s
      2 
      3 struct A { 
      4   A();
      5   A(const A&);
      6   A(A&);
      7   ~A();
      8 };
      9 
     10 struct B {
     11   B();
     12   B(B&);
     13 };
     14 
     15 struct C {
     16   C() {}
     17   C(C& other, A a = A());
     18   int i, j;
     19 };
     20 
     21 struct POD {
     22   id myobjc;
     23   int array[3][4];
     24 };
     25 
     26 struct D : A, B, virtual C { 
     27   D();
     28   int scalar;
     29   int scalar_array[2][3];
     30   B class_member;
     31   C class_member_array[2][3];
     32   POD pod_array[2][3];
     33 
     34   union {
     35     int x;
     36     float f[3];
     37   };
     38 };
     39 
     40 void f(D d) {
     41   D d2(d);
     42 }
     43 
     44 // CHECK-LABEL: define linkonce_odr void @_ZN1DC1ERS_(%struct.D* %this, %struct.D* dereferenceable({{[0-9]+}})) unnamed_addr
     45 // CHECK: call void @_ZN1AC1Ev
     46 // CHECK: call void @_ZN1CC2ERS_1A
     47 // CHECK: call void @_ZN1AD1Ev
     48 // CHECK: call void @_ZN1AC2ERS_
     49 // CHECK: call void @_ZN1BC2ERS_
     50 // CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 24}}
     51 // CHECK: call void @_ZN1BC1ERS_
     52 // CHECK: br
     53 // CHECK: {{icmp ult.*, 2}}
     54 // CHECK: {{icmp ult.*, 3}}
     55 // CHECK: call void @_ZN1AC1Ev
     56 // CHECK: call void @_ZN1CC1ERS_1A
     57 // CHECK: call void @_ZN1AD1Ev
     58 // CHECK: {{call.*@objc_memmove_collectable}}
     59 // CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 12}}
     60 // CHECK: ret void
     61 
     62 
     63 template<class T> struct X0 { void f0(T * ) { } };
     64 template <class > struct X1 { X1( X1& , int = 0 ) { } };
     65 struct X2 { X1<int> result; };
     66 void test_X2()
     67 {
     68   typedef X2 impl;
     69   typedef X0<impl> pimpl;
     70   impl* i;
     71   pimpl pdata;
     72   pdata.f0( new impl(*i));
     73 }
     74