2015-05-27 03:44:52 +08:00
|
|
|
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \
|
2013-10-15 03:08:58 +08:00
|
|
|
// RUN: | FileCheck %s
|
2015-05-27 03:44:52 +08:00
|
|
|
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \
|
2013-10-24 07:53:07 +08:00
|
|
|
// RUN: | FileCheck %s -check-prefix CHECK-X64
|
2013-10-15 03:08:58 +08:00
|
|
|
|
|
|
|
extern "C" int printf(const char *fmt, ...);
|
|
|
|
|
|
|
|
struct B0 { char a; B0() : a(0xB0) {} };
|
|
|
|
struct __declspec(align(1)) B1 {};
|
|
|
|
|
2013-11-15 06:34:59 +08:00
|
|
|
struct A : virtual B0 {};
|
2013-10-15 03:08:58 +08:00
|
|
|
|
|
|
|
// CHECK: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK: *** Dumping AST Record Layout
|
|
|
|
// CHECK-NEXT: 0 | struct A
|
|
|
|
// CHECK-NEXT: 0 | (A vbtable pointer)
|
|
|
|
// CHECK-NEXT: 4 | struct B0 (virtual base)
|
|
|
|
// CHECK-NEXT: 4 | char a
|
|
|
|
// CHECK-NEXT: | [sizeof=5, align=4
|
|
|
|
// CHECK-NEXT: | nvsize=4, nvalign=4]
|
|
|
|
// CHECK-X64: *** Dumping AST Record Layout
|
2013-10-24 07:53:07 +08:00
|
|
|
// CHECK-X64: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-X64-NEXT: 0 | struct A
|
|
|
|
// CHECK-X64-NEXT: 0 | (A vbtable pointer)
|
|
|
|
// CHECK-X64-NEXT: 8 | struct B0 (virtual base)
|
|
|
|
// CHECK-X64-NEXT: 8 | char a
|
|
|
|
// CHECK-X64-NEXT: | [sizeof=16, align=8
|
|
|
|
// CHECK-X64-NEXT: | nvsize=8, nvalign=8]
|
2013-10-15 03:08:58 +08:00
|
|
|
|
|
|
|
struct __declspec(align(1)) B : virtual B0 {};
|
|
|
|
|
|
|
|
// CHECK: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-NEXT: 0 | struct B
|
|
|
|
// CHECK-NEXT: 0 | (B vbtable pointer)
|
|
|
|
// CHECK-NEXT: 4 | struct B0 (virtual base)
|
|
|
|
// CHECK-NEXT: 4 | char a
|
|
|
|
// CHECK-NEXT: | [sizeof=8, align=4
|
|
|
|
// CHECK-NEXT: | nvsize=4, nvalign=4]
|
2013-10-24 07:53:07 +08:00
|
|
|
// CHECK-X64: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-X64-NEXT: 0 | struct B
|
|
|
|
// CHECK-X64-NEXT: 0 | (B vbtable pointer)
|
|
|
|
// CHECK-X64-NEXT: 8 | struct B0 (virtual base)
|
|
|
|
// CHECK-X64-NEXT: 8 | char a
|
|
|
|
// CHECK-X64-NEXT: | [sizeof=16, align=8
|
|
|
|
// CHECK-X64-NEXT: | nvsize=8, nvalign=8]
|
2013-10-15 03:08:58 +08:00
|
|
|
|
|
|
|
struct C : virtual B0 { int a; C() : a(0xC) {} };
|
|
|
|
|
|
|
|
// CHECK: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-NEXT: 0 | struct C
|
|
|
|
// CHECK-NEXT: 0 | (C vbtable pointer)
|
|
|
|
// CHECK-NEXT: 4 | int a
|
|
|
|
// CHECK-NEXT: 8 | struct B0 (virtual base)
|
|
|
|
// CHECK-NEXT: 8 | char a
|
|
|
|
// CHECK-NEXT: | [sizeof=9, align=4
|
|
|
|
// CHECK-NEXT: | nvsize=8, nvalign=4]
|
2013-10-24 07:53:07 +08:00
|
|
|
// CHECK-X64: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-X64-NEXT: 0 | struct C
|
|
|
|
// CHECK-X64-NEXT: 0 | (C vbtable pointer)
|
|
|
|
// CHECK-X64-NEXT: 8 | int a
|
|
|
|
// CHECK-X64-NEXT: 16 | struct B0 (virtual base)
|
|
|
|
// CHECK-X64-NEXT: 16 | char a
|
|
|
|
// CHECK-X64-NEXT: | [sizeof=24, align=8
|
|
|
|
// CHECK-X64-NEXT: | nvsize=16, nvalign=8]
|
2013-10-15 03:08:58 +08:00
|
|
|
|
|
|
|
struct D : virtual B0 { __declspec(align(1)) int a; D() : a(0xD) {} };
|
|
|
|
|
|
|
|
// CHECK: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-NEXT: 0 | struct D
|
|
|
|
// CHECK-NEXT: 0 | (D vbtable pointer)
|
|
|
|
// CHECK-NEXT: 4 | int a
|
|
|
|
// CHECK-NEXT: 8 | struct B0 (virtual base)
|
|
|
|
// CHECK-NEXT: 8 | char a
|
|
|
|
// CHECK-NEXT: | [sizeof=12, align=4
|
|
|
|
// CHECK-NEXT: | nvsize=8, nvalign=4]
|
2013-10-24 07:53:07 +08:00
|
|
|
// CHECK-X64: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-X64-NEXT: 0 | struct D
|
|
|
|
// CHECK-X64-NEXT: 0 | (D vbtable pointer)
|
|
|
|
// CHECK-X64-NEXT: 8 | int a
|
|
|
|
// CHECK-X64-NEXT: 16 | struct B0 (virtual base)
|
|
|
|
// CHECK-X64-NEXT: 16 | char a
|
|
|
|
// CHECK-X64-NEXT: | [sizeof=24, align=8
|
|
|
|
// CHECK-X64-NEXT: | nvsize=16, nvalign=8]
|
2013-10-15 03:08:58 +08:00
|
|
|
|
|
|
|
struct E : virtual B0, virtual B1 {};
|
|
|
|
|
|
|
|
// CHECK: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK: *** Dumping AST Record Layout
|
|
|
|
// CHECK-NEXT: 0 | struct E
|
|
|
|
// CHECK-NEXT: 0 | (E vbtable pointer)
|
|
|
|
// CHECK-NEXT: 4 | struct B0 (virtual base)
|
|
|
|
// CHECK-NEXT: 4 | char a
|
|
|
|
// CHECK-NEXT: 5 | struct B1 (virtual base) (empty)
|
|
|
|
// CHECK-NEXT: | [sizeof=8, align=4
|
|
|
|
// CHECK-NEXT: | nvsize=4, nvalign=4]
|
|
|
|
// CHECK-X64: *** Dumping AST Record Layout
|
2013-10-24 07:53:07 +08:00
|
|
|
// CHECK-X64: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-X64-NEXT: 0 | struct E
|
|
|
|
// CHECK-X64-NEXT: 0 | (E vbtable pointer)
|
|
|
|
// CHECK-X64-NEXT: 8 | struct B0 (virtual base)
|
|
|
|
// CHECK-X64-NEXT: 8 | char a
|
|
|
|
// CHECK-X64-NEXT: 9 | struct B1 (virtual base) (empty)
|
|
|
|
// CHECK-X64-NEXT: | [sizeof=16, align=8
|
|
|
|
// CHECK-X64-NEXT: | nvsize=8, nvalign=8]
|
2013-10-15 05:14:05 +08:00
|
|
|
|
|
|
|
struct F { char a; virtual ~F(); };
|
|
|
|
|
|
|
|
// CHECK: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-NEXT: 0 | struct F
|
|
|
|
// CHECK-NEXT: 0 | (F vftable pointer)
|
|
|
|
// CHECK-NEXT: 4 | char a
|
|
|
|
// CHECK-NEXT: | [sizeof=8, align=4
|
|
|
|
// CHECK-NEXT: | nvsize=8, nvalign=4]
|
2013-10-24 07:53:07 +08:00
|
|
|
// CHECK-X64: *** Dumping AST Record Layout
|
2014-01-09 08:30:56 +08:00
|
|
|
// CHECK-X64-NEXT: 0 | struct F
|
|
|
|
// CHECK-X64-NEXT: 0 | (F vftable pointer)
|
|
|
|
// CHECK-X64-NEXT: 8 | char a
|
|
|
|
// CHECK-X64-NEXT: | [sizeof=16, align=8
|
|
|
|
// CHECK-X64-NEXT: | nvsize=16, nvalign=8]
|
2013-10-15 05:14:05 +08:00
|
|
|
|
2013-10-15 03:08:58 +08:00
|
|
|
int a[
|
|
|
|
sizeof(A)+
|
|
|
|
sizeof(B)+
|
|
|
|
sizeof(C)+
|
|
|
|
sizeof(D)+
|
2013-10-15 05:14:05 +08:00
|
|
|
sizeof(E)+
|
|
|
|
sizeof(F)];
|