This patch contains all of the clang changes from D72959. - Generalize the relative vtables ABI such that it can be used by other targets. - Add an enum VTableComponentLayout which controls whether components in the vtable should be pointers to other structs or relative offsets to those structs. Other ABIs can change this enum to restructure how components in the vtable are laid out/accessed. - Add methods to ConstantInitBuilder for inserting relative offsets to a specified position in the aggregate being constructed. - Fix failing tests under new PM and ASan and MSan issues. See D72959 for background info. Differential Revision: https://reviews.llvm.org/D77592
20 lines
690 B
C++
20 lines
690 B
C++
// Check that a vtable is made hidden instead of private if the original vtable
|
|
// is not dso_local. The vtable will need to be hidden and not private so it can
|
|
// be used as acomdat key signature.
|
|
|
|
// RUN: %clang_cc1 %s -triple=aarch64-unknown-fuchsia -S -o - -emit-llvm -fexperimental-relative-c++-abi-vtables | FileCheck %s
|
|
|
|
// CHECK: @_ZTV1B.local = linkonce_odr hidden unnamed_addr constant
|
|
// CHECK: @_ZTV1B = linkonce_odr unnamed_addr alias { [3 x i32] }, { [3 x i32] }* @_ZTV1B.local
|
|
|
|
// The VTable will be in a comdat here since it has no key function.
|
|
class B {
|
|
public:
|
|
inline virtual void func() {}
|
|
};
|
|
|
|
// This is here just to manifest the vtable for B.
|
|
void func() {
|
|
B b;
|
|
}
|