summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-13 22:05:23 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-13 22:05:23 +0000
commite75aaa97b366456b06193a35b5fee4ae63e3a03b (patch)
treeb162b3845cbe2c916c8d18ea02d4c9b38b1d8d90 /clang/test
parent3f9917de6ed29e4693eb4b7fef6e65d1b5062033 (diff)
downloadbcm5719-llvm-e75aaa97b366456b06193a35b5fee4ae63e3a03b.tar.gz
bcm5719-llvm-e75aaa97b366456b06193a35b5fee4ae63e3a03b.zip
Start laying out secondary vtables.
llvm-svn: 96123
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/vtable-layout.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/vtable-layout.cpp b/clang/test/CodeGenCXX/vtable-layout.cpp
index 622983f7c8e..d509431a52f 100644
--- a/clang/test/CodeGenCXX/vtable-layout.cpp
+++ b/clang/test/CodeGenCXX/vtable-layout.cpp
@@ -196,11 +196,50 @@ struct F : A {
virtual void g();
virtual R3 *f() = 0;
};
-
void F::g() { }
}
+namespace Test5 {
+
+// Simple secondary vtables without this-adjustments.
+struct A {
+ virtual void f();
+ virtual void g();
+ int a;
+};
+
+struct B1 : A {
+ virtual void f();
+ int b1;
+};
+
+struct B2 : A {
+ virtual void g();
+ int b2;
+};
+
+// CHECK: Vtable for 'Test5::C' (9 entries).
+// CHECK-NEXT: 0 | offset_to_top (0)
+// CHECK-NEXT: 1 | Test5::C RTTI
+// CHECK-NEXT: -- (Test5::A, 0) vtable address --
+// CHECK-NEXT: -- (Test5::B1, 0) vtable address --
+// CHECK-NEXT: -- (Test5::C, 0) vtable address --
+// CHECK-NEXT: 2 | void Test5::B1::f()
+// CHECK-NEXT: 3 | void Test5::A::g()
+// CHECK-NEXT: 4 | void Test5::C::h()
+// CHECK-NEXT: 5 | offset_to_top (-16)
+// CHECK-NEXT: 6 | Test5::C RTTI
+// CHECK-NEXT: -- (Test5::A, 16) vtable address --
+// CHECK-NEXT: -- (Test5::B2, 16) vtable address --
+// CHECK-NEXT: 7 | void Test5::A::f()
+// CHECK-NEXT: 8 | void Test5::B2::g()
+struct C : B1, B2 {
+ virtual void h();
+};
+void C::h() { }
+}
+
// For now, just verify this doesn't crash.
namespace test0 {
struct Obj {};
OpenPOWER on IntegriCloud