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