summaryrefslogtreecommitdiff
path: root/clang/test/CodeGenObjCXX/implicit-copy-constructor.mm
diff options
context:
space:
mode:
authorZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
committerZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
commit222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch)
tree7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/CodeGenObjCXX/implicit-copy-constructor.mm
parent3d206f03985b50beacae843d880bccdc91a9f424 (diff)
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/CodeGenObjCXX/implicit-copy-constructor.mm')
-rw-r--r--clang/test/CodeGenObjCXX/implicit-copy-constructor.mm73
1 files changed, 73 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjCXX/implicit-copy-constructor.mm b/clang/test/CodeGenObjCXX/implicit-copy-constructor.mm
new file mode 100644
index 0000000..63dd4f0
--- /dev/null
+++ b/clang/test/CodeGenObjCXX/implicit-copy-constructor.mm
@@ -0,0 +1,73 @@
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s
+
+struct A {
+ A();
+ A(const A&);
+ A(A&);
+ ~A();
+};
+
+struct B {
+ B();
+ B(B&);
+};
+
+struct C {
+ C() {}
+ C(C& other, A a = A());
+ int i, j;
+};
+
+struct POD {
+ id myobjc;
+ int array[3][4];
+};
+
+struct D : A, B, virtual C {
+ D();
+ int scalar;
+ int scalar_array[2][3];
+ B class_member;
+ C class_member_array[2][3];
+ POD pod_array[2][3];
+
+ union {
+ int x;
+ float f[3];
+ };
+};
+
+void f(D d) {
+ D d2(d);
+}
+
+// CHECK: define linkonce_odr void @_ZN1DC1ERS_(%struct.D* %this, %struct.D*) unnamed_addr
+// CHECK: call void @_ZN1AC1Ev
+// CHECK: call void @_ZN1CC2ERS_1A
+// CHECK: call void @_ZN1AD1Ev
+// CHECK: call void @_ZN1AC2ERS_
+// CHECK: call void @_ZN1BC2ERS_
+// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 24}}
+// CHECK: call void @_ZN1BC1ERS_
+// CHECK: br
+// CHECK: {{icmp ult.*, 2}}
+// CHECK: {{icmp ult.*, 3}}
+// CHECK: call void @_ZN1AC1Ev
+// CHECK: call void @_ZN1CC1ERS_1A
+// CHECK: call void @_ZN1AD1Ev
+// CHECK: {{call.*@objc_memmove_collectable}}
+// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 12}}
+// CHECK: ret void
+
+
+template<class T> struct X0 { void f0(T * ) { } };
+template <class > struct X1 { X1( X1& , int = 0 ) { } };
+struct X2 { X1<int> result; };
+void test_X2()
+{
+ typedef X2 impl;
+ typedef X0<impl> pimpl;
+ impl* i;
+ pimpl pdata;
+ pdata.f0( new impl(*i));
+}