[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Layout / ms-aligned-array.c
blobde3887f8242ccbc79edcf4c4c613af4a79b9de41
1 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
2 // RUN: | FileCheck %s -check-prefix CHECK
4 // Before PR45420, we would only find the alignment on this record. Afterwards,
5 // we can see the alignment on the typedef through the array type.
6 // FIXME: What about other type sugar, like _Atomic? This would only matter in a
7 // packed struct context.
8 struct __declspec(align(16)) AlignedStruct { int x; };
9 struct Struct2 {
10 char c[16];
12 typedef struct Struct2 __declspec(align(16)) AlignedStruct2;
14 #define CHECK_SIZE(X, Align) \
15 _Static_assert(__alignof(struct X) == Align, "should be aligned");
17 #pragma pack(push, 2)
19 struct A {
20 struct AlignedStruct a[1];
22 CHECK_SIZE(A, 16);
24 struct B {
25 char b;
26 AlignedStruct2 a[1];
28 CHECK_SIZE(B, 16);
30 struct C {
31 char b;
32 AlignedStruct2 a[];
34 CHECK_SIZE(C, 16);
36 // CHECK: *** Dumping AST Record Layout
37 // CHECK-NEXT: 0 | struct AlignedStruct
38 // CHECK-NEXT: 0 | int x
39 // CHECK-NEXT: | [sizeof=16, align=16]
40 // CHECK: *** Dumping AST Record Layout
41 // CHECK-NEXT: 0 | struct A
42 // CHECK-NEXT: 0 | struct AlignedStruct[1] a
43 // CHECK-NEXT: | [sizeof=16, align=16]
44 // CHECK: *** Dumping AST Record Layout
45 // CHECK-NEXT: 0 | struct Struct2
46 // CHECK-NEXT: 0 | char[16] c
47 // CHECK-NEXT: | [sizeof=16, align=1]
48 // CHECK: *** Dumping AST Record Layout
49 // CHECK-NEXT: 0 | struct B
50 // CHECK-NEXT: 0 | char b
51 // CHECK-NEXT: 16 | AlignedStruct2[1] a
52 // CHECK-NEXT: | [sizeof=32, align=16]
53 // CHECK: *** Dumping AST Record Layout
54 // CHECK-NEXT: 0 | struct C
55 // CHECK-NEXT: 0 | char b
56 // CHECK-NEXT: 16 | AlignedStruct2[] a
57 // CHECK-NEXT: | [sizeof=16, align=16]
59 #pragma pack(pop)