171568a9eSLeonard Chan // Check the layout of the vtable for a child class that inherits a virtual
271568a9eSLeonard Chan // function but does override it.
371568a9eSLeonard Chan
4*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers %s -triple=aarch64-unknown-fuchsia -O1 -S -o - -emit-llvm -fhalf-no-semantic-interposition | FileCheck %s
571568a9eSLeonard Chan
6cf8ff75bSLeonard Chan // CHECK: @_ZTV1B.local = private unnamed_addr constant { [4 x i32] } { [4 x i32] [i32 0, i32 trunc (i64 sub (i64 ptrtoint ({ i8*, i8*, i8* }** @_ZTI1B.rtti_proxy to i64), i64 ptrtoint (i32* getelementptr inbounds ({ [4 x i32] }, { [4 x i32] }* @_ZTV1B.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (void (%class.B*)* dso_local_equivalent @_ZN1B3fooEv to i64), i64 ptrtoint (i32* getelementptr inbounds ({ [4 x i32] }, { [4 x i32] }* @_ZTV1B.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (void (%class.B*)* dso_local_equivalent @_ZN1B3barEv to i64), i64 ptrtoint (i32* getelementptr inbounds ({ [4 x i32] }, { [4 x i32] }* @_ZTV1B.local, i32 0, i32 0, i32 2) to i64)) to i32)] }, align 4
771568a9eSLeonard Chan
8fd739804SFangrui Song // CHECK: @_ZTV1B ={{.*}} unnamed_addr alias { [4 x i32] }, { [4 x i32] }* @_ZTV1B.local
971568a9eSLeonard Chan
1071568a9eSLeonard Chan class A {
1171568a9eSLeonard Chan public:
1271568a9eSLeonard Chan virtual void foo();
1371568a9eSLeonard Chan };
1471568a9eSLeonard Chan
1571568a9eSLeonard Chan class B : public A {
1671568a9eSLeonard Chan public:
1771568a9eSLeonard Chan void foo() override;
1871568a9eSLeonard Chan virtual void bar();
1971568a9eSLeonard Chan };
2071568a9eSLeonard Chan
foo()2171568a9eSLeonard Chan void A::foo() {}
foo()2271568a9eSLeonard Chan void B::foo() {}
2371568a9eSLeonard Chan
A_foo(A * a)2471568a9eSLeonard Chan void A_foo(A *a) {
2571568a9eSLeonard Chan a->foo();
2671568a9eSLeonard Chan }
2771568a9eSLeonard Chan
B_foo(B * b)2871568a9eSLeonard Chan void B_foo(B *b) {
2971568a9eSLeonard Chan b->foo();
3071568a9eSLeonard Chan }
31