blob: 1f91945b4a9f76c3fde96516122606e53de39cfb [file] [log] [blame]
Douglas Gregor528499b2011-09-01 02:09:07 +00001// RUN: %clang_cc1 -emit-llvm -o - -std=c++0x %s | FileCheck -check-prefix=CHECK-ASSIGN %s
2// RUN: %clang_cc1 -emit-llvm -o - -std=c++0x %s | FileCheck -check-prefix=CHECK-CTOR %s
Sebastian Redl22653ba2011-08-30 19:58:05 +00003
4// construct
5
6struct E {
7 E();
8 E(E&&);
9};
10
11struct F {
12 F();
13 F(F&&);
14};
15
16struct G {
17 E e;
18};
19
20struct H : G {
21 F l;
22 E m;
23 F ar[2];
24};
25
26void f() {
27 H s;
28 // CHECK: call void @_ZN1HC1EOS_
29 H t(static_cast<H&&>(s));
30}
31
32
33// assign
34
35struct A {
36 A &operator =(A&&);
37};
38
39struct B {
40 B &operator =(B&&);
41};
42
43struct C {
44 A a;
45};
46
47struct D : C {
48 A a;
49 B b;
50 A ar[2];
51};
52
53void g() {
54 D d;
55 // CHECK: call {{.*}} @_ZN1DaSEOS_
56 d = D();
57}
58
Douglas Gregor528499b2011-09-01 02:09:07 +000059// PR10822
60struct I {
61 unsigned var[1];
62};
63
64void h() {
65 I i;
66 i = I();
67}
Sebastian Redl22653ba2011-08-30 19:58:05 +000068
69// move assignment ops
70
Douglas Gregor528499b2011-09-01 02:09:07 +000071// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1DaSEOS_
72// CHECK-ASSIGN: call {{.*}} @_ZN1CaSEOS_
73// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
74// CHECK-ASSIGN: call {{.*}} @_ZN1BaSEOS_
Sebastian Redl22653ba2011-08-30 19:58:05 +000075// array loop
Douglas Gregor528499b2011-09-01 02:09:07 +000076// CHECK-ASSIGN: br i1
77// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
Sebastian Redl22653ba2011-08-30 19:58:05 +000078
Douglas Gregor528499b2011-09-01 02:09:07 +000079// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1IaSEOS_
80// call void @llvm.memcpy.
Sebastian Redl22653ba2011-08-30 19:58:05 +000081
Douglas Gregor528499b2011-09-01 02:09:07 +000082// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1CaSEOS_
83// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
Sebastian Redl22653ba2011-08-30 19:58:05 +000084
85// move ctors
86
Douglas Gregor528499b2011-09-01 02:09:07 +000087// CHECK-CTOR: define linkonce_odr void @_ZN1HC2EOS_
88// CHECK-CTOR: call void @_ZN1GC2EOS_
89// CHECK-CTOR: call void @_ZN1FC1EOS_
90// CHECK-CTOR: call void @_ZN1EC1EOS_
Sebastian Redl22653ba2011-08-30 19:58:05 +000091// array loop
Douglas Gregor528499b2011-09-01 02:09:07 +000092// CHECK-CTOR: br i1
93// CHECK-CTOR: call void @_ZN1FC1EOS_
Sebastian Redl22653ba2011-08-30 19:58:05 +000094
Douglas Gregor528499b2011-09-01 02:09:07 +000095// CHECK-CTOR: define linkonce_odr void @_ZN1GC2EOS_
96// CHECK-CTOR: call void @_ZN1EC1EOS_