]> granicus.if.org Git - clang/commitdiff
Makes A Microsoft Layout CodeGen Test Explicit
authorWarren Hunt <whunt@google.com>
Thu, 14 Nov 2013 22:34:59 +0000 (22:34 +0000)
committerWarren Hunt <whunt@google.com>
Thu, 14 Nov 2013 22:34:59 +0000 (22:34 +0000)
This patch tests introduces a proper codegen test in place of the
"codegen no longer crashes" test introduced in r193664. The test is also
moved from layout to CodeGenCXX.

Differential Revision: http://llvm-reviews.chandlerc.com/D2174

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194739 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGenCXX/microsoft-abi-alignment-fail.cpp [new file with mode: 0644]
test/Layout/ms-x86-size-alignment-fail.cpp

diff --git a/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp b/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp
new file mode 100644 (file)
index 0000000..7407efe
--- /dev/null
@@ -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 -check-prefix CHECK-X64
+
+struct B { char a; };
+struct A : virtual B {} a;
+
+// The <> indicate that the pointer is packed, which is required to support
+// microsoft layout in 32 bit mode, but not 64 bit mode.
+// CHECK: %struct.A = type <{ i32*, %struct.B }>\r
+// CHECK-X64: %struct.A = type { i32*, %struct.B }\r
index 5ff440fb9b13332ff7e3a73444498d327e667ff4..f998ee12c8d12879dbaf970cd1f185821e046436 100644 (file)
@@ -8,7 +8,7 @@ extern "C" int printf(const char *fmt, ...);
 struct B0 { char a; B0() : a(0xB0) {} };
 struct __declspec(align(1)) B1 {};
 
-struct A : virtual B0 {} b;
+struct A : virtual B0 {};
 
 // CHECK: *** Dumping AST Record Layout
 // CHECK:    0 | struct A