diff options
author | Anders Carlsson <andersca@mac.com> | 2011-04-17 21:56:13 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2011-04-17 21:56:13 +0000 |
commit | fcaaa697ec3e6ab3cb38ad614102b16fcfb28a32 (patch) | |
tree | a68369232a9233c45353940bf1e41a4c72e18ba2 /clang/test/CodeGenCXX/class-layout.cpp | |
parent | 2caf2074fd29add31565d619b6296e08577f9fdd (diff) | |
download | bcm5719-llvm-fcaaa697ec3e6ab3cb38ad614102b16fcfb28a32.tar.gz bcm5719-llvm-fcaaa697ec3e6ab3cb38ad614102b16fcfb28a32.zip |
When laying out bases in, always try the "base subobject" LLVM type. If it
turns out that a field or base needs to be laid out in the tail padding of
the base, CGRecordLayoutBuilder::ResizeLastBaseFieldIfNecessary will convert
it to an array of i8.
I've audited the new test results to make sure that they are still valid. I've
also verified that we pass a self-host with this change.
This (finally) fixes PR5589!
llvm-svn: 129673
Diffstat (limited to 'clang/test/CodeGenCXX/class-layout.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/class-layout.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/class-layout.cpp b/clang/test/CodeGenCXX/class-layout.cpp index 6675b4963bd..672ce03f309 100644 --- a/clang/test/CodeGenCXX/class-layout.cpp +++ b/clang/test/CodeGenCXX/class-layout.cpp @@ -17,3 +17,31 @@ namespace Test3 { // CHECK: %"struct.Test3::A" = type { i32 (...)**, i32 } struct A { virtual void f(); int a; } *a; } + +namespace Test4 { + // Test from PR5589. + // CHECK: %"struct.Test4::A" = type { i32, i8, float } + // CHECK: %"struct.Test4::B" = type { %"struct.Test4::A", i16, double } + struct A { + int a; + char c; + float b; + }; + struct B : public A { + short d; + double e; + } *b; +} + +namespace Test5 { + struct A { + virtual void f(); + char a; + }; + + // CHECK: %"struct.Test4::B" = type { [9 x i8], i8, i8, [5 x i8] } + struct B : A { + char b : 1; + char c; + } *b; +} |