• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
2 // RUN:            | FileCheck %s
3 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
4 // RUN:            | FileCheck %s
5 
6 struct EmptyIntMemb {
7   int FlexArrayMemb[0];
8 };
9 // CHECK:       *** Dumping AST Record Layout
10 // CHECK-NEXT:  0 | struct EmptyIntMemb
11 // CHECK-NEXT:  0 | int [0] FlexArrayMemb
12 // CHECK-NEXT:    | [sizeof=4, align=4
13 
14 struct EmptyLongLongMemb {
15   long long FlexArrayMemb[0];
16 };
17 // CHECK: *** Dumping AST Record Layout
18 // CHECK-NEXT:  0 | struct EmptyLongLongMemb
19 // CHECK-NEXT:  0 | long long [0] FlexArrayMemb
20 // CHECK-NEXT:    | [sizeof=4, align=8
21 
22 struct EmptyAligned2LongLongMemb {
23   long long __declspec(align(2)) FlexArrayMemb[0];
24 };
25 
26 // CHECK: *** Dumping AST Record Layout
27 // CHECK-NEXT:  0 | struct EmptyAligned2LongLongMemb
28 // CHECK-NEXT:  0 | long long [0] FlexArrayMemb
29 // CHECK-NEXT:    | [sizeof=4, align=8
30 
31 struct EmptyAligned8LongLongMemb {
32   long long __declspec(align(8)) FlexArrayMemb[0];
33 };
34 
35 // CHECK: *** Dumping AST Record Layout
36 // CHECK-NEXT:  0 | struct EmptyAligned8LongLongMemb
37 // CHECK-NEXT:  0 | long long [0] FlexArrayMemb
38 // CHECK-NEXT:    | [sizeof=8, align=8
39 
40 #pragma pack(1)
41 struct __declspec(align(4)) EmptyPackedAligned4LongLongMemb {
42   long long FlexArrayMemb[0];
43 };
44 #pragma pack()
45 
46 // CHECK: *** Dumping AST Record Layout
47 // CHECK-NEXT:  0 | struct EmptyPackedAligned4LongLongMemb
48 // CHECK-NEXT:  0 | long long [0] FlexArrayMemb
49 // CHECK-NEXT:    | [sizeof=4, align=4
50 
51 #pragma pack(1)
52 struct EmptyPackedAligned8LongLongMemb {
53   long long __declspec(align(8)) FlexArrayMemb[0];
54 };
55 #pragma pack()
56 
57 // CHECK: *** Dumping AST Record Layout
58 // CHECK-NEXT:  0 | struct EmptyPackedAligned8LongLongMemb
59 // CHECK-NEXT:  0 | long long [0] FlexArrayMemb
60 // CHECK-NEXT:    | [sizeof=8, align=8
61 
62 
63 int a[
64 sizeof(struct EmptyIntMemb)+
65 sizeof(struct EmptyLongLongMemb)+
66 sizeof(struct EmptyAligned2LongLongMemb)+
67 sizeof(struct EmptyAligned8LongLongMemb)+
68 sizeof(struct EmptyPackedAligned4LongLongMemb)+
69 sizeof(struct EmptyPackedAligned8LongLongMemb)+
70 0];
71