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
; };
12 typedef struct Struct2
__declspec(align(16)) AlignedStruct2
;
14 #define CHECK_SIZE(X, Align) \
15 _Static_assert(__alignof(struct X) == Align, "should be aligned");
20 struct AlignedStruct a
[1];
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]