Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / override-layout-virtual-base.cpp
blob12ec361d7c68e3834f8b3e853ef96474a26915eb
1 // RUN: %clang_cc1 -w -triple=x86_64-pc-win32 -fms-compatibility -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-layout-virtual-base.layout %s | FileCheck --check-prefix=SIMPLE %s
2 // RUN: %clang_cc1 -w -triple=x86_64-pc-win32 -fms-compatibility -fdump-record-layouts -foverride-record-layout=%S/Inputs/override-layout-virtual-base.layout %s | FileCheck %s
4 struct S1 {
5 int a;
6 };
8 struct S2 : virtual S1 {
9 virtual void foo() {}
12 // SIMPLE: Type: struct S3
13 // SIMPLE: FieldOffsets: [64]
14 struct S3 : S2 {
15 char b;
18 struct S4 {
21 struct S5 : S4 {
22 virtual void foo() {}
25 // CHECK: *** Dumping AST Record Layout
26 // CHECK: 0 | struct S2
27 // CHECK-NEXT: 0 | (S2 vftable pointer)
28 // CHECK-NEXT: 8 | (S2 vbtable pointer)
29 // CHECK-NEXT: 8 | struct S1 (virtual base)
30 // CHECK-NEXT: 8 | int a
31 // CHECK-NEXT: | [sizeof=8, align=8,
32 // CHECK-NEXT: | nvsize=8, nvalign=8]
33 // CHECK: *** Dumping AST Record Layout
34 // CHECK: 0 | struct S3
35 // CHECK-NEXT: 0 | struct S2 (primary base)
36 // CHECK-NEXT: 0 | (S2 vftable pointer)
37 // CHECK-NEXT: 8 | (S2 vbtable pointer)
38 // CHECK-NEXT: 8 | char b
39 // CHECK-NEXT: 16 | struct S1 (virtual base)
40 // CHECK-NEXT: 16 | int a
41 // CHECK-NEXT: | [sizeof=24, align=8,
42 // CHECK-NEXT: | nvsize=16, nvalign=8]
43 // CHECK: *** Dumping AST Record Layout
44 // CHECK: 0 | struct S5
45 // CHECK-NEXT: 0 | (S5 vftable pointer)
46 // CHECK-NEXT: 0 | struct S4 (base) (empty)
47 // CHECK-NEXT: | [sizeof=8, align=8,
48 // CHECK-NEXT: | nvsize=8, nvalign=8]
50 void use_structs() {
51 S1 s1s[sizeof(S1)];
52 S2 s2s[sizeof(S2)];
53 S3 s3s[sizeof(S3)];
54 S4 s4s[sizeof(S4)];
55 S5 s5s[sizeof(S5)];