xref: /minix3/external/bsd/llvm/dist/clang/test/Layout/ms-x86-empty-layout.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
2*0a6a1f1dSLionel Sambuc // RUN:            | FileCheck %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
4*0a6a1f1dSLionel Sambuc // RUN:            | FileCheck %s
5*0a6a1f1dSLionel Sambuc 
6*0a6a1f1dSLionel Sambuc struct EmptyIntMemb {
7*0a6a1f1dSLionel Sambuc   int FlexArrayMemb[0];
8*0a6a1f1dSLionel Sambuc };
9*0a6a1f1dSLionel Sambuc // CHECK: *** Dumping AST Record Layout
10*0a6a1f1dSLionel Sambuc // CHECK: Type: struct EmptyIntMemb
11*0a6a1f1dSLionel Sambuc // CHECK: Record:
12*0a6a1f1dSLionel Sambuc // CHECK: Layout: <ASTRecordLayout
13*0a6a1f1dSLionel Sambuc // CHECK:     Size:32
14*0a6a1f1dSLionel Sambuc // CHECK:     Alignment:32
15*0a6a1f1dSLionel Sambuc // CHECK:     FieldOffsets: [0]>
16*0a6a1f1dSLionel Sambuc 
17*0a6a1f1dSLionel Sambuc struct EmptyLongLongMemb {
18*0a6a1f1dSLionel Sambuc   long long FlexArrayMemb[0];
19*0a6a1f1dSLionel Sambuc };
20*0a6a1f1dSLionel Sambuc // CHECK: *** Dumping AST Record Layout
21*0a6a1f1dSLionel Sambuc // CHECK: Type: struct EmptyLongLongMemb
22*0a6a1f1dSLionel Sambuc // CHECK: Record:
23*0a6a1f1dSLionel Sambuc // CHECK: Layout: <ASTRecordLayout
24*0a6a1f1dSLionel Sambuc // CHECK:     Size:32
25*0a6a1f1dSLionel Sambuc // CHECK:     Alignment:64
26*0a6a1f1dSLionel Sambuc // CHECK:     FieldOffsets: [0]>
27*0a6a1f1dSLionel Sambuc 
28*0a6a1f1dSLionel Sambuc struct EmptyAligned2LongLongMemb {
29*0a6a1f1dSLionel Sambuc   long long __declspec(align(2)) FlexArrayMemb[0];
30*0a6a1f1dSLionel Sambuc };
31*0a6a1f1dSLionel Sambuc 
32*0a6a1f1dSLionel Sambuc // CHECK: *** Dumping AST Record Layout
33*0a6a1f1dSLionel Sambuc // CHECK: Type: struct EmptyAligned2LongLongMemb
34*0a6a1f1dSLionel Sambuc // CHECK: Record:
35*0a6a1f1dSLionel Sambuc // CHECK: Layout: <ASTRecordLayout
36*0a6a1f1dSLionel Sambuc // CHECK:     Size:32
37*0a6a1f1dSLionel Sambuc // CHECK:     Alignment:64
38*0a6a1f1dSLionel Sambuc // CHECK:     FieldOffsets: [0]>
39*0a6a1f1dSLionel Sambuc 
40*0a6a1f1dSLionel Sambuc struct EmptyAligned8LongLongMemb {
41*0a6a1f1dSLionel Sambuc   long long __declspec(align(8)) FlexArrayMemb[0];
42*0a6a1f1dSLionel Sambuc };
43*0a6a1f1dSLionel Sambuc 
44*0a6a1f1dSLionel Sambuc // CHECK: *** Dumping AST Record Layout
45*0a6a1f1dSLionel Sambuc // CHECK: Type: struct EmptyAligned8LongLongMemb
46*0a6a1f1dSLionel Sambuc // CHECK: Record:
47*0a6a1f1dSLionel Sambuc // CHECK: Layout: <ASTRecordLayout
48*0a6a1f1dSLionel Sambuc // CHECK:     Size:64
49*0a6a1f1dSLionel Sambuc // CHECK:     Alignment:64
50*0a6a1f1dSLionel Sambuc // CHECK:     FieldOffsets: [0]>
51*0a6a1f1dSLionel Sambuc 
52*0a6a1f1dSLionel Sambuc #pragma pack(1)
53*0a6a1f1dSLionel Sambuc struct __declspec(align(4)) EmptyPackedAligned4LongLongMemb {
54*0a6a1f1dSLionel Sambuc   long long FlexArrayMemb[0];
55*0a6a1f1dSLionel Sambuc };
56*0a6a1f1dSLionel Sambuc #pragma pack()
57*0a6a1f1dSLionel Sambuc 
58*0a6a1f1dSLionel Sambuc // CHECK: *** Dumping AST Record Layout
59*0a6a1f1dSLionel Sambuc // CHECK: Type: struct EmptyPackedAligned4LongLongMemb
60*0a6a1f1dSLionel Sambuc // CHECK: Record:
61*0a6a1f1dSLionel Sambuc // CHECK: Layout: <ASTRecordLayout
62*0a6a1f1dSLionel Sambuc // CHECK:     Size:32
63*0a6a1f1dSLionel Sambuc // CHECK:     Alignment:32
64*0a6a1f1dSLionel Sambuc // CHECK:     FieldOffsets: [0]>
65*0a6a1f1dSLionel Sambuc 
66*0a6a1f1dSLionel Sambuc #pragma pack(1)
67*0a6a1f1dSLionel Sambuc struct EmptyPackedAligned8LongLongMemb {
68*0a6a1f1dSLionel Sambuc   long long __declspec(align(8)) FlexArrayMemb[0];
69*0a6a1f1dSLionel Sambuc };
70*0a6a1f1dSLionel Sambuc #pragma pack()
71*0a6a1f1dSLionel Sambuc 
72*0a6a1f1dSLionel Sambuc // CHECK: *** Dumping AST Record Layout
73*0a6a1f1dSLionel Sambuc // CHECK: Type: struct EmptyPackedAligned8LongLongMemb
74*0a6a1f1dSLionel Sambuc // CHECK: Record:
75*0a6a1f1dSLionel Sambuc // CHECK: Layout: <ASTRecordLayout
76*0a6a1f1dSLionel Sambuc // CHECK:     Size:64
77*0a6a1f1dSLionel Sambuc // CHECK:     Alignment:64
78*0a6a1f1dSLionel Sambuc // CHECK:     FieldOffsets: [0]>
79*0a6a1f1dSLionel Sambuc 
80*0a6a1f1dSLionel Sambuc 
81*0a6a1f1dSLionel Sambuc int a[
82*0a6a1f1dSLionel Sambuc sizeof(struct EmptyIntMemb)+
83*0a6a1f1dSLionel Sambuc sizeof(struct EmptyLongLongMemb)+
84*0a6a1f1dSLionel Sambuc sizeof(struct EmptyAligned2LongLongMemb)+
85*0a6a1f1dSLionel Sambuc sizeof(struct EmptyAligned8LongLongMemb)+
86*0a6a1f1dSLionel Sambuc sizeof(struct EmptyPackedAligned4LongLongMemb)+
87*0a6a1f1dSLionel Sambuc sizeof(struct EmptyPackedAligned8LongLongMemb)+
88*0a6a1f1dSLionel Sambuc 0];
89