118 lines · cpp
1// FIXME: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - -std=c++11 %s | FileCheck %s2// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-ASSIGN %s3// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-CTOR %s4 5// construct6 7struct E {8 E();9 E(E&&);10};11 12struct F {13 F();14 F(F&&);15};16 17struct G {18 E e;19};20 21struct H : G {22 F l;23 E m;24 F ar[2];25};26 27void f() {28 H s;29 // CHECK: call void @_ZN1HC1EOS_30 H t(static_cast<H&&>(s));31}32 33 34// assign35 36struct A {37 A &operator =(A&&);38};39 40struct B {41 B &operator =(B&&);42};43 44struct C {45 A a;46};47 48struct D : C {49 A a;50 B b;51 A ar[2];52};53 54void g() {55 D d;56 // CHECK: call {{.*}} @_ZN1DaSEOS_57 d = D();58}59 60// PR1082261struct I {62 unsigned var[1];63};64 65// CHECK: define void @_Z1hv() nounwind {66void h() {67 I i;68 // CHECK: call void @llvm.memcpy.69 i = I();70 // CHECK-NEXT: ret void71}72 73// PR1086074struct Empty { };75struct VirtualWithEmptyBase : Empty {76 virtual void f();77};78 79// CHECK: define void @_Z25move_VirtualWithEmptyBaseR20VirtualWithEmptyBaseS0_80void move_VirtualWithEmptyBase(VirtualWithEmptyBase &x, VirtualWithEmptyBase &y) {81 // CHECK: call {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_82 x = static_cast<VirtualWithEmptyBase&&>(y);83 // CHECK-NEXT: ret void84}85 86// move assignment ops87 88// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1DaSEOS_89// CHECK-ASSIGN: call {{.*}} @_ZN1CaSEOS_90// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_91// CHECK-ASSIGN: call {{.*}} @_ZN1BaSEOS_92// array loop93// CHECK-ASSIGN: br i194// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_95 96// VirtualWithEmptyBase move assignment operatpr97// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_98// CHECK-ASSIGN: store99// CHECK-ASSIGN-NEXT: store100// CHECK-ASSIGN-NOT: call101// CHECK-ASSIGN: ret102 103// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1CaSEOS_104// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_105 106// move ctors107 108// CHECK-CTOR: define linkonce_odr {{.*}} @_ZN1HC2EOS_109// CHECK-CTOR: call {{.*}} @_ZN1GC2EOS_110// CHECK-CTOR: call {{.*}} @_ZN1FC1EOS_111// CHECK-CTOR: call {{.*}} @_ZN1EC1EOS_112// array loop113// CHECK-CTOR: call {{.*}} @_ZN1FC1EOS_114// CHECK-CTOR: br i1115 116// CHECK-CTOR: define linkonce_odr {{.*}} @_ZN1GC2EOS_117// CHECK-CTOR: call {{.*}} @_ZN1EC1EOS_118