Files
clang-p2996/clang/test/Layout/itanium-pack-and-align.cpp
Momchil Velikov fe76b36ab1 [Sema] Fix incorrect packed aligned structure layout
Handle attributes before checking the record layout (e.g. underalignment check
during `alignas` processing), as layout may be cached without taking into
account attributes that may affect it.

Differential Revision: https://reviews.llvm.org/D46439

llvm-svn: 332843
2018-05-21 14:28:43 +00:00

27 lines
699 B
C++

// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only -fdump-record-layouts %s \
// RUN: | FileCheck %s
struct S {
char x;
int y;
} __attribute__((packed, aligned(8)));
struct alignas(8) T {
char x;
int y;
} __attribute__((packed));
S s;
T t;
// CHECK: 0 | struct T
// CHECK-NEXT: 0 | char x
// CHECK-NEXT: 1 | int y
// CHECK-NEXT: | [sizeof=8, dsize=8, align=8,
// CHECK-NEXT: | nvsize=8, nvalign=8]
// CHECK: 0 | struct S
// CHECK-NEXT: 0 | char x
// CHECK-NEXT: 1 | int y
// CHECK-NEXT: | [sizeof=8, dsize=8, align=8,
// CHECK-NETX: | nvsize=8, nvalign=8]