diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-04-10 19:09:43 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-04-10 19:09:43 +0000 |
commit | d378a71b4e38127e7d658d2e6efa551731b78d8c (patch) | |
tree | 706bb7af4b5b228aa3ca72d0647e3a6807d8bde6 /clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp | |
parent | 7701194d61d41b531a9d99e419b4a200091b27a7 (diff) | |
download | bcm5719-llvm-d378a71b4e38127e7d658d2e6efa551731b78d8c.tar.gz bcm5719-llvm-d378a71b4e38127e7d658d2e6efa551731b78d8c.zip |
inalloca: Pad the struct *after* inserting each arg
This ensures that the overall struct size will be a multiple of 4, as
required by the ABI.
llvm-svn: 205981
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp b/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp index 3d5fe9c9a17..bc937491a57 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp @@ -49,7 +49,7 @@ struct Big { // WIN32: declare void @"{{.*take_bools_and_chars.*}}" // WIN32: (<{ i8, [3 x i8], i8, [3 x i8], %struct.SmallWithDtor, -// WIN32: i8, [3 x i8], i8, [3 x i8], i32, i8 }>* inalloca) +// WIN32: i8, [3 x i8], i8, [3 x i8], i32, i8, [3 x i8] }>* inalloca) void take_bools_and_chars(char a, char b, SmallWithDtor c, char d, bool e, int f, bool g); void call_bools_and_chars() { take_bools_and_chars('A', 'B', SmallWithDtor(), 'D', true, 13, false); @@ -223,7 +223,7 @@ struct X { }; void g(X) { } -// WIN32: define void @"\01?g@@YAXUX@@@Z"(<{ %struct.X }>* inalloca) {{.*}} { +// WIN32: define void @"\01?g@@YAXUX@@@Z"(<{ %struct.X, [3 x i8] }>* inalloca) {{.*}} { // WIN32: call x86_thiscallcc void @"\01??1X@@QAE@XZ"(%struct.X* {{.*}}) // WIN32: } void f() { @@ -264,6 +264,20 @@ void bar() { } +namespace test3 { + +// Check that we padded the inalloca struct to a multiple of 4. +struct NonTrivial { + NonTrivial(); + NonTrivial(const NonTrivial &o); + ~NonTrivial(); + int a; +}; +void foo(NonTrivial a, bool b) { } +// WIN32-LABEL: define void @"\01?foo@test3@@YAXUNonTrivial@1@_N@Z"(<{ %"struct.test3::NonTrivial", i8, [3 x i8] }>* inalloca) + +} + // We would crash here because the later definition of ForwardDeclare1 results // in a different IR type for the value we want to store. However, the alloca's // type will use the argument type selected by fn1. |