summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp
diff options
context:
space:
mode:
authorWarren Hunt <whunt@google.com>2014-01-09 23:51:31 +0000
committerWarren Hunt <whunt@google.com>2014-01-09 23:51:31 +0000
commit4df754d1530e70e5719cfd00b515cbfa8dbbe59f (patch)
tree44c8218c69f1fb248dabf7b4ffe4b45a2efc01bf /test/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp
parent27db771559cc2edd915b098a739d00b2a0bff13c (diff)
[ms-abi] Fixing CGRecordLayoutBuilder w.r.t. MS NonVirutalBase Layout
The MS abi lays out *all* non-virtual bases with leading vfptrs before laying out non-virutal bases without vfptrs. This guarantees that the primary base is laid out first. r198818 fixed RecordLayoutBuilder to produce compatiable layouts. This patch fixes CGRecordLayoutBuilder to be able to consume those layouts and produce meaningful output without tripping any asserts about assumed incoming layout. A test case is included that shows CGRecordLayoutBuilder in fact produces output in the compatiable order. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198900 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp')
-rwxr-xr-xtest/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp b/test/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp
new file mode 100755
index 0000000000..f09c47e0fd
--- /dev/null
+++ b/test/CodeGenCXX/microsoft-abi-non-virtual-base-ordering.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -cxx-abi microsoft -triple=i686-pc-win32 -o - %s 2>/dev/null | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -emit-llvm -cxx-abi microsoft -triple=x86_64-pc-win32 -o - %s 2>/dev/null | FileCheck %s
+
+struct C0 { int a; };
+struct C1 { int a; virtual void C1M() {} };
+struct C2 { int a; virtual void C2M() {} };
+struct C3 : C0, C1, C2 {} a;
+
+// Check to see that both C1 and C2 get laid out before C0 does.
+// CHECK: %struct.C3 = type { %struct.C1, %struct.C2, %struct.C0 }