blob: f8d6f4acd7c81069c287935a455a87c5a105ff27 [file] [log] [blame]
Stephen Hines176edba2014-12-01 14:53:08 -08001// RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -std=c++1y -O0 -o - %s | FileCheck %s
2struct 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"
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -07007// CHECK: %[[this:.*]] = load %struct.Derived*, %struct.Derived** {{.*}}
Stephen Hines176edba2014-12-01 14:53:08 -08008// CHECK-NEXT: store %struct.Derived* %[[this]], %struct.Derived** %[[retval:.*]]
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -07009// CHECK: %[[dest_a_gep:.*]] = getelementptr inbounds %struct.Derived, %struct.Derived* %[[this]], i32 0, i32 1
10// CHECK-NEXT: %[[src_load:.*]] = load %struct.Derived*, %struct.Derived** {{.*}}
11// CHECK-NEXT: %[[src_a_gep:.*]] = getelementptr inbounds %struct.Derived, %struct.Derived* %[[src_load:.*]], i32 0, i32 1
Stephen Hines176edba2014-12-01 14:53:08 -080012// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %[[dest_a_gep]], i8* %[[src_a_gep]], i64 1, i32 4, i1 false)
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070013// CHECK-NEXT: %[[dest_this:.*]] = load %struct.Derived*, %struct.Derived** %[[retval]]
Stephen Hines176edba2014-12-01 14:53:08 -080014// CHECK-NEXT: ret %struct.Derived* %[[dest_this]]
15 bool a : 1;
16 bool b : 1;
17};
18
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"
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070022// CHECK: %[[this:.*]] = load %struct.Derived2*, %struct.Derived2** {{.*}}
Stephen Hines176edba2014-12-01 14:53:08 -080023// CHECK-NEXT: store %struct.Derived2* %[[this]], %struct.Derived2** %[[retval:.*]]
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070024// CHECK: %[[dest_a_gep:.*]] = getelementptr inbounds %struct.Derived2, %struct.Derived2* %[[this]], i32 0, i32 1
25// CHECK-NEXT: %[[src_load:.*]] = load %struct.Derived2*, %struct.Derived2** {{.*}}
26// CHECK-NEXT: %[[src_a_gep:.*]] = getelementptr inbounds %struct.Derived2, %struct.Derived2* %[[src_load:.*]], i32 0, i32 1
Stephen Hines176edba2014-12-01 14:53:08 -080027// 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)
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070030// CHECK-NEXT: %[[dest_this:.*]] = load %struct.Derived2*, %struct.Derived2** %[[retval]]
Stephen Hines176edba2014-12-01 14:53:08 -080031// CHECK-NEXT: ret %struct.Derived2* %[[dest_this]]
32 int Array[1];
33};