2009-08-05 04:37:29 +08:00
|
|
|
// RUN: clang-cc -triple x86_64-apple-darwin -frtti=0 -std=c++0x -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: FileCheck -check-prefix LP32 -input-file=%t-32.s %s &&
|
|
|
|
// RUN: true
|
2009-07-30 08:22:38 +08:00
|
|
|
|
2009-08-05 05:58:42 +08:00
|
|
|
struct B {
|
|
|
|
virtual void bar1();
|
|
|
|
virtual void bar2();
|
2009-08-06 08:38:46 +08:00
|
|
|
int b;
|
2009-08-05 05:58:42 +08:00
|
|
|
};
|
2009-08-06 06:37:18 +08:00
|
|
|
void B::bar1() { }
|
|
|
|
void B::bar2() { }
|
|
|
|
|
|
|
|
struct C {
|
|
|
|
virtual void bee1();
|
|
|
|
virtual void bee2();
|
|
|
|
};
|
|
|
|
void C::bee1() { }
|
|
|
|
void C::bee2() { }
|
2009-08-05 05:58:42 +08:00
|
|
|
|
2009-08-06 08:38:46 +08:00
|
|
|
struct D {
|
|
|
|
virtual void boo();
|
|
|
|
};
|
|
|
|
void D::boo() { }
|
|
|
|
|
|
|
|
struct E {
|
|
|
|
int e;
|
|
|
|
};
|
2009-08-05 05:58:42 +08:00
|
|
|
|
2009-08-06 08:38:46 +08:00
|
|
|
static_assert (sizeof (C) == (sizeof(void *)), "vtable pointer layout");
|
|
|
|
|
|
|
|
class A : public E, public B, public C, /* virtual */ public D {
|
2009-07-30 08:22:38 +08:00
|
|
|
public:
|
2009-08-05 04:37:29 +08:00
|
|
|
virtual void foo1();
|
|
|
|
virtual void foo2();
|
|
|
|
A() { }
|
2009-08-06 08:38:46 +08:00
|
|
|
int a;
|
|
|
|
} *ap;
|
2009-08-06 06:37:18 +08:00
|
|
|
void A::foo1() { }
|
|
|
|
void A::foo2() { }
|
2009-07-30 08:22:38 +08:00
|
|
|
|
2009-08-05 04:37:29 +08:00
|
|
|
int main() {
|
|
|
|
A a;
|
2009-08-06 06:48:36 +08:00
|
|
|
B b;
|
2009-08-06 08:38:46 +08:00
|
|
|
ap->e = 1;
|
|
|
|
ap->b = 2;
|
2009-08-05 04:37:29 +08:00
|
|
|
}
|
|
|
|
|
2009-08-06 08:38:46 +08:00
|
|
|
// CHECK-LP32: main:
|
|
|
|
// CHECK-LP32: movl $1, 8(%eax)
|
|
|
|
// CHECK-LP32: movl $2, 4(%eax)
|
|
|
|
|
|
|
|
// CHECK-LP64: main:
|
|
|
|
// CHECK-LP64: movl $1, 12(%rax)
|
|
|
|
// CHECK-LP64: movl $2, 8(%rax)
|
|
|
|
|
2009-08-06 06:48:36 +08:00
|
|
|
// CHECK-LP64: __ZTV1B:
|
|
|
|
// CHECK-LP64: .space 8
|
|
|
|
// CHECK-LP64: .space 8
|
|
|
|
// CHECK-LP64: .quad __ZN1B4bar1Ev
|
|
|
|
// CHECK-LP64: .quad __ZN1B4bar2Ev
|
|
|
|
|
|
|
|
// CHECK-LP32: __ZTV1B:
|
|
|
|
// CHECK-LP32: .space 4
|
|
|
|
// CHECK-LP32: .space 4
|
|
|
|
// CHECK-LP32: .long __ZN1B4bar1Ev
|
|
|
|
// CHECK-LP32: .long __ZN1B4bar2Ev
|
|
|
|
|
2009-08-05 04:37:29 +08:00
|
|
|
// CHECK-LP64: __ZTV1A:
|
|
|
|
// CHECK-LP64: .space 8
|
|
|
|
// CHECK-LP64: .space 8
|
2009-08-05 05:58:42 +08:00
|
|
|
// CHECK-LP64: .quad __ZN1B4bar1Ev
|
|
|
|
// CHECK-LP64: .quad __ZN1B4bar2Ev
|
2009-08-05 04:37:29 +08:00
|
|
|
// CHECK-LP64: .quad __ZN1A4foo1Ev
|
|
|
|
// CHECK-LP64: .quad __ZN1A4foo2Ev
|
2009-08-06 08:38:46 +08:00
|
|
|
// CHECK-LP64: .quad 18446744073709551600
|
2009-08-06 06:37:18 +08:00
|
|
|
// CHECK-LP64: .space 8
|
|
|
|
// CHECK-LP64: .quad __ZN1C4bee1Ev
|
|
|
|
// CHECK-LP64: .quad __ZN1C4bee2Ev
|
2009-08-05 04:37:29 +08:00
|
|
|
|
|
|
|
// CHECK-LP32: __ZTV1A:
|
|
|
|
// CHECK-LP32: .space 4
|
|
|
|
// CHECK-LP32: .space 4
|
2009-08-05 05:58:42 +08:00
|
|
|
// CHECK-LP32: .long __ZN1B4bar1Ev
|
|
|
|
// CHECK-LP32: .long __ZN1B4bar2Ev
|
2009-08-05 04:37:29 +08:00
|
|
|
// CHECK-LP32: .long __ZN1A4foo1Ev
|
|
|
|
// CHECK-LP32: .long __ZN1A4foo2Ev
|
2009-08-06 08:38:46 +08:00
|
|
|
// CHECK-LP32: .long 4294967284
|
2009-08-06 06:37:18 +08:00
|
|
|
// CHECK-LP32: .space 4
|
|
|
|
// CHECK-LP32: .long __ZN1C4bee1Ev
|
|
|
|
// CHECK-LP32: .long __ZN1C4bee2Ev
|