Files
clang-p2996/clang/test/CodeGenCXX/RelativeVTablesABI/available_externally-vtable.cpp
Leonard Chan 71568a9e28 [clang] Frontend components for the relative vtables ABI (round 2)
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
2020-06-11 11:17:08 -07:00

24 lines
848 B
C++

// Check that available_externally vtables do not receive aliases.
// We check this specifically under the legacy pass manager because the new pass
// manager seems to remove available_externally vtables from the IR entirely.
// RUN: %clang_cc1 %s -triple=aarch64-unknown-fuchsia -O1 -S -o - -emit-llvm -fexperimental-relative-c++-abi-vtables -fno-experimental-new-pass-manager | FileCheck %s
// The VTable for A is available_externally, meaning it can have a definition in
// IR, but is never emitted in this compilation unit. Because it won't be
// emitted here, we cannot make an alias, but we won't need to in the first
// place.
// CHECK: @_ZTV1A = available_externally unnamed_addr constant { [3 x i32] }
// CHECK-NOT: @_ZTV1A = {{.*}}alias
class A {
public:
virtual void foo();
};
void A_foo(A *a);
void func() {
A a;
A_foo(&a);
}