blob: 9a7fdb999ba436135bdbae089156fee147033f5e [file] [log] [blame]
Aaron Ballman674cf262015-05-26 19:44:52 +00001// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s | FileCheck %s
David Majnemer196ac332014-09-11 23:05:02 +00002struct Base {};
3
4// __declspec(dllexport) causes us to export the implicit constructor.
5struct __declspec(dllexport) Derived : virtual Base {
6// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc %struct.Derived* @"\01??0Derived@@QAE@ABU0@@Z"
David Blaikiea953f282015-02-27 21:19:58 +00007// CHECK: %[[this:.*]] = load %struct.Derived*, %struct.Derived** {{.*}}
David Majnemer196ac332014-09-11 23:05:02 +00008// CHECK-NEXT: store %struct.Derived* %[[this]], %struct.Derived** %[[retval:.*]]
David Blaikie218b7832015-02-27 19:18:17 +00009// CHECK: %[[dest_a_gep:.*]] = getelementptr inbounds %struct.Derived, %struct.Derived* %[[this]], i32 0, i32 1
David Blaikiea953f282015-02-27 21:19:58 +000010// CHECK-NEXT: %[[src_load:.*]] = load %struct.Derived*, %struct.Derived** {{.*}}
David Blaikie218b7832015-02-27 19:18:17 +000011// CHECK-NEXT: %[[src_a_gep:.*]] = getelementptr inbounds %struct.Derived, %struct.Derived* %[[src_load:.*]], i32 0, i32 1
David Majnemer196ac332014-09-11 23:05:02 +000012// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %[[dest_a_gep]], i8* %[[src_a_gep]], i64 1, i32 4, i1 false)
David Blaikiea953f282015-02-27 21:19:58 +000013// CHECK-NEXT: %[[dest_this:.*]] = load %struct.Derived*, %struct.Derived** %[[retval]]
David Majnemer196ac332014-09-11 23:05:02 +000014// CHECK-NEXT: ret %struct.Derived* %[[dest_this]]
15 bool a : 1;
16 bool b : 1;
17};
David Majnemer1573d732014-10-15 04:54:54 +000018
19// __declspec(dllexport) causes us to export the implicit copy constructor.
20struct __declspec(dllexport) Derived2 : virtual Base {
21// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc %struct.Derived2* @"\01??0Derived2@@QAE@ABU0@@Z"
David Blaikiea953f282015-02-27 21:19:58 +000022// CHECK: %[[this:.*]] = load %struct.Derived2*, %struct.Derived2** {{.*}}
David Majnemer1573d732014-10-15 04:54:54 +000023// CHECK-NEXT: store %struct.Derived2* %[[this]], %struct.Derived2** %[[retval:.*]]
David Blaikie218b7832015-02-27 19:18:17 +000024// CHECK: %[[dest_a_gep:.*]] = getelementptr inbounds %struct.Derived2, %struct.Derived2* %[[this]], i32 0, i32 1
David Blaikiea953f282015-02-27 21:19:58 +000025// CHECK-NEXT: %[[src_load:.*]] = load %struct.Derived2*, %struct.Derived2** {{.*}}
David Blaikie218b7832015-02-27 19:18:17 +000026// CHECK-NEXT: %[[src_a_gep:.*]] = getelementptr inbounds %struct.Derived2, %struct.Derived2* %[[src_load:.*]], i32 0, i32 1
David Majnemer1573d732014-10-15 04:54:54 +000027// CHECK-NEXT: %[[dest_a_bitcast:.*]] = bitcast [1 x i32]* %[[dest_a_gep]] to i8*
28// CHECK-NEXT: %[[src_a_bitcast:.*]] = bitcast [1 x i32]* %[[src_a_gep]] to i8*
29// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %[[dest_a_bitcast]], i8* %[[src_a_bitcast]], i32 4, i32 4, i1 false)
David Blaikiea953f282015-02-27 21:19:58 +000030// CHECK-NEXT: %[[dest_this:.*]] = load %struct.Derived2*, %struct.Derived2** %[[retval]]
David Majnemer1573d732014-10-15 04:54:54 +000031// CHECK-NEXT: ret %struct.Derived2* %[[dest_this]]
32 int Array[1];
33};