1; REQUIRES: diasdk
2
3; RUN: llvm-pdbutil pretty -classes -class-definitions=layout \
4; RUN:     -include-types=SimplePad %p/Inputs/SimplePaddingTest.pdb > %t
5
6; RUN: FileCheck -input-file=%t %s -check-prefix=NO_PADDING
7; RUN: FileCheck -input-file=%t %s -check-prefix=UNION
8; RUN: FileCheck -input-file=%t %s -check-prefix=NESTED_UNION
9; RUN: FileCheck -input-file=%t %s -check-prefix=PAD_FROM_FIELDS1
10; RUN: FileCheck -input-file=%t %s -check-prefix=PAD_FROM_FIELDS2
11; RUN: FileCheck -input-file=%t %s -check-prefix=NO_PAD_IN_BASE
12; RUN: FileCheck -input-file=%t %s -check-prefix=PAD_IN_DERIVED
13; RUN: FileCheck -input-file=%t %s -check-prefix=EMPTY_BASE
14; RUN: FileCheck -input-file=%t %s -check-prefix=VFPTR
15; RUN: FileCheck -input-file=%t %s -check-prefix=MULTIPLE_INHERIT
16; RUN: FileCheck -input-file=%t %s -check-prefix=MULTIPLE_INHERIT2
17; RUN: FileCheck -input-file=%t %s -check-prefix=DEEP_INHERIT
18; RUN: FileCheck -input-file=%t %s -check-prefix=AGGREGATE
19
20; NO_PADDING:      struct SimplePadNoPadding [sizeof = 8] {
21; NO_PADDING-NEXT:   data +0x00 [sizeof=4] int X
22; NO_PADDING-NEXT:   data +0x04 [sizeof=4] int Y
23; NO_PADDING-NEXT: }
24
25; UNION:      struct SimplePadUnion [sizeof = 16] {
26; UNION-NEXT:   data +0x00 [sizeof=4] int X
27; UNION-NEXT:   data +0x00 [sizeof=8] __int64 Y
28; UNION-NEXT:   data +0x00 [sizeof=16] SimplePadUnion::
29; UNION-NEXT:     data +0x00 [sizeof=4] int X
30; UNION-NEXT:     <padding> (4 bytes)
31; UNION-NEXT:     data +0x08 [sizeof=8] __int64 Y
32; UNION-NEXT: }
33
34; NESTED_UNION:      struct {{SimplePadUnion::.*}} [sizeof = 16] {
35; NESTED_UNION-NEXT:   data +0x00 [sizeof=4] int X
36; NESTED_UNION-NEXT:   <padding> (4 bytes)
37; NESTED_UNION-NEXT:   data +0x08 [sizeof=8] __int64 Y
38; NESTED_UNION-NEXT: }
39
40; PAD_FROM_FIELDS1:      struct SimplePadFields1 [sizeof = 4] {
41; PAD_FROM_FIELDS1-NEXT:   data +0x00 [sizeof=1] char A
42; PAD_FROM_FIELDS1-NEXT:   data +0x01 [sizeof=1] char B
43; PAD_FROM_FIELDS1-NEXT:   data +0x02 [sizeof=1] char C
44; PAD_FROM_FIELDS1-NEXT:   <padding> (1 bytes)
45; PAD_FROM_FIELDS1-NEXT: }
46
47; PAD_FROM_FIELDS2:      struct SimplePadFields2 [sizeof = 8] {
48; PAD_FROM_FIELDS2-NEXT:   data +0x00 [sizeof=4] int Y
49; PAD_FROM_FIELDS2-NEXT:   data +0x04 [sizeof=1] char X
50; PAD_FROM_FIELDS2-NEXT:   <padding> (3 bytes)
51; PAD_FROM_FIELDS2-NEXT: }
52
53; NO_PAD_IN_BASE:      struct SimplePadBase [sizeof = 4] {
54; NO_PAD_IN_BASE-NEXT:   data +0x00 [sizeof=4] int X
55; NO_PAD_IN_BASE-NEXT: }
56
57; PAD_IN_DERIVED:      struct SimplePadDerived [sizeof = 16]
58; PAD_IN_DERIVED-NEXT:   : public SimplePadBase {
59; PAD_IN_DERIVED-NEXT:   base +0x00 [sizeof=4] SimplePadBase
60; PAD_IN_DERIVED-NEXT:     data +0x00 [sizeof=4] int X
61; PAD_IN_DERIVED-NEXT:   <padding> (4 bytes)
62; PAD_IN_DERIVED-NEXT:   data +0x08 [sizeof=8] __int64 Y
63; PAD_IN_DERIVED-NEXT: }
64
65; EMPTY_BASE:      struct SimplePadEmpty [sizeof = 8]
66; EMPTY_BASE-NEXT:   : public SimplePadEmptyBase1
67; EMPTY_BASE-NEXT:   , public SimplePadEmptyBase2 {
68; EMPTY_BASE-NEXT:   base +0x00 [sizeof=1] SimplePadEmptyBase1
69; EMPTY_BASE-NEXT:   base +0x01 [sizeof=1] SimplePadEmptyBase2
70; EMPTY_BASE-NEXT:   <padding> (2 bytes)
71; EMPTY_BASE-NEXT:   data +0x04 [sizeof=4] int X
72; EMPTY_BASE-NEXT: }
73
74; VFPTR:      struct SimplePadVfptr [sizeof = 8] {
75; VFPTR-NEXT:   vfptr +0x00 [sizeof=4]
76; VFPTR-NEXT:   data +0x04 [sizeof=4] int X
77; VFPTR-NEXT: }
78
79; MULTIPLE_INHERIT:      struct SimplePadMultiInherit [sizeof = 8]
80; MULTIPLE_INHERIT-NEXT:   : public NonEmptyBase1
81; MULTIPLE_INHERIT-NEXT:   , public NonEmptyBase2 {
82; MULTIPLE_INHERIT-NEXT:   base +0x00 [sizeof=1] NonEmptyBase1
83; MULTIPLE_INHERIT-NEXT:     data +0x00 [sizeof=1] bool X
84; MULTIPLE_INHERIT-NEXT:   base +0x01 [sizeof=1] NonEmptyBase2
85; MULTIPLE_INHERIT-NEXT:     data +0x01 [sizeof=1] bool Y
86; MULTIPLE_INHERIT-NEXT:   <padding> (2 bytes)
87; MULTIPLE_INHERIT-NEXT:   data +0x04 [sizeof=4] int X
88; MULTIPLE_INHERIT-NEXT: }
89
90; MULTIPLE_INHERIT2:      SimplePadMultiInherit2 [sizeof = 16]
91; MULTIPLE_INHERIT2-NEXT:   : public SimplePadFields1
92; MULTIPLE_INHERIT2-NEXT:   , public SimplePadFields2 {
93; MULTIPLE_INHERIT2-NEXT:   base +0x00 [sizeof=3] SimplePadFields1
94; MULTIPLE_INHERIT2-NEXT:     data +0x00 [sizeof=1] char A
95; MULTIPLE_INHERIT2-NEXT:     data +0x01 [sizeof=1] char B
96; MULTIPLE_INHERIT2-NEXT:     data +0x02 [sizeof=1] char C
97; MULTIPLE_INHERIT2-NEXT:   <padding> (1 bytes)
98; MULTIPLE_INHERIT2-NEXT:   base +0x04 [sizeof=5] SimplePadFields2
99; MULTIPLE_INHERIT2-NEXT:     data +0x04 [sizeof=4] int Y
100; MULTIPLE_INHERIT2-NEXT:     data +0x08 [sizeof=1] char X
101; MULTIPLE_INHERIT2-NEXT:   <padding> (3 bytes)
102; MULTIPLE_INHERIT2-NEXT:   data +0x0c [sizeof=4] int X
103; MULTIPLE_INHERIT2-NEXT: }
104
105; DEEP_INHERIT:      struct SimplePadTwoLevelInherit [sizeof = 16]
106; DEEP_INHERIT-NEXT:   : public OneLevelInherit {
107; DEEP_INHERIT-NEXT:     base +0x00 [sizeof=4] OneLevelInherit
108; DEEP_INHERIT-NEXT:       base +0x00 [sizeof=1] NonEmptyBase1
109; DEEP_INHERIT-NEXT:         data +0x00 [sizeof=1] bool X
110; DEEP_INHERIT-NEXT:       <padding> (1 bytes)
111; DEEP_INHERIT-NEXT:       data +0x02 [sizeof=2] short Y
112; DEEP_INHERIT-NEXT:     <padding> (4 bytes)
113; DEEP_INHERIT-NEXT:     data +0x08 [sizeof=8] __int64 Z
114; DEEP_INHERIT-NEXT: }
115
116
117; AGGREGATE:      struct SimplePadAggregate [sizeof = 12] {
118; AGGREGATE-NEXT:   data +0x00 [sizeof=1] NonEmptyBase1 X
119; AGGREGATE-NEXT:     data +0x00 [sizeof=1] bool X
120; AGGREGATE-NEXT:   <padding> (3 bytes)
121; AGGREGATE-NEXT:   data +0x04 [sizeof=4] int Y
122; AGGREGATE-NEXT:   data +0x08 [sizeof=4] SimplePadFields1 Fields
123; AGGREGATE-NEXT:     data +0x08 [sizeof=1] char A
124; AGGREGATE-NEXT:     data +0x09 [sizeof=1] char B
125; AGGREGATE-NEXT:     data +0x0a [sizeof=1] char C
126; AGGREGATE-NEXT:     <padding> (1 bytes)
127; AGGREGATE-NEXT: }
128