summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-08-06 14:12:47 +0000
committerMike Stump <mrs@apple.com>2009-08-06 14:12:47 +0000
commit04df9b1d5efe9d826e67582d8158aff96e9d5828 (patch)
treee7ecfd01e7f19f0fd6efd815222f1e8efde34b63
parent6b2556f829c95c390468a278a5c718c92c6e28cd (diff)
downloadbcm5719-llvm-04df9b1d5efe9d826e67582d8158aff96e9d5828.tar.gz
bcm5719-llvm-04df9b1d5efe9d826e67582d8158aff96e9d5828.zip
Testcase for a recent checkin for vbase layout ordering. I hate to
optimize and check for non-optimal code, but until the frontend is as powerful as fold... llvm-svn: 78309
-rw-r--r--clang/test/CodeGenCXX/virt.cpp48
1 files changed, 26 insertions, 22 deletions
diff --git a/clang/test/CodeGenCXX/virt.cpp b/clang/test/CodeGenCXX/virt.cpp
index a90e7228d3e..35548de0436 100644
--- a/clang/test/CodeGenCXX/virt.cpp
+++ b/clang/test/CodeGenCXX/virt.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -frtti=0 -std=c++0x -S %s -o %t-64.s &&
+// RUN: clang-cc -triple x86_64-apple-darwin -frtti=0 -std=c++0x -O3 -S %s -o %t-64.s &&
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
-// RUN: clang-cc -triple i386-apple-darwin -frtti=0 -std=c++0x -S %s -o %t-32.s &&
+// RUN: clang-cc -triple i386-apple-darwin -frtti=0 -std=c++0x -O3 -S %s -o %t-32.s &&
// RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s &&
// RUN: true
@@ -24,6 +24,30 @@ struct D {
};
void D::boo() { }
+struct D1 {
+ virtual void bar();
+ void *d1;
+};
+void D1::bar() { }
+
+class F : virtual public D1, virtual public D {
+public:
+ virtual void foo();
+ void *f;
+};
+void F::foo() { }
+
+int j;
+void test2() {
+ F f;
+ static int sz = (char *)(&f.f) - (char *)(&f);
+ j = sz;
+ // CHECK-LP32: movl $4, __ZZ5test2vE2sz
+ // CHECK-LP64: movl $8, __ZZ5test2vE2sz(%rip)
+}
+
+static_assert(sizeof(F) == sizeof(void*)*4, "invalid vbase size");
+
struct E {
int e;
};
@@ -90,23 +114,3 @@ int main() {
// CHECK-LP32: .space 4
// CHECK-LP32: .long __ZN1C4bee1Ev
// CHECK-LP32: .long __ZN1C4bee2Ev
-
-struct D1 {
- virtual void bar();
- void *d1;
-};
-void D1::bar() { }
-
-class F : virtual public D1, virtual public D {
-public:
- virtual void foo();
- void *f;
-};
-void F::foo() { }
-
-void test2() {
- F f;
- f.f = 0;
-}
-
-static_assert(sizeof(F) == sizeof(void*)*4, "invalid vbase size");
OpenPOWER on IntegriCloud