summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorWarren Hunt <whunt@google.com>2013-10-23 23:53:07 +0000
committerWarren Hunt <whunt@google.com>2013-10-23 23:53:07 +0000
commit55d8e82f861c4b183eed1593aac8bb29a3c1e621 (patch)
tree84f99803be4c467176c26baa512b99f8fca288bb /clang/test
parent79bb2663462da06e8ed5ed482238b9416cf81880 (diff)
downloadbcm5719-llvm-55d8e82f861c4b183eed1593aac8bb29a3c1e621.tar.gz
bcm5719-llvm-55d8e82f861c4b183eed1593aac8bb29a3c1e621.zip
Implements 64 bit microsoft record layout and adds lit tests to cover
it. Also removes all of the microsoft C++ ABI related code from the itanium layout builder. Differential Revision: http://llvm-reviews.chandlerc.com/D2003 llvm-svn: 193290
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Layout/ms-x86-aligned-tail-padding.cpp170
-rw-r--r--clang/test/Layout/ms-x86-basic-layout.cpp289
-rw-r--r--clang/test/Layout/ms-x86-empty-nonvirtual-bases.cpp4
-rw-r--r--clang/test/Layout/ms-x86-empty-virtual-base.cpp343
-rw-r--r--clang/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp266
-rw-r--r--clang/test/Layout/ms-x86-primary-bases.cpp125
-rw-r--r--clang/test/Layout/ms-x86-size-alignment-fail.cpp48
-rw-r--r--clang/test/Layout/ms-x86-vfvb-alignment.cpp156
-rw-r--r--clang/test/Layout/ms-x86-vfvb-sharing.cpp49
-rw-r--r--clang/test/Layout/ms-x86-vtordisp.cpp82
-rw-r--r--clang/test/Sema/ms_bitfield_layout.c2
11 files changed, 1468 insertions, 66 deletions
diff --git a/clang/test/Layout/ms-x86-aligned-tail-padding.cpp b/clang/test/Layout/ms-x86-aligned-tail-padding.cpp
index 53c4615b910..b9020f386c0 100644
--- a/clang/test/Layout/ms-x86-aligned-tail-padding.cpp
+++ b/clang/test/Layout/ms-x86-aligned-tail-padding.cpp
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
@@ -86,6 +88,20 @@ struct A : B1, B0, B2, virtual V {
// CHECK: 64 | char a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct A
+// CHECK-X64: 0 | struct B1 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 4 | struct B0 (base)
+// CHECK-X64: 4 | int a
+// CHECK-X64: 16 | struct B2 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | (A vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 48 | struct V (virtual base)
+// CHECK-X64: 48 | char a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct B : B2, B0, B1, virtual V {
int a;
@@ -106,6 +122,20 @@ struct B : B2, B0, B1, virtual V {
// CHECK: 64 | char a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct B
+// CHECK-X64: 0 | struct B2 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 16 | struct B0 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | struct B1 (base)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 40 | (B vbtable pointer)
+// CHECK-X64: 48 | int a
+// CHECK-X64: 64 | struct V (virtual base)
+// CHECK-X64: 64 | char a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=64, nvalign=16]
struct C : B1, B0, virtual V {
int a;
@@ -126,6 +156,19 @@ struct C : B1, B0, virtual V {
// CHECK: 48 | char a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct C
+// CHECK-X64: 0 | struct B1 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 4 | struct B0 (base)
+// CHECK-X64: 4 | int a
+// CHECK-X64: 8 | (C vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | long long a1
+// CHECK-X64: 32 | struct V (virtual base)
+// CHECK-X64: 32 | char a
+// CHECK-X64: | [sizeof=48, align=16
+// CHECK-X64: | nvsize=32, nvalign=16]
struct D : B2, B0, virtual V {
int a;
@@ -144,6 +187,18 @@ struct D : B2, B0, virtual V {
// CHECK: 48 | char a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct D
+// CHECK-X64: 0 | struct B2 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 16 | struct B0 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | (D vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct V (virtual base)
+// CHECK-X64: 48 | char a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct E : B3, B0, virtual V {
int a;
@@ -163,6 +218,19 @@ struct E : B3, B0, virtual V {
// CHECK: 48 | char a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct E
+// CHECK-X64: 0 | struct B3 (base)
+// CHECK-X64: 0 | long long a1
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B0 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | (E vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct V (virtual base)
+// CHECK-X64: 48 | char a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct F : B0, virtual V1 {
__declspec(align(16)) int a;
@@ -182,6 +250,18 @@ struct F : B0, virtual V1 {
// CHECK: 128 | struct A16 (base) (empty)
// CHECK: | [sizeof=128, align=32
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F
+// CHECK-X64: 0 | struct B0 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (F vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 60 | (vtordisp for vbase V1)
+// CHECK-X64: 64 | struct V1 (virtual base)
+// CHECK-X64: 64 | (V1 vftable pointer)
+// CHECK-X64: 96 | struct A16 (base) (empty)
+// CHECK-X64: | [sizeof=96, align=32
+// CHECK-X64: | nvsize=32, nvalign=16]
struct G : virtual V2, virtual V3 {
int a;
@@ -199,6 +279,17 @@ struct G : virtual V2, virtual V3 {
// CHECK: 24 | int a
// CHECK: | [sizeof=28, align=8
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct G
+// CHECK-X64: 0 | (G vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct V2 (virtual base)
+// CHECK-X64: 16 | long long a
+// CHECK-X64: 24 | int a1
+// CHECK-X64: 32 | struct V3 (virtual base)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct H {
__declspec(align(16)) int a;
@@ -212,6 +303,12 @@ struct H {
// CHECK: 4 | int b
// CHECK: | [sizeof=16, align=16
// CHECK: | nvsize=16, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct H
+// CHECK-X64: 0 | int a
+// CHECK-X64: 4 | int b
+// CHECK-X64: | [sizeof=16, align=16
+// CHECK-X64: | nvsize=16, nvalign=16]
struct I {
B2 a;
@@ -223,11 +320,16 @@ struct I {
// CHECK: 0 | struct I
// CHECK: 0 | struct B2 a
// CHECK: 0 | int a
-// CHECK: | [sizeof=16, align=16
-// CHECK: | nvsize=16, nvalign=16]
// CHECK: 16 | int b
// CHECK: | [sizeof=32, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct I
+// CHECK-X64: 0 | struct B2 a
+// CHECK-X64: 0 | int a
+// CHECK-X64: 16 | int b
+// CHECK-X64: | [sizeof=32, align=16
+// CHECK-X64: | nvsize=32, nvalign=16]
struct AX : B0X, virtual B2X, virtual B6X, virtual B3X {
int a;
@@ -254,6 +356,24 @@ struct AX : B0X, virtual B2X, virtual B6X, virtual B3X {
// CHECK: 84 | int a
// CHECK: | [sizeof=96, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AX
+// CHECK-X64: 0 | (AX vftable pointer)
+// CHECK-X64: 16 | struct B0X (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 20 | int a1
+// CHECK-X64: 24 | (AX vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct B2X (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: 52 | struct B6X (virtual base)
+// CHECK-X64: 52 | int a
+// CHECK-X64: 76 | (vtordisp for vbase B3X)
+// CHECK-X64: 80 | struct B3X (virtual base)
+// CHECK-X64: 80 | (B3X vftable pointer)
+// CHECK-X64: 88 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct BX : B4X, virtual B2X, virtual B6X, virtual B3X {
int a;
@@ -281,6 +401,25 @@ struct BX : B4X, virtual B2X, virtual B6X, virtual B3X {
// CHECK: 100 | int a
// CHECK: | [sizeof=112, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct BX
+// CHECK-X64: 0 | (BX vftable pointer)
+// CHECK-X64: 16 | struct B4X (base)
+// CHECK-X64: 16 | struct A16X (base) (empty)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 20 | int a1
+// CHECK-X64: 32 | (BX vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 48 | struct B2X (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: 52 | struct B6X (virtual base)
+// CHECK-X64: 52 | int a
+// CHECK-X64: 76 | (vtordisp for vbase B3X)
+// CHECK-X64: 80 | struct B3X (virtual base)
+// CHECK-X64: 80 | (B3X vftable pointer)
+// CHECK-X64: 88 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct CX : B5X, virtual B2X, virtual B6X, virtual B3X {
int a;
@@ -308,6 +447,25 @@ struct CX : B5X, virtual B2X, virtual B6X, virtual B3X {
// CHECK: 68 | int a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct CX
+// CHECK-X64: 0 | (CX vftable pointer)
+// CHECK-X64: 16 | struct B5X (base)
+// CHECK-X64: 16 | (B5X vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 28 | int a1
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct A16X (virtual base) (empty)
+// CHECK-X64: 48 | struct B2X (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: 52 | struct B6X (virtual base)
+// CHECK-X64: 52 | int a
+// CHECK-X64: 76 | (vtordisp for vbase B3X)
+// CHECK-X64: 80 | struct B3X (virtual base)
+// CHECK-X64: 80 | (B3X vftable pointer)
+// CHECK-X64: 88 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct __declspec(align(16)) DX {
int a;
@@ -321,6 +479,12 @@ struct __declspec(align(16)) DX {
// CHECK: 4 | int a
// CHECK: | [sizeof=16, align=16
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct DX
+// CHECK-X64: 0 | (DX vftable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: | [sizeof=16, align=16
+// CHECK-X64: | nvsize=16, nvalign=8]
int a[
sizeof(A)+
diff --git a/clang/test/Layout/ms-x86-basic-layout.cpp b/clang/test/Layout/ms-x86-basic-layout.cpp
index 5d671e12d21..86b3553b0ba 100644
--- a/clang/test/Layout/ms-x86-basic-layout.cpp
+++ b/clang/test/Layout/ms-x86-basic-layout.cpp
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
@@ -45,6 +47,16 @@ struct TestF0 : A4, virtual B4 {
// CHECK: 12 | int a
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF0
+// CHECK-X64: 0 | struct A4 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (TestF0 vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B4 (virtual base)
+// CHECK-X64: 24 | int a
+// CHECK-X64: | [sizeof=32, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct TestF1 : A4, virtual A16 {
int a;
@@ -61,6 +73,16 @@ struct TestF1 : A4, virtual A16 {
// CHECK: 16 | int a
// CHECK: | [sizeof=32, align=16
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF1
+// CHECK-X64: 0 | struct A4 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (TestF1 vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | struct A16 (virtual base)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=48, align=16
+// CHECK-X64: | nvsize=24, nvalign=8]
struct TestF2 : A4, virtual C4 {
int a;
@@ -78,6 +100,17 @@ struct TestF2 : A4, virtual C4 {
// CHECK: 16 | int a
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF2
+// CHECK-X64: 0 | struct A4 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (TestF2 vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct C4 (virtual base)
+// CHECK-X64: 24 | (C4 vftable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct TestF3 : A4, virtual C16 {
int a;
@@ -95,6 +128,17 @@ struct TestF3 : A4, virtual C16 {
// CHECK: 32 | int a
// CHECK: | [sizeof=48, align=16
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF3
+// CHECK-X64: 0 | struct A4 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (TestF3 vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | struct C16 (virtual base)
+// CHECK-X64: 32 | (C16 vftable pointer)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=24, nvalign=8]
struct TestF4 : TestF3, A4 {
int a;
@@ -116,6 +160,21 @@ struct TestF4 : TestF3, A4 {
// CHECK: 48 | int a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF4
+// CHECK-X64: 0 | struct TestF3 (base)
+// CHECK-X64: 0 | struct A4 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (TestF3 vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct A4 (base)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 28 | int a
+// CHECK-X64: 32 | struct C16 (virtual base)
+// CHECK-X64: 32 | (C16 vftable pointer)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=32, nvalign=16]
struct TestF5 : TestF3, A4 {
int a;
@@ -139,6 +198,22 @@ struct TestF5 : TestF3, A4 {
// CHECK: 64 | int a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF5
+// CHECK-X64: 0 | (TestF5 vftable pointer)
+// CHECK-X64: 16 | struct TestF3 (base)
+// CHECK-X64: 16 | struct A4 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | (TestF3 vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 40 | struct A4 (base)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 44 | int a
+// CHECK-X64: 48 | struct C16 (virtual base)
+// CHECK-X64: 48 | (C16 vftable pointer)
+// CHECK-X64: 64 | int a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct TestF6 : TestF3, A4 {
int a;
@@ -162,6 +237,22 @@ struct TestF6 : TestF3, A4 {
// CHECK: 64 | int a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF6
+// CHECK-X64: 0 | struct TestF3 (base)
+// CHECK-X64: 0 | struct A4 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (TestF3 vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct A4 (base)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 28 | int a
+// CHECK-X64: 44 | (vtordisp for vbase C16)
+// CHECK-X64: 48 | struct C16 (virtual base)
+// CHECK-X64: 48 | (C16 vftable pointer)
+// CHECK-X64: 64 | int a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=32, nvalign=16]
struct TestF7 : A4, virtual C16 {
int a;
@@ -181,6 +272,18 @@ struct TestF7 : A4, virtual C16 {
// CHECK: 48 | int a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF7
+// CHECK-X64: 0 | struct A4 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (TestF7 vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 44 | (vtordisp for vbase C16)
+// CHECK-X64: 48 | struct C16 (virtual base)
+// CHECK-X64: 48 | (C16 vftable pointer)
+// CHECK-X64: 64 | int a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=24, nvalign=8]
struct TestF8 : TestF7, A4 {
int a;
@@ -204,6 +307,22 @@ struct TestF8 : TestF7, A4 {
// CHECK: 64 | int a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF8
+// CHECK-X64: 0 | struct TestF7 (base)
+// CHECK-X64: 0 | struct A4 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (TestF7 vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct A4 (base)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 28 | int a
+// CHECK-X64: 44 | (vtordisp for vbase C16)
+// CHECK-X64: 48 | struct C16 (virtual base)
+// CHECK-X64: 48 | (C16 vftable pointer)
+// CHECK-X64: 64 | int a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=32, nvalign=16]
struct TestF9 : A4, virtual C16 {
int a;
@@ -223,6 +342,18 @@ struct TestF9 : A4, virtual C16 {
// CHECK: 32 | int a
// CHECK: | [sizeof=48, align=16
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestF9
+// CHECK-X64: 0 | (TestF9 vftable pointer)
+// CHECK-X64: 8 | struct A4 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (TestF9 vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 32 | struct C16 (virtual base)
+// CHECK-X64: 32 | (C16 vftable pointer)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=32, nvalign=8]
struct TestFA : TestF9, A4 {
int a;
@@ -246,6 +377,22 @@ struct TestFA : TestF9, A4 {
// CHECK: 48 | int a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestFA
+// CHECK-X64: 0 | struct TestF9 (primary base)
+// CHECK-X64: 0 | (TestF9 vftable pointer)
+// CHECK-X64: 8 | struct A4 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (TestF9 vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 32 | struct A4 (base)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 36 | int a
+// CHECK-X64: 48 | struct C16 (virtual base)
+// CHECK-X64: 48 | (C16 vftable pointer)
+// CHECK-X64: 64 | int a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct TestFB : A16, virtual C16 {
int a;
@@ -265,6 +412,18 @@ struct TestFB : A16, virtual C16 {
// CHECK: 80 | int a
// CHECK: | [sizeof=96, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestFB
+// CHECK-X64: 0 | (TestFB vftable pointer)
+// CHECK-X64: 16 | struct A16 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | (TestFB vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 48 | struct C16 (virtual base)
+// CHECK-X64: 48 | (C16 vftable pointer)
+// CHECK-X64: 64 | int a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct TestFC : TestFB, A4 {
int a;
@@ -288,6 +447,22 @@ struct TestFC : TestFB, A4 {
// CHECK: 96 | int a
// CHECK: | [sizeof=112, align=16
// CHECK: | nvsize=80, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct TestFC
+// CHECK-X64: 0 | struct TestFB (primary base)
+// CHECK-X64: 0 | (TestFB vftable pointer)
+// CHECK-X64: 16 | struct A16 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | (TestFB vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 48 | struct A4 (base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: 52 | int a
+// CHECK-X64: 64 | struct C16 (virtual base)
+// CHECK-X64: 64 | (C16 vftable pointer)
+// CHECK-X64: 80 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=64, nvalign=16]
struct A16f {
@@ -329,6 +504,25 @@ struct F0 : A4, B {
// CHECK: 96 | int a
// CHECK: | [sizeof=112, align=16
// CHECK: | nvsize=80, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F0
+// CHECK-X64: 0 | (F0 vftable pointer)
+// CHECK-X64: 8 | struct A4 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B (base)
+// CHECK-X64: 16 | struct A4 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 20 | struct Y (base)
+// CHECK-X64: 20 | char y
+// CHECK-X64: 32 | struct X (base)
+// CHECK-X64: 32 | (X vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 48 | int a
+// CHECK-X64: 64 | struct A16f (virtual base)
+// CHECK-X64: 64 | (A16f vftable pointer)
+// CHECK-X64: 80 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=64, nvalign=16]
struct F1 : B, A4 {
int a;
@@ -355,6 +549,25 @@ struct F1 : B, A4 {
// CHECK: 80 | int a
// CHECK: | [sizeof=96, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F1
+// CHECK-X64: 0 | (F1 vftable pointer)
+// CHECK-X64: 16 | struct B (base)
+// CHECK-X64: 16 | struct A4 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 20 | struct Y (base)
+// CHECK-X64: 20 | char y
+// CHECK-X64: 32 | struct X (base)
+// CHECK-X64: 32 | (X vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 48 | struct A4 (base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: 52 | int a
+// CHECK-X64: 64 | struct A16f (virtual base)
+// CHECK-X64: 64 | (A16f vftable pointer)
+// CHECK-X64: 80 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=64, nvalign=16]
struct F2 : A4, virtual A16f {
int a;
@@ -374,6 +587,18 @@ struct F2 : A4, virtual A16f {
// CHECK: 32 | int a
// CHECK: | [sizeof=48, align=16
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F2
+// CHECK-X64: 0 | (F2 vftable pointer)
+// CHECK-X64: 8 | struct A4 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (F2 vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 32 | struct A16f (virtual base)
+// CHECK-X64: 32 | (A16f vftable pointer)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=32, nvalign=8]
struct F3 : A4, virtual A16f {
__declspec(align(16)) int a;
@@ -393,6 +618,18 @@ struct F3 : A4, virtual A16f {
// CHECK: 80 | int a
// CHECK: | [sizeof=96, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F3
+// CHECK-X64: 0 | (F3 vftable pointer)
+// CHECK-X64: 8 | struct A4 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (F3 vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct A16f (virtual base)
+// CHECK-X64: 48 | (A16f vftable pointer)
+// CHECK-X64: 64 | int a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct F4 : A4, B {
__declspec(align(16)) int a;
@@ -419,6 +656,25 @@ struct F4 : A4, B {
// CHECK: 96 | int a
// CHECK: | [sizeof=112, align=16
// CHECK: | nvsize=80, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F4
+// CHECK-X64: 0 | (F4 vftable pointer)
+// CHECK-X64: 8 | struct A4 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B (base)
+// CHECK-X64: 16 | struct A4 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 20 | struct Y (base)
+// CHECK-X64: 20 | char y
+// CHECK-X64: 32 | struct X (base)
+// CHECK-X64: 32 | (X vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 48 | int a
+// CHECK-X64: 64 | struct A16f (virtual base)
+// CHECK-X64: 64 | (A16f vftable pointer)
+// CHECK-X64: 80 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=64, nvalign=16]
struct F5 : A16f, virtual A4 {
int a;
@@ -437,6 +693,17 @@ struct F5 : A16f, virtual A4 {
// CHECK: 64 | int a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F5
+// CHECK-X64: 0 | struct A16f (primary base)
+// CHECK-X64: 0 | (A16f vftable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | (F5 vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 48 | struct A4 (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct F6 : virtual A16f, A4, virtual B {
int a;
@@ -464,6 +731,26 @@ struct F6 : virtual A16f, A4, virtual B {
// CHECK: 68 | int a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F6
+// CHECK-X64: 0 | (F6 vftable pointer)
+// CHECK-X64: 8 | struct A4 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (F6 vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 32 | struct A16f (virtual base)
+// CHECK-X64: 32 | (A16f vftable pointer)
+// CHECK-X64: 48 | int a
+// CHECK-X64: 64 | struct B (virtual base)
+// CHECK-X64: 64 | struct A4 (base)
+// CHECK-X64: 64 | int a
+// CHECK-X64: 68 | struct Y (base)
+// CHECK-X64: 68 | char y
+// CHECK-X64: 80 | struct X (base)
+// CHECK-X64: 80 | (X vbtable pointer)
+// CHECK-X64: 88 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=32, nvalign=8]
int a[
sizeof(TestF0)+
diff --git a/clang/test/Layout/ms-x86-empty-nonvirtual-bases.cpp b/clang/test/Layout/ms-x86-empty-nonvirtual-bases.cpp
index f6e8f111ce5..01d10c9994f 100644
--- a/clang/test/Layout/ms-x86-empty-nonvirtual-bases.cpp
+++ b/clang/test/Layout/ms-x86-empty-nonvirtual-bases.cpp
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
// RUN: | FileCheck %s
extern "C" int printf(const char *fmt, ...);
diff --git a/clang/test/Layout/ms-x86-empty-virtual-base.cpp b/clang/test/Layout/ms-x86-empty-virtual-base.cpp
index d417167779a..ef6f08175e7 100644
--- a/clang/test/Layout/ms-x86-empty-virtual-base.cpp
+++ b/clang/test/Layout/ms-x86-empty-virtual-base.cpp
@@ -1,27 +1,29 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
-struct __declspec(align(8)) B0 { B0() {printf("B0 : %3d\n", ((int)this)&0xfff);} };
-struct __declspec(align(8)) B1 { B1() {printf("B1 : %3d\n", ((int)this)&0xfff);} };
-struct __declspec(align(8)) B2 { B2() {printf("B2 : %3d\n", ((int)this)&0xfff);} };
-struct __declspec(align(8)) B3 { B3() {printf("B3 : %3d\n", ((int)this)&0xfff);} };
-struct __declspec(align(8)) B4 { B4() {printf("B4 : %3d\n", ((int)this)&0xfff);} };
+struct __declspec(align(8)) B0 { B0() {printf("B0 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
+struct __declspec(align(8)) B1 { B1() {printf("B1 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
+struct __declspec(align(8)) B2 { B2() {printf("B2 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
+struct __declspec(align(8)) B3 { B3() {printf("B3 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
+struct __declspec(align(8)) B4 { B4() {printf("B4 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
-struct C0 { int a; C0() : a(0xf00000C0) {printf("C0 : %3d\n", ((int)this)&0xfff);} };
-struct C1 { int a; C1() : a(0xf00000C1) {printf("C1 : %3d\n", ((int)this)&0xfff);} };
-struct C2 { int a; C2() : a(0xf00000C2) {printf("C2 : %3d\n", ((int)this)&0xfff);} };
-struct C3 { int a; C3() : a(0xf00000C3) {printf("C3 : %3d\n", ((int)this)&0xfff);} };
-struct C4 { int a; C4() : a(0xf00000C4) {printf("C4 : %3d\n", ((int)this)&0xfff);} };
+struct C0 { int a; C0() : a(0xf00000C0) {printf("C0 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
+struct C1 { int a; C1() : a(0xf00000C1) {printf("C1 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
+struct C2 { int a; C2() : a(0xf00000C2) {printf("C2 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
+struct C3 { int a; C3() : a(0xf00000C3) {printf("C3 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
+struct C4 { int a; C4() : a(0xf00000C4) {printf("C4 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
-struct __declspec(align(16)) D0 { D0() {printf("D0 : %3d\n", ((int)this)&0xfff);} virtual void f() {} };
-struct D1 { D1() {printf("D1 : %3d\n", ((int)this)&0xfff);} };
-struct D2 { int a[8]; D2() {printf("D2 : %3d\n", ((int)this)&0xfff);} };
+struct __declspec(align(16)) D0 { D0() {printf("D0 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} virtual void f() {} };
+struct D1 { D1() {printf("D1 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
+struct D2 { int a[8]; D2() {printf("D2 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
struct A : virtual B0 {
int a;
- A() : a(0xf000000A) {printf("X : %3d\n", ((int)this)&0xfff);}
+ A() : a(0xf000000A) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -31,11 +33,18 @@ struct A : virtual B0 {
// CHECK: 8 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=8, align=8
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct A
+// CHECK-X64: 0 | (A vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct B : virtual B0 {
B0 b0;
int a;
- B() : a(0xf000000B) {printf("X : %3d\n", ((int)this)&0xfff);}
+ B() : a(0xf000000B) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -48,10 +57,20 @@ struct B : virtual B0 {
// CHECK: 24 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=24, align=8
// CHECK: | nvsize=24, nvalign=8]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct B
+// CHECK-X64: 0 | (B vbtable pointer)
+// CHECK-X64: 8 | struct B0 b0 (empty)
+// CHECK-X64: | [sizeof=8, align=8
+// CHECK-X64: | nvsize=0, nvalign=1]
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct C : virtual B0, virtual B1, virtual B2, virtual B3, virtual B4 {
int a;
- C() : a(0xf000000C) {printf("X : %3d\n", ((int)this)&0xfff);}
+ C() : a(0xf000000C) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -65,6 +84,17 @@ struct C : virtual B0, virtual B1, virtual B2, virtual B3, virtual B4 {
// CHECK: 40 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=40, align=8
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct C
+// CHECK-X64: 0 | (C vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: 24 | struct B1 (virtual base) (empty)
+// CHECK-X64: 32 | struct B2 (virtual base) (empty)
+// CHECK-X64: 40 | struct B3 (virtual base) (empty)
+// CHECK-X64: 48 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=48, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct D {
B0 b0;
@@ -73,36 +103,39 @@ struct D {
C2 c2;
B1 b1;
int a;
- D() : a(0xf000000D) {printf("X : %3d\n", ((int)this)&0xfff);}
+ D() : a(0xf000000D) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
// CHECK: 0 | struct D
// CHECK: 0 | struct B0 b0 (empty)
-// CHECK: | [sizeof=8, align=8
-// CHECK: | nvsize=0, nvalign=1]
// CHECK: 8 | struct C0 c0
// CHECK: 8 | int a
-// CHECK: | [sizeof=4, align=4
-// CHECK: | nvsize=4, nvalign=4]
// CHECK: 12 | struct C1 c1
// CHECK: 12 | int a
-// CHECK: | [sizeof=4, align=4
-// CHECK: | nvsize=4, nvalign=4]
// CHECK: 16 | struct C2 c2
// CHECK: 16 | int a
-// CHECK: | [sizeof=4, align=4
-// CHECK: | nvsize=4, nvalign=4]
// CHECK: 24 | struct B1 b1 (empty)
-// CHECK: | [sizeof=8, align=8
-// CHECK: | nvsize=0, nvalign=1]
// CHECK: 32 | int a
// CHECK: | [sizeof=40, align=8
// CHECK: | nvsize=40, nvalign=8]
+// CHECK-64: *** Dumping AST Record Layout
+// CHECK-64: 0 | struct D
+// CHECK-64: 0 | struct B0 b0 (empty)
+// CHECK-64: 8 | struct C0 c0
+// CHECK-64: 8 | int a
+// CHECK-64: 12 | struct C1 c1
+// CHECK-64: 12 | int a
+// CHECK-64: 16 | struct C2 c2
+// CHECK-64: 16 | int a
+// CHECK-64: 24 | struct B1 b1 (empty)
+// CHECK-64: 32 | int a
+// CHECK-64: | [sizeof=40, align=8
+// CHECK-64: | nvsize=40, nvalign=8]
struct E : virtual B0, virtual C0, virtual C1, virtual C2, virtual B1 {
int a;
- E() : a(0xf000000E) {printf("X : %3d\n", ((int)this)&0xfff);}
+ E() : a(0xf000000E) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -119,10 +152,24 @@ struct E : virtual B0, virtual C0, virtual C1, virtual C2, virtual B1 {
// CHECK: 24 | struct B1 (virtual base) (empty)
// CHECK: | [sizeof=24, align=8
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct E
+// CHECK-X64: 0 | (E vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: 16 | struct C0 (virtual base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 20 | struct C1 (virtual base)
+// CHECK-X64: 20 | int a
+// CHECK-X64: 24 | struct C2 (virtual base)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 32 | struct B1 (virtual base) (empty)
+// CHECK-X64: | [sizeof=32, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct F : virtual C0, virtual B0, virtual B1, virtual C1 {
int a;
- F() : a(0xf000000F) {printf("X : %3d\n", ((int)this)&0xfff);}
+ F() : a(0xf000000F) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -137,10 +184,22 @@ struct F : virtual C0, virtual B0, virtual B1, virtual C1 {
// CHECK: 24 | int a
// CHECK: | [sizeof=32, align=8
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F
+// CHECK-X64: 0 | (F vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct C0 (virtual base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: 32 | struct B1 (virtual base) (empty)
+// CHECK-X64: 32 | struct C1 (virtual base)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct G : virtual C0, virtual B0, virtual B1, D0, virtual C1 {
int a;
- G() : a(0xf0000010) {printf("X : %3d\n", ((int)this)&0xfff);}
+ G() : a(0xf0000010) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
virtual void f() {}
};
@@ -158,10 +217,24 @@ struct G : virtual C0, virtual B0, virtual B1, D0, virtual C1 {
// CHECK: 56 | int a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct G
+// CHECK-X64: 0 | struct D0 (primary base)
+// CHECK-X64: 0 | (D0 vftable pointer)
+// CHECK-X64: 8 | (G vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | struct C0 (virtual base)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 40 | struct B0 (virtual base) (empty)
+// CHECK-X64: 56 | struct B1 (virtual base) (empty)
+// CHECK-X64: 56 | struct C1 (virtual base)
+// CHECK-X64: 56 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=32, nvalign=16]
struct H : virtual C0, virtual B0, virtual B1, virtual D0, virtual C1 {
int a;
- H() : a(0xf0000011) {printf("X : %3d\n", ((int)this)&0xfff);}
+ H() : a(0xf0000011) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
virtual void f() {}
};
@@ -180,10 +253,25 @@ struct H : virtual C0, virtual B0, virtual B1, virtual D0, virtual C1 {
// CHECK: 52 | int a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct H
+// CHECK-X64: 0 | (H vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct C0 (virtual base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: 40 | struct B1 (virtual base) (empty)
+// CHECK-X64: 60 | (vtordisp for vbase D0)
+// CHECK-X64: 64 | struct D0 (virtual base)
+// CHECK-X64: 64 | (D0 vftable pointer)
+// CHECK-X64: 72 | struct C1 (virtual base)
+// CHECK-X64: 72 | int a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=16, nvalign=8]
struct I : virtual B0, virtual B1, virtual B2, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- I() : a(0xf0000012) {printf("X : %3d\n", ((int)this)&0xfff);}
+ I() : a(0xf0000012) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -197,10 +285,21 @@ struct I : virtual B0, virtual B1, virtual B2, virtual B3, virtual B4 {
// CHECK: 168 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=192, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct I
+// CHECK-X64: 0 | (I vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct B0 (virtual base) (empty)
+// CHECK-X64: 72 | struct B1 (virtual base) (empty)
+// CHECK-X64: 104 | struct B2 (virtual base) (empty)
+// CHECK-X64: 136 | struct B3 (virtual base) (empty)
+// CHECK-X64: 168 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=192, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct __declspec(align(32)) J : virtual B0, virtual B1, virtual B2, virtual B3, virtual B4 {
int a;
- J() : a(0xf0000012) {printf("X : %3d\n", ((int)this)&0xfff);}
+ J() : a(0xf0000012) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -214,10 +313,21 @@ struct __declspec(align(32)) J : virtual B0, virtual B1, virtual B2, virtual B3,
// CHECK: 136 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=160, align=32
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct J
+// CHECK-X64: 0 | (J vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: 40 | struct B1 (virtual base) (empty)
+// CHECK-X64: 72 | struct B2 (virtual base) (empty)
+// CHECK-X64: 104 | struct B3 (virtual base) (empty)
+// CHECK-X64: 136 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=160, align=32
+// CHECK-X64: | nvsize=16, nvalign=8]
struct K : virtual D1, virtual B1, virtual B2, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- K() : a(0xf0000013) {printf("X : %3d\n", ((int)this)&0xfff);}
+ K() : a(0xf0000013) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -231,10 +341,21 @@ struct K : virtual D1, virtual B1, virtual B2, virtual B3, virtual B4 {
// CHECK: 168 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=192, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct K
+// CHECK-X64: 0 | (K vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct D1 (virtual base) (empty)
+// CHECK-X64: 72 | struct B1 (virtual base) (empty)
+// CHECK-X64: 104 | struct B2 (virtual base) (empty)
+// CHECK-X64: 136 | struct B3 (virtual base) (empty)
+// CHECK-X64: 168 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=192, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct L : virtual B1, virtual D1, virtual B2, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- L() : a(0xf0000014) {printf("X : %3d\n", ((int)this)&0xfff);}
+ L() : a(0xf0000014) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -248,10 +369,21 @@ struct L : virtual B1, virtual D1, virtual B2, virtual B3, virtual B4 {
// CHECK: 168 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=192, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct L
+// CHECK-X64: 0 | (L vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct B1 (virtual base) (empty)
+// CHECK-X64: 68 | struct D1 (virtual base) (empty)
+// CHECK-X64: 104 | struct B2 (virtual base) (empty)
+// CHECK-X64: 136 | struct B3 (virtual base) (empty)
+// CHECK-X64: 168 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=192, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct M : virtual B1, virtual B2, virtual D1, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- M() : a(0xf0000015) {printf("X : %3d\n", ((int)this)&0xfff);}
+ M() : a(0xf0000015) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -265,10 +397,21 @@ struct M : virtual B1, virtual B2, virtual D1, virtual B3, virtual B4 {
// CHECK: 168 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=192, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct M
+// CHECK-X64: 0 | (M vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct B1 (virtual base) (empty)
+// CHECK-X64: 72 | struct B2 (virtual base) (empty)
+// CHECK-X64: 100 | struct D1 (virtual base) (empty)
+// CHECK-X64: 136 | struct B3 (virtual base) (empty)
+// CHECK-X64: 168 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=192, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct N : virtual C0, virtual B1, virtual D1, virtual B2, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- N() : a(0xf0000016) {printf("X : %3d\n", ((int)this)&0xfff);}
+ N() : a(0xf0000016) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -284,10 +427,23 @@ struct N : virtual C0, virtual B1, virtual D1, virtual B2, virtual B3, virtual B
// CHECK: 200 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=224, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct N
+// CHECK-X64: 0 | (N vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct C0 (virtual base)
+// CHECK-X64: 64 | int a
+// CHECK-X64: 72 | struct B1 (virtual base) (empty)
+// CHECK-X64: 100 | struct D1 (virtual base) (empty)
+// CHECK-X64: 136 | struct B2 (virtual base) (empty)
+// CHECK-X64: 168 | struct B3 (virtual base) (empty)
+// CHECK-X64: 200 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=224, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct O : virtual C0, virtual B1, virtual B2, virtual D1, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- O() : a(0xf0000017) {printf("X : %3d\n", ((int)this)&0xfff);}
+ O() : a(0xf0000017) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -303,10 +459,23 @@ struct O : virtual C0, virtual B1, virtual B2, virtual D1, virtual B3, virtual B
// CHECK: 200 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=224, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct O
+// CHECK-X64: 0 | (O vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct C0 (virtual base)
+// CHECK-X64: 64 | int a
+// CHECK-X64: 72 | struct B1 (virtual base) (empty)
+// CHECK-X64: 104 | struct B2 (virtual base) (empty)
+// CHECK-X64: 132 | struct D1 (virtual base) (empty)
+// CHECK-X64: 168 | struct B3 (virtual base) (empty)
+// CHECK-X64: 200 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=224, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct P : virtual B1, virtual C0, virtual D1, virtual B2, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- P() : a(0xf0000018) {printf("X : %3d\n", ((int)this)&0xfff);}
+ P() : a(0xf0000018) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -322,10 +491,23 @@ struct P : virtual B1, virtual C0, virtual D1, virtual B2, virtual B3, virtual B
// CHECK: 168 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=192, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct P
+// CHECK-X64: 0 | (P vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct B1 (virtual base) (empty)
+// CHECK-X64: 64 | struct C0 (virtual base)
+// CHECK-X64: 64 | int a
+// CHECK-X64: 68 | struct D1 (virtual base) (empty)
+// CHECK-X64: 104 | struct B2 (virtual base) (empty)
+// CHECK-X64: 136 | struct B3 (virtual base) (empty)
+// CHECK-X64: 168 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=192, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct Q : virtual B1, virtual C0, virtual B2, virtual D1, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- Q() : a(0xf0000019) {printf("X : %3d\n", ((int)this)&0xfff);}
+ Q() : a(0xf0000019) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -341,10 +523,23 @@ struct Q : virtual B1, virtual C0, virtual B2, virtual D1, virtual B3, virtual B
// CHECK: 168 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=192, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct Q
+// CHECK-X64: 0 | (Q vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct B1 (virtual base) (empty)
+// CHECK-X64: 64 | struct C0 (virtual base)
+// CHECK-X64: 64 | int a
+// CHECK-X64: 72 | struct B2 (virtual base) (empty)
+// CHECK-X64: 100 | struct D1 (virtual base) (empty)
+// CHECK-X64: 136 | struct B3 (virtual base) (empty)
+// CHECK-X64: 168 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=192, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct R : virtual B0, virtual B1, virtual B2, virtual C0, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- R() : a(0xf0000020) {printf("X : %3d\n", ((int)this)&0xfff);}
+ R() : a(0xf0000020) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -360,10 +555,23 @@ struct R : virtual B0, virtual B1, virtual B2, virtual C0, virtual B3, virtual B
// CHECK: 136 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=160, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct R
+// CHECK-X64: 0 | (R vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct B0 (virtual base) (empty)
+// CHECK-X64: 72 | struct B1 (virtual base) (empty)
+// CHECK-X64: 104 | struct B2 (virtual base) (empty)
+// CHECK-X64: 104 | struct C0 (virtual base)
+// CHECK-X64: 104 | int a
+// CHECK-X64: 112 | struct B3 (virtual base) (empty)
+// CHECK-X64: 136 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=160, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct S : virtual B0, virtual B1, virtual C0, virtual B2, virtual B3, virtual B4 {
__declspec(align(32)) int a;
- S() : a(0xf0000021) {printf("X : %3d\n", ((int)this)&0xfff);}
+ S() : a(0xf0000021) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -379,10 +587,23 @@ struct S : virtual B0, virtual B1, virtual C0, virtual B2, virtual B3, virtual B
// CHECK: 136 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=160, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct S
+// CHECK-X64: 0 | (S vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 64 | struct B0 (virtual base) (empty)
+// CHECK-X64: 72 | struct B1 (virtual base) (empty)
+// CHECK-X64: 72 | struct C0 (virtual base)
+// CHECK-X64: 72 | int a
+// CHECK-X64: 80 | struct B2 (virtual base) (empty)
+// CHECK-X64: 104 | struct B3 (virtual base) (empty)
+// CHECK-X64: 136 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=160, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct T : virtual B0, virtual B1, virtual C0, virtual D2, virtual B2, virtual B3, virtual B4 {
__declspec(align(16)) int a;
- T() : a(0xf0000022) {printf("X : %3d\n", ((int)this)&0xfff);}
+ T() : a(0xf0000022) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -400,10 +621,25 @@ struct T : virtual B0, virtual B1, virtual C0, virtual D2, virtual B2, virtual B
// CHECK: 104 | struct B4 (virtual base) (empty)
// CHECK: | [sizeof=112, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct T
+// CHECK-X64: 0 | (T vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | struct B0 (virtual base) (empty)
+// CHECK-X64: 40 | struct B1 (virtual base) (empty)
+// CHECK-X64: 40 | struct C0 (virtual base)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 44 | struct D2 (virtual base)
+// CHECK-X64: 44 | int [8] a
+// CHECK-X64: 80 | struct B2 (virtual base) (empty)
+// CHECK-X64: 88 | struct B3 (virtual base) (empty)
+// CHECK-X64: 104 | struct B4 (virtual base) (empty)
+// CHECK-X64: | [sizeof=112, align=16
+// CHECK-X64: | nvsize=32, nvalign=16]
struct __declspec(align(32)) U : virtual B0, virtual B1 {
int a;
- U() : a(0xf0000023) {printf("X : %3d\n", ((int)this)&0xfff);}
+ U() : a(0xf0000023) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -414,10 +650,18 @@ struct __declspec(align(32)) U : virtual B0, virtual B1 {
// CHECK: 40 | struct B1 (virtual base) (empty)
// CHECK: | [sizeof=64, align=32
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct U
+// CHECK-X64: 0 | (U vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: 40 | struct B1 (virtual base) (empty)
+// CHECK-X64: | [sizeof=64, align=32
+// CHECK-X64: | nvsize=16, nvalign=8]
struct __declspec(align(32)) V : virtual D1 {
int a;
- V() : a(0xf0000024) {printf("X : %3d\n", ((int)this)&0xfff);}
+ V() : a(0xf0000024) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
};
// CHECK: *** Dumping AST Record Layout
@@ -427,6 +671,13 @@ struct __declspec(align(32)) V : virtual D1 {
// CHECK: 8 | struct D1 (virtual base) (empty)
// CHECK: | [sizeof=32, align=32
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct V
+// CHECK-X64: 0 | (V vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct D1 (virtual base) (empty)
+// CHECK-X64: | [sizeof=32, align=32
+// CHECK-X64: | nvsize=16, nvalign=8]
int a[
sizeof(A)+
diff --git a/clang/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp b/clang/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp
index ec777941282..7dd3fad5bf4 100644
--- a/clang/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp
+++ b/clang/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
@@ -39,6 +41,16 @@ struct AA : B8, B1, virtual B0 {
// CHECK: 20 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=20, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AA
+// CHECK-X64: 0 | struct B8 (base)
+// CHECK-X64: 0 | char [5] c
+// CHECK-X64: 17 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AA vbtable pointer)
+// CHECK-X64: 20 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AB : B8, B1, virtual B0 {
short a;
@@ -55,6 +67,16 @@ struct AB : B8, B1, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AB
+// CHECK-X64: 0 | struct B8 (base)
+// CHECK-X64: 0 | char [5] c
+// CHECK-X64: 17 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AB vbtable pointer)
+// CHECK-X64: 18 | short a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AC : B8, B1, virtual B0 {
char a;
@@ -71,6 +93,16 @@ struct AC : B8, B1, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AC
+// CHECK-X64: 0 | struct B8 (base)
+// CHECK-X64: 0 | char [5] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AC vbtable pointer)
+// CHECK-X64: 16 | char a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AD : B8, B1, virtual B0 {
AD() { printf("AD = %p\n", this); }
@@ -85,6 +117,15 @@ struct AD : B8, B1, virtual B0 {
// CHECK: 12 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=12, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AD
+// CHECK-X64: 0 | struct B8 (base)
+// CHECK-X64: 0 | char [5] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AD vbtable pointer)
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct AA1 : B9, B1, virtual B0 {
int a;
@@ -101,6 +142,16 @@ struct AA1 : B9, B1, virtual B0 {
// CHECK: 20 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=20, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AA1
+// CHECK-X64: 0 | struct B9 (base)
+// CHECK-X64: 0 | char [6] c
+// CHECK-X64: 18 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AA1 vbtable pointer)
+// CHECK-X64: 20 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AB1 : B9, B1, virtual B0 {
short a;
@@ -117,6 +168,16 @@ struct AB1 : B9, B1, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AB1
+// CHECK-X64: 0 | struct B9 (base)
+// CHECK-X64: 0 | char [6] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AB1 vbtable pointer)
+// CHECK-X64: 16 | short a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AC1 : B9, B1, virtual B0 {
char a;
@@ -133,6 +194,16 @@ struct AC1 : B9, B1, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AC1
+// CHECK-X64: 0 | struct B9 (base)
+// CHECK-X64: 0 | char [6] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AC1 vbtable pointer)
+// CHECK-X64: 16 | char a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AD1 : B9, B1, virtual B0 {
AD1() { printf("AD1 = %p\n", this); }
@@ -147,6 +218,15 @@ struct AD1 : B9, B1, virtual B0 {
// CHECK: 12 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=12, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AD1
+// CHECK-X64: 0 | struct B9 (base)
+// CHECK-X64: 0 | char [6] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AD1 vbtable pointer)
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct AA2 : B10, B1, virtual B0 {
int a;
@@ -163,6 +243,16 @@ struct AA2 : B10, B1, virtual B0 {
// CHECK: 20 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=20, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AA2
+// CHECK-X64: 0 | struct B10 (base)
+// CHECK-X64: 0 | char [7] c
+// CHECK-X64: 19 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AA2 vbtable pointer)
+// CHECK-X64: 20 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AB2 : B10, B1, virtual B0 {
short a;
@@ -179,6 +269,16 @@ struct AB2 : B10, B1, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AB2
+// CHECK-X64: 0 | struct B10 (base)
+// CHECK-X64: 0 | char [7] c
+// CHECK-X64: 17 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AB2 vbtable pointer)
+// CHECK-X64: 18 | short a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AC2 : B10, B1, virtual B0 {
char a;
@@ -195,6 +295,16 @@ struct AC2 : B10, B1, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AC2
+// CHECK-X64: 0 | struct B10 (base)
+// CHECK-X64: 0 | char [7] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AC2 vbtable pointer)
+// CHECK-X64: 16 | char a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AD2 : B10, B1, virtual B0 {
AD2() { printf("AD2 = %p\n", this); }
@@ -209,6 +319,15 @@ struct AD2 : B10, B1, virtual B0 {
// CHECK: 12 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=12, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AD2
+// CHECK-X64: 0 | struct B10 (base)
+// CHECK-X64: 0 | char [7] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AD2 vbtable pointer)
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct AA3 : B11, B1, virtual B0 {
int a;
@@ -225,6 +344,16 @@ struct AA3 : B11, B1, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AA3
+// CHECK-X64: 0 | struct B11 (base)
+// CHECK-X64: 0 | char [8] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AA3 vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AB3 : B11, B1, virtual B0 {
short a;
@@ -241,6 +370,16 @@ struct AB3 : B11, B1, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AB3
+// CHECK-X64: 0 | struct B11 (base)
+// CHECK-X64: 0 | char [8] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AB3 vbtable pointer)
+// CHECK-X64: 16 | short a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AC3 : B11, B1, virtual B0 {
char a;
@@ -257,6 +396,16 @@ struct AC3 : B11, B1, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AC3
+// CHECK-X64: 0 | struct B11 (base)
+// CHECK-X64: 0 | char [8] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AC3 vbtable pointer)
+// CHECK-X64: 16 | char a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct AD3 : B11, B1, virtual B0 {
AD3() { printf("AD3 = %p\n", this); }
@@ -271,6 +420,15 @@ struct AD3 : B11, B1, virtual B0 {
// CHECK: 12 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=12, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AD3
+// CHECK-X64: 0 | struct B11 (base)
+// CHECK-X64: 0 | char [8] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (AD3 vbtable pointer)
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct B : B1, B2, virtual B0 {
B() { printf("B = %p\n", this); }
@@ -284,6 +442,14 @@ struct B : B1, B2, virtual B0 {
// CHECK: 8 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=8, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct B
+// CHECK-X64: 0 | struct B1 (base) (empty)
+// CHECK-X64: 16 | struct B2 (base) (empty)
+// CHECK-X64: 8 | (B vbtable pointer)
+// CHECK-X64: 16 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct C : B1, B2, B3, virtual B0 {
char a;
@@ -300,6 +466,16 @@ struct C : B1, B2, B3, virtual B0 {
// CHECK: 12 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=12, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct C
+// CHECK-X64: 0 | struct B1 (base) (empty)
+// CHECK-X64: 1 | struct B2 (base) (empty)
+// CHECK-X64: 16 | struct B3 (base) (empty)
+// CHECK-X64: 8 | (C vbtable pointer)
+// CHECK-X64: 16 | char a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct D : B1, B2, B3, B4, B5, virtual B0 {
int a;
@@ -318,6 +494,18 @@ struct D : B1, B2, B3, B4, B5, virtual B0 {
// CHECK: 12 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=12, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct D
+// CHECK-X64: 0 | struct B1 (base) (empty)
+// CHECK-X64: 1 | struct B2 (base) (empty)
+// CHECK-X64: 2 | struct B3 (base) (empty)
+// CHECK-X64: 3 | struct B4 (base) (empty)
+// CHECK-X64: 16 | struct B5 (base) (empty)
+// CHECK-X64: 8 | (D vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct E : B1, B6, B3, B4, B5, virtual B0 {
int a;
@@ -336,6 +524,18 @@ struct E : B1, B6, B3, B4, B5, virtual B0 {
// CHECK: 20 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=20, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct E
+// CHECK-X64: 0 | struct B1 (base) (empty)
+// CHECK-X64: 2 | struct B6 (base) (empty)
+// CHECK-X64: 3 | struct B3 (base) (empty)
+// CHECK-X64: 4 | struct B4 (base) (empty)
+// CHECK-X64: 17 | struct B5 (base) (empty)
+// CHECK-X64: 8 | (E vbtable pointer)
+// CHECK-X64: 20 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct F : B1, B6, B4, B8, B5, virtual B0 {
int a;
@@ -355,6 +555,19 @@ struct F : B1, B6, B4, B8, B5, virtual B0 {
// CHECK: 16 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F
+// CHECK-X64: 0 | struct B1 (base) (empty)
+// CHECK-X64: 2 | struct B6 (base) (empty)
+// CHECK-X64: 3 | struct B4 (base) (empty)
+// CHECK-X64: 3 | struct B8 (base)
+// CHECK-X64: 3 | char [5] c
+// CHECK-X64: 16 | struct B5 (base) (empty)
+// CHECK-X64: 8 | (F vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct G : B8, B1, virtual B0 {
int a;
@@ -373,6 +586,17 @@ struct G : B8, B1, virtual B0 {
// CHECK: 48 | struct B0 (virtual base) (empty)
// CHECK: | [sizeof=48, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct G
+// CHECK-X64: 0 | struct B8 (base)
+// CHECK-X64: 0 | char [5] c
+// CHECK-X64: 16 | struct B1 (base) (empty)
+// CHECK-X64: 8 | (G vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | int a1
+// CHECK-X64: 48 | struct B0 (virtual base) (empty)
+// CHECK-X64: | [sizeof=48, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct AX : B1X, B2X, B3X, B4X, virtual B0X {
int a;
@@ -390,6 +614,17 @@ struct AX : B1X, B2X, B3X, B4X, virtual B0X {
// CHECK: 48 | struct B0X (virtual base) (empty)
// CHECK: | [sizeof=48, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AX
+// CHECK-X64: 0 | struct B1X (base) (empty)
+// CHECK-X64: 16 | struct B2X (base) (empty)
+// CHECK-X64: 18 | struct B3X (base) (empty)
+// CHECK-X64: 33 | struct B4X (base) (empty)
+// CHECK-X64: 24 | (AX vbtable pointer)
+// CHECK-X64: 36 | int a
+// CHECK-X64: 48 | struct B0X (virtual base) (empty)
+// CHECK-X64: | [sizeof=48, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct BX : B2X, B1X, B3X, B4X, virtual B0X {
int a;
@@ -407,6 +642,17 @@ struct BX : B2X, B1X, B3X, B4X, virtual B0X {
// CHECK: 32 | struct B0X (virtual base) (empty)
// CHECK: | [sizeof=32, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct BX
+// CHECK-X64: 0 | struct B2X (base) (empty)
+// CHECK-X64: 1 | struct B1X (base) (empty)
+// CHECK-X64: 2 | struct B3X (base) (empty)
+// CHECK-X64: 17 | struct B4X (base) (empty)
+// CHECK-X64: 8 | (BX vbtable pointer)
+// CHECK-X64: 20 | int a
+// CHECK-X64: 32 | struct B0X (virtual base) (empty)
+// CHECK-X64: | [sizeof=32, align=16
+// CHECK-X64: | nvsize=32, nvalign=16]
struct CX : B1X, B3X, B2X, virtual B0X {
int a;
@@ -423,6 +669,16 @@ struct CX : B1X, B3X, B2X, virtual B0X {
// CHECK: 48 | struct B0X (virtual base) (empty)
// CHECK: | [sizeof=48, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct CX
+// CHECK-X64: 0 | struct B1X (base) (empty)
+// CHECK-X64: 2 | struct B3X (base) (empty)
+// CHECK-X64: 32 | struct B2X (base) (empty)
+// CHECK-X64: 8 | (CX vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct B0X (virtual base) (empty)
+// CHECK-X64: | [sizeof=48, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct DX : B8X, B1X, virtual B0X {
int a;
@@ -439,6 +695,16 @@ struct DX : B8X, B1X, virtual B0X {
// CHECK: 16 | struct B0X (virtual base) (empty)
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct DX
+// CHECK-X64: 0 | struct B8X (base)
+// CHECK-X64: 0 | short a
+// CHECK-X64: 18 | struct B1X (base) (empty)
+// CHECK-X64: 8 | (DX vbtable pointer)
+// CHECK-X64: 20 | int a
+// CHECK-X64: 24 | struct B0X (virtual base) (empty)
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
int a[
sizeof(AA)+
diff --git a/clang/test/Layout/ms-x86-primary-bases.cpp b/clang/test/Layout/ms-x86-primary-bases.cpp
index 79e72f4b161..bc9b801d99c 100644
--- a/clang/test/Layout/ms-x86-primary-bases.cpp
+++ b/clang/test/Layout/ms-x86-primary-bases.cpp
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
@@ -21,6 +23,14 @@ struct A : virtual B0 {
// CHECK: 8 | int a
// CHECK: | [sizeof=12, align=4
// CHECK: | nvsize=4, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct A
+// CHECK-X64: 0 | (A vbtable pointer)
+// CHECK-X64: 8 | struct B0 (virtual base)
+// CHECK-X64: 8 | (B0 vftable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=8, nvalign=8]
struct B : virtual B0 {
virtual void f() { printf("B"); }
@@ -34,6 +44,14 @@ struct B : virtual B0 {
// CHECK: 8 | int a
// CHECK: | [sizeof=12, align=4
// CHECK: | nvsize=4, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct B
+// CHECK-X64: 0 | (B vbtable pointer)
+// CHECK-X64: 8 | struct B0 (virtual base)
+// CHECK-X64: 8 | (B0 vftable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=8, nvalign=8]
struct C : virtual B0 {
virtual void g() { printf("A"); }
@@ -48,6 +66,15 @@ struct C : virtual B0 {
// CHECK: 12 | int a
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct C
+// CHECK-X64: 0 | (C vftable pointer)
+// CHECK-X64: 8 | (C vbtable pointer)
+// CHECK-X64: 16 | struct B0 (virtual base)
+// CHECK-X64: 16 | (B0 vftable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: | [sizeof=32, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct D : virtual B2, virtual B0 {
virtual void f() { printf("D"); }
@@ -65,6 +92,17 @@ struct D : virtual B2, virtual B0 {
// CHECK: 16 | int a
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct D
+// CHECK-X64: 0 | (D vftable pointer)
+// CHECK-X64: 8 | (D vbtable pointer)
+// CHECK-X64: 16 | struct B2 (virtual base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B0 (virtual base)
+// CHECK-X64: 24 | (B0 vftable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct E : B0, virtual B1 {
virtual void f() { printf("E"); }
@@ -82,6 +120,17 @@ struct E : B0, virtual B1 {
// CHECK: 16 | int a
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct E
+// CHECK-X64: 0 | struct B0 (primary base)
+// CHECK-X64: 0 | (B0 vftable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (E vbtable pointer)
+// CHECK-X64: 24 | struct B1 (virtual base)
+// CHECK-X64: 24 | (B1 vftable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct F : virtual B0, virtual B1 {
};
@@ -97,6 +146,17 @@ struct F : virtual B0, virtual B1 {
// CHECK: 16 | int a
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=4, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F
+// CHECK-X64: 0 | (F vbtable pointer)
+// CHECK-X64: 8 | struct B0 (virtual base)
+// CHECK-X64: 8 | (B0 vftable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B1 (virtual base)
+// CHECK-X64: 24 | (B1 vftable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=8, nvalign=8]
struct AX : B0X, B1X { int a; AX() : a(0xf000000A) {} virtual void f() { printf("A"); } };
@@ -110,6 +170,16 @@ struct AX : B0X, B1X { int a; AX() : a(0xf000000A) {} virtual void f() { printf(
// CHECK: 12 | int a
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct AX
+// CHECK-X64: 16 | struct B0X (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 0 | struct B1X (primary base)
+// CHECK-X64: 0 | (B1X vftable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 20 | int a
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct BX : B0X, B1X { int a; BX() : a(0xf000000B) {} virtual void g() { printf("B"); } };
@@ -123,6 +193,16 @@ struct BX : B0X, B1X { int a; BX() : a(0xf000000B) {} virtual void g() { printf(
// CHECK: 12 | int a
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=16, nvalign=4]
+// CHECK-x64: *** Dumping AST Record Layout
+// CHECK-x64: 0 | struct BX
+// CHECK-x64: 16 | struct B0X (base)
+// CHECK-x64: 16 | int a
+// CHECK-x64: 0 | struct B1X (primary base)
+// CHECK-x64: 0 | (B1X vftable pointer)
+// CHECK-x64: 8 | int a
+// CHECK-x64: 24 | int a
+// CHECK-x64: | [sizeof=24, align=8
+// CHECK-x64: | nvsize=24, nvalign=8]
struct CX : B0X, B2X { int a; CX() : a(0xf000000C) {} virtual void g() { printf("C"); } };
@@ -140,6 +220,20 @@ struct CX : B0X, B2X { int a; CX() : a(0xf000000C) {} virtual void g() { printf(
// CHECK: 24 | int a
// CHECK: | [sizeof=28, align=4
// CHECK: | nvsize=20, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct CX
+// CHECK-X64: 0 | (CX vftable pointer)
+// CHECK-X64: 8 | struct B0X (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B2X (base)
+// CHECK-X64: 16 | (B2X vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 32 | int a
+// CHECK-X64: 40 | struct B1X (virtual base)
+// CHECK-X64: 40 | (B1X vftable pointer)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=56, align=8
+// CHECK-X64: | nvsize=40, nvalign=8]
struct DX : virtual B1X { int a; DX() : a(0xf000000D) {} virtual void f() { printf("D"); } };
@@ -153,6 +247,16 @@ struct DX : virtual B1X { int a; DX() : a(0xf000000D) {} virtual void f() { prin
// CHECK: 16 | int a
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct DX
+// CHECK-X64: 0 | (DX vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 20 | (vtordisp for vbase B1X)
+// CHECK-X64: 24 | struct B1X (virtual base)
+// CHECK-X64: 24 | (B1X vftable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct EX : virtual B1X { int a; EX() : a(0xf000000E) {} virtual void g() { printf("E"); } };
@@ -166,6 +270,16 @@ struct EX : virtual B1X { int a; EX() : a(0xf000000E) {} virtual void g() { prin
// CHECK: 16 | int a
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct EX
+// CHECK-X64: 0 | (EX vftable pointer)
+// CHECK-X64: 8 | (EX vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct B1X (virtual base)
+// CHECK-X64: 24 | (B1X vftable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct FX : virtual B1X { int a; FX() : a(0xf000000F) {} };
@@ -178,6 +292,15 @@ struct FX : virtual B1X { int a; FX() : a(0xf000000F) {} };
// CHECK: 12 | int a
// CHECK: | [sizeof=16, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct FX
+// CHECK-X64: 0 | (FX vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B1X (virtual base)
+// CHECK-X64: 16 | (B1X vftable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: | [sizeof=32, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
int a[
sizeof(A)+
diff --git a/clang/test/Layout/ms-x86-size-alignment-fail.cpp b/clang/test/Layout/ms-x86-size-alignment-fail.cpp
index 6ce8a4b7203..bb0baa41dc4 100644
--- a/clang/test/Layout/ms-x86-size-alignment-fail.cpp
+++ b/clang/test/Layout/ms-x86-size-alignment-fail.cpp
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
@@ -15,6 +17,13 @@ struct A : virtual B0 {};
// CHECK: 4 | char a
// CHECK: | [sizeof=5, align=4
// CHECK: | nvsize=4, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct A
+// CHECK-X64: 0 | (A vbtable pointer)
+// CHECK-X64: 8 | struct B0 (virtual base)
+// CHECK-X64: 8 | char a
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=8, nvalign=8]
struct __declspec(align(1)) B : virtual B0 {};
@@ -25,6 +34,13 @@ struct __declspec(align(1)) B : virtual B0 {};
// CHECK: 4 | char a
// CHECK: | [sizeof=8, align=4
// CHECK: | nvsize=4, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct B
+// CHECK-X64: 0 | (B vbtable pointer)
+// CHECK-X64: 8 | struct B0 (virtual base)
+// CHECK-X64: 8 | char a
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=8, nvalign=8]
struct C : virtual B0 { int a; C() : a(0xC) {} };
@@ -36,6 +52,14 @@ struct C : virtual B0 { int a; C() : a(0xC) {} };
// CHECK: 8 | char a
// CHECK: | [sizeof=9, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct C
+// CHECK-X64: 0 | (C vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B0 (virtual base)
+// CHECK-X64: 16 | char a
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct D : virtual B0 { __declspec(align(1)) int a; D() : a(0xD) {} };
@@ -47,6 +71,14 @@ struct D : virtual B0 { __declspec(align(1)) int a; D() : a(0xD) {} };
// CHECK: 8 | char a
// CHECK: | [sizeof=12, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct D
+// CHECK-X64: 0 | (D vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B0 (virtual base)
+// CHECK-X64: 16 | char a
+// CHECK-X64: | [sizeof=24, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct E : virtual B0, virtual B1 {};
@@ -58,6 +90,14 @@ struct E : virtual B0, virtual B1 {};
// CHECK: 5 | struct B1 (virtual base) (empty)
// CHECK: | [sizeof=8, align=4
// CHECK: | nvsize=4, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct E
+// CHECK-X64: 0 | (E vbtable pointer)
+// CHECK-X64: 8 | struct B0 (virtual base)
+// CHECK-X64: 8 | char a
+// CHECK-X64: 9 | struct B1 (virtual base) (empty)
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=8, nvalign=8]
struct F { char a; virtual ~F(); };
@@ -67,6 +107,12 @@ struct F { char a; virtual ~F(); };
// CHECK: 4 | char a
// CHECK: | [sizeof=8, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F
+// CHECK-X64: 0 | (F vftable pointer)
+// CHECK-X64: 8 | char a
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
int a[
sizeof(A)+
diff --git a/clang/test/Layout/ms-x86-vfvb-alignment.cpp b/clang/test/Layout/ms-x86-vfvb-alignment.cpp
index 02056128100..8eea20959b0 100644
--- a/clang/test/Layout/ms-x86-vfvb-alignment.cpp
+++ b/clang/test/Layout/ms-x86-vfvb-alignment.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
@@ -24,6 +26,17 @@ struct A : B0, virtual B1 { __declspec(align(16)) int a; A() : a(0xf000000A) {}
// CHECK: 64 | char a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct A
+// CHECK-X64: 0 | (A vftable pointer)
+// CHECK-X64: 8 | struct B0 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (A vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct B1 (virtual base)
+// CHECK-X64: 48 | char a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct B : A, B2 { int a; B() : a(0xf000000B) {} virtual void f() { printf("B"); } };
@@ -43,6 +56,22 @@ struct B : A, B2 { int a; B() : a(0xf000000B) {} virtual void f() { printf("B");
// CHECK: 80 | char a
// CHECK: | [sizeof=96, align=16
// CHECK: | nvsize=80, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct B
+// CHECK-X64: 0 | struct A (primary base)
+// CHECK-X64: 0 | (A vftable pointer)
+// CHECK-X64: 8 | struct B0 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (A vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct B2 (base)
+// CHECK-X64: 48 | (B2 vbtable pointer)
+// CHECK-X64: 56 | int a
+// CHECK-X64: 64 | int a
+// CHECK-X64: 80 | struct B1 (virtual base)
+// CHECK-X64: 80 | char a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=80, nvalign=16]
struct C : B4 { int a; C() : a(0xf000000C) {} virtual void f() { printf("C"); } };
@@ -57,6 +86,17 @@ struct C : B4 { int a; C() : a(0xf000000C) {} virtual void f() { printf("C"); }
// CHECK: 32 | int a
// CHECK: | [sizeof=48, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct C
+// CHECK-X64: 0 | (C vftable pointer)
+// CHECK-X64: 16 | struct B4 (base)
+// CHECK-X64: 16 | (B4 vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct B3 (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct D : C { int a; D() : a(0xf000000D) {} virtual void f() { printf("D"); } };
@@ -73,6 +113,19 @@ struct D : C { int a; D() : a(0xf000000D) {} virtual void f() { printf("D"); } }
// CHECK: 48 | int a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct D
+// CHECK-X64: 0 | struct C (primary base)
+// CHECK-X64: 0 | (C vftable pointer)
+// CHECK-X64: 16 | struct B4 (base)
+// CHECK-X64: 16 | (B4 vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | int a
+// CHECK-X64: 64 | struct B3 (virtual base)
+// CHECK-X64: 64 | int a
+// CHECK-X64: | [sizeof=80, align=16
+// CHECK-X64: | nvsize=64, nvalign=16]
struct E : virtual C { int a; E() : a(0xf000000E) {} virtual void f() { printf("E"); } };
@@ -91,6 +144,21 @@ struct E : virtual C { int a; E() : a(0xf000000E) {} virtual void f() { printf("
// CHECK: 72 | int a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct E
+// CHECK-X64: 0 | (E vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B3 (virtual base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 44 | (vtordisp for vbase C)
+// CHECK-X64: 48 | struct C (virtual base)
+// CHECK-X64: 48 | (C vftable pointer)
+// CHECK-X64: 64 | struct B4 (base)
+// CHECK-X64: 64 | (B4 vbtable pointer)
+// CHECK-X64: 72 | int a
+// CHECK-X64: 80 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=16, nvalign=8]
struct F : B3, virtual B0 { int a; F() : a(0xf000000F) {} virtual void f() { printf("F"); } };
@@ -105,6 +173,17 @@ struct F : B3, virtual B0 { int a; F() : a(0xf000000F) {} virtual void f() { pri
// CHECK: 64 | int a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct F
+// CHECK-X64: 0 | (F vftable pointer)
+// CHECK-X64: 16 | struct B3 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | (F vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 48 | struct B0 (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct G : B2, B6, virtual B1 { int a; G() : a(0xf0000010) {} };
@@ -121,6 +200,19 @@ struct G : B2, B6, virtual B1 { int a; G() : a(0xf0000010) {} };
// CHECK: 20 | char a
// CHECK: | [sizeof=21, align=4
// CHECK: | nvsize=20, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct G
+// CHECK-X64: 16 | struct B2 (base)
+// CHECK-X64: 16 | (B2 vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 0 | struct B6 (primary base)
+// CHECK-X64: 0 | (B6 vftable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 32 | int a
+// CHECK-X64: 40 | struct B1 (virtual base)
+// CHECK-X64: 40 | char a
+// CHECK-X64: | [sizeof=48, align=8
+// CHECK-X64: | nvsize=40, nvalign=8]
struct H : B6, B2, virtual B1 { int a; H() : a(0xf0000011) {} };
@@ -137,6 +229,19 @@ struct H : B6, B2, virtual B1 { int a; H() : a(0xf0000011) {} };
// CHECK: 20 | char a
// CHECK: | [sizeof=21, align=4
// CHECK: | nvsize=20, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct H
+// CHECK-X64: 0 | struct B6 (primary base)
+// CHECK-X64: 0 | (B6 vftable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | struct B2 (base)
+// CHECK-X64: 16 | (B2 vbtable pointer)
+// CHECK-X64: 24 | int a
+// CHECK-X64: 32 | int a
+// CHECK-X64: 40 | struct B1 (virtual base)
+// CHECK-X64: 40 | char a
+// CHECK-X64: | [sizeof=48, align=8
+// CHECK-X64: | nvsize=40, nvalign=8]
struct I : B0, virtual B1 { int a; int a1; __declspec(align(16)) int a2; I() : a(0xf0000011), a1(0xf0000011), a2(0xf0000011) {} };
@@ -152,6 +257,18 @@ struct I : B0, virtual B1 { int a; int a1; __declspec(align(16)) int a2; I() : a
// CHECK: 48 | char a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct I
+// CHECK-X64: 0 | struct B0 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 8 | (I vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 20 | int a1
+// CHECK-X64: 32 | int a2
+// CHECK-X64: 48 | struct B1 (virtual base)
+// CHECK-X64: 48 | char a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct J : B0, B3, virtual B1 { int a; int a1; J() : a(0xf0000012), a1(0xf0000012) {} };
@@ -168,6 +285,19 @@ struct J : B0, B3, virtual B1 { int a; int a1; J() : a(0xf0000012), a1(0xf000001
// CHECK: 64 | char a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct J
+// CHECK-X64: 0 | struct B0 (base)
+// CHECK-X64: 0 | int a
+// CHECK-X64: 16 | struct B3 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | (J vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 44 | int a1
+// CHECK-X64: 48 | struct B1 (virtual base)
+// CHECK-X64: 48 | char a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct K { int a; K() : a(0xf0000013) {} virtual void f() { printf("K"); } };
@@ -177,6 +307,12 @@ struct K { int a; K() : a(0xf0000013) {} virtual void f() { printf("K"); } };
// CHECK: 4 | int a
// CHECK: | [sizeof=8, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct K
+// CHECK-X64: 0 | (K vftable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
struct L : virtual K { int a; L() : a(0xf0000014) {} virtual void g() { printf("L"); } };
@@ -190,6 +326,16 @@ struct L : virtual K { int a; L() : a(0xf0000014) {} virtual void g() { printf("
// CHECK: 16 | int a
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct L
+// CHECK-X64: 0 | (L vftable pointer)
+// CHECK-X64: 8 | (L vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 24 | struct K (virtual base)
+// CHECK-X64: 24 | (K vftable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=24, nvalign=8]
struct M : virtual K { int a; M() : a(0xf0000015) {} virtual void f() { printf("M"); } };
@@ -203,6 +349,16 @@ struct M : virtual K { int a; M() : a(0xf0000015) {} virtual void f() { printf("
// CHECK: 16 | int a
// CHECK: | [sizeof=20, align=4
// CHECK: | nvsize=8, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct M
+// CHECK-X64: 0 | (M vbtable pointer)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 20 | (vtordisp for vbase K)
+// CHECK-X64: 24 | struct K (virtual base)
+// CHECK-X64: 24 | (K vftable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: | [sizeof=40, align=8
+// CHECK-X64: | nvsize=16, nvalign=8]
int a[
sizeof(A)+
diff --git a/clang/test/Layout/ms-x86-vfvb-sharing.cpp b/clang/test/Layout/ms-x86-vfvb-sharing.cpp
index e736eaf095d..2b3d08e44c6 100644
--- a/clang/test/Layout/ms-x86-vfvb-sharing.cpp
+++ b/clang/test/Layout/ms-x86-vfvb-sharing.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
@@ -26,6 +28,17 @@ struct A : B0, virtual B1 {
// CHECK: 64 | int a
// CHECK: | [sizeof=80, align=16
// CHECK: | nvsize=64, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct A
+// CHECK-X64: 0 | (A vftable pointer)
+// CHECK-X64: 8 | struct B0 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (A vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct B1 (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct B : B2, B0, virtual B1 {
__declspec(align(16)) int a;
@@ -45,6 +58,18 @@ struct B : B2, B0, virtual B1 {
// CHECK: 48 | int a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct B
+// CHECK-X64: 0 | struct B2 (primary base)
+// CHECK-X64: 0 | (B2 vftable pointer)
+// CHECK-X64: 8 | struct B0 (base)
+// CHECK-X64: 8 | int a
+// CHECK-X64: 16 | (B vbtable pointer)
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct B1 (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct C : B3, B0, virtual B1 {
__declspec(align(16)) int a;
@@ -64,6 +89,18 @@ struct C : B3, B0, virtual B1 {
// CHECK: 48 | int a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=48, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct C
+// CHECK-X64: 0 | (C vftable pointer)
+// CHECK-X64: 8 | struct B3 (base)
+// CHECK-X64: 8 | (B3 vbtable pointer)
+// CHECK-X64: 16 | struct B0 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct B1 (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
struct D : B4, B0, virtual B1 {
__declspec(align(16)) int a;
@@ -83,6 +120,18 @@ struct D : B4, B0, virtual B1 {
// CHECK: 32 | int a
// CHECK: | [sizeof=48, align=16
// CHECK: | nvsize=32, nvalign=16]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct D
+// CHECK-X64: 0 | struct B4 (primary base)
+// CHECK-X64: 0 | (B4 vftable pointer)
+// CHECK-X64: 8 | (B4 vbtable pointer)
+// CHECK-X64: 16 | struct B0 (base)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 32 | int a
+// CHECK-X64: 48 | struct B1 (virtual base)
+// CHECK-X64: 48 | int a
+// CHECK-X64: | [sizeof=64, align=16
+// CHECK-X64: | nvsize=48, nvalign=16]
int a[
sizeof(A)+
diff --git a/clang/test/Layout/ms-x86-vtordisp.cpp b/clang/test/Layout/ms-x86-vtordisp.cpp
index 06ace3221a6..b16f09ed704 100644
--- a/clang/test/Layout/ms-x86-vtordisp.cpp
+++ b/clang/test/Layout/ms-x86-vtordisp.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
+// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
@@ -42,6 +44,21 @@ struct A : virtual B0, virtual B1 {
// CHECK: 52 | int a
// CHECK: | [sizeof=64, align=16
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct A
+// CHECK-X64: 0 | (A vftable pointer)
+// CHECK-X64: 8 | (A vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 36 | (vtordisp for vbase B0)
+// CHECK-X64: 40 | struct B0 (virtual base)
+// CHECK-X64: 40 | (B0 vftable pointer)
+// CHECK-X64: 48 | int a
+// CHECK-X64: 76 | (vtordisp for vbase B1)
+// CHECK-X64: 80 | struct B1 (virtual base)
+// CHECK-X64: 80 | (B1 vftable pointer)
+// CHECK-X64: 88 | int a
+// CHECK-X64: | [sizeof=96, align=16
+// CHECK-X64: | nvsize=24, nvalign=8]
struct C : virtual B0, virtual B1, VAlign32 {
int a;
@@ -67,6 +84,23 @@ struct C : virtual B0, virtual B1, VAlign32 {
// CHECK: 128 | struct Align32 (virtual base) (empty)
// CHECK: | [sizeof=128, align=32
// CHECK: | nvsize=64, nvalign=32]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct C
+// CHECK-X64: 0 | (C vftable pointer)
+// CHECK-X64: 32 | struct VAlign32 (base)
+// CHECK-X64: 32 | (VAlign32 vbtable pointer)
+// CHECK-X64: 40 | int a
+// CHECK-X64: 68 | (vtordisp for vbase B0)
+// CHECK-X64: 72 | struct B0 (virtual base)
+// CHECK-X64: 72 | (B0 vftable pointer)
+// CHECK-X64: 80 | int a
+// CHECK-X64: 108 | (vtordisp for vbase B1)
+// CHECK-X64: 112 | struct B1 (virtual base)
+// CHECK-X64: 112 | (B1 vftable pointer)
+// CHECK-X64: 120 | int a
+// CHECK-X64: 128 | struct Align32 (virtual base) (empty)
+// CHECK-X64: | [sizeof=128, align=32
+// CHECK-X64: | nvsize=64, nvalign=32]
struct __declspec(align(32)) D : virtual B0, virtual B1 {
int a;
@@ -90,22 +124,44 @@ struct __declspec(align(32)) D : virtual B0, virtual B1 {
// CHECK: 84 | int a
// CHECK: | [sizeof=96, align=32
// CHECK: | nvsize=12, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct D
+// CHECK-X64: 0 | (D vftable pointer)
+// CHECK-X64: 8 | (D vbtable pointer)
+// CHECK-X64: 16 | int a
+// CHECK-X64: 36 | (vtordisp for vbase B0)
+// CHECK-X64: 40 | struct B0 (virtual base)
+// CHECK-X64: 40 | (B0 vftable pointer)
+// CHECK-X64: 48 | int a
+// CHECK-X64: 76 | (vtordisp for vbase B1)
+// CHECK-X64: 80 | struct B1 (virtual base)
+// CHECK-X64: 80 | (B1 vftable pointer)
+// CHECK-X64: 88 | int a
+// CHECK-X64: | [sizeof=96, align=32
+// CHECK-X64: | nvsize=24, nvalign=8]
-struct AT {
- virtual ~AT(){}
-};
-struct CT : virtual AT {
- virtual ~CT();
-};
+struct AT {
+ virtual ~AT(){}
+};
+struct CT : virtual AT {
+ virtual ~CT();
+};
CT::~CT(){}
-// CHECK: *** Dumping AST Record Layout
-// CHECK: 0 | struct CT
-// CHECK: 0 | (CT vbtable pointer)
-// CHECK: 4 | struct AT (virtual base)
-// CHECK: 4 | (AT vftable pointer)
-// CHECK: | [sizeof=8, align=4
-// CHECK: | nvsize=4, nvalign=4]
+// CHECK: *** Dumping AST Record Layout
+// CHECK: 0 | struct CT
+// CHECK: 0 | (CT vbtable pointer)
+// CHECK: 4 | struct AT (virtual base)
+// CHECK: 4 | (AT vftable pointer)
+// CHECK: | [sizeof=8, align=4
+// CHECK: | nvsize=4, nvalign=4]
+// CHECK-X64: *** Dumping AST Record Layout
+// CHECK-X64: 0 | struct CT
+// CHECK-X64: 0 | (CT vbtable pointer)
+// CHECK-X64: 8 | struct AT (virtual base)
+// CHECK-X64: 8 | (AT vftable pointer)
+// CHECK-X64: | [sizeof=16, align=8
+// CHECK-X64: | nvsize=8, nvalign=8]
int a[
sizeof(A)+
diff --git a/clang/test/Sema/ms_bitfield_layout.c b/clang/test/Sema/ms_bitfield_layout.c
index 7efa0b3b16e..4a2076c1dba 100644
--- a/clang/test/Sema/ms_bitfield_layout.c
+++ b/clang/test/Sema/ms_bitfield_layout.c
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -cxx-abi microsoft -fdump-record-layouts %s 2>/dev/null \
// RUN: | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -cxx-abi microsoft -fdump-record-layouts %s 2>/dev/null \
+// RUN: | FileCheck %s
typedef struct A {
char x;
OpenPOWER on IntegriCloud