Files
clang-p2996/clang/test/Layout/aix-bitfield-alignment.cpp
Xiangling Liao e0921655b1 [AIX] Implement AIX special bitfield related alignment rules
1.[bool, char, short] bitfields have the same alignment as unsigned int
2.Adjust alignment on typedef field decls/honor align attribute
3.Fix alignment for scoped enum class
4.Long long bitfield has 4bytes alignment and StorageUnitSize under 32 bit
  compile mode

Differential Revision: https://reviews.llvm.org/D87029
2021-05-17 11:30:29 -04:00

37 lines
1.1 KiB
C++

// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
// RUN: -fsyntax-only -fxl-pragma-pack -x c++ %s | \
// RUN: FileCheck --check-prefixes=CHECK %s
// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
// RUN: -fsyntax-only -fxl-pragma-pack -x c++ %s | \
// RUN: FileCheck --check-prefixes=CHECK %s
struct A {
bool b : 3;
};
int a = sizeof(A);
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct A
// CHECK-NEXT: 0:0-2 | _Bool b
// CHECK-NEXT: | [sizeof=4, dsize=4, align=4, preferredalign=4,
// CHECK-NEXT: | nvsize=4, nvalign=4, preferrednvalign=4]
enum class Bool : bool { False = 0,
True = 1 };
struct B {
Bool b : 1;
};
int b = sizeof(B);
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct B
// CHECK-NEXT: 0:0-0 | enum Bool b
// CHECK-NEXT: | [sizeof=4, dsize=4, align=4, preferredalign=4,
// CHECK-NEXT: | nvsize=4, nvalign=4, preferrednvalign=4]
enum LL : unsigned long long { val = 1 };