xref: /llvm-project/clang/test/CodeGenCXX/RelativeVTablesABI/available_externally-vtable.cpp (revision 0d501f38f348cf046d40c9baee12f0c5145b6d8c)
1 // Check that available_externally vtables do not receive aliases.
2 // We check this specifically under the legacy pass manager because the new pass
3 // manager seems to remove available_externally vtables from the IR entirely.
4 
5 // RUN: %clang_cc1 %s -triple=aarch64-unknown-fuchsia -O1 -disable-llvm-passes -o - -emit-llvm | FileCheck %s
6 
7 // The VTable for A is available_externally, meaning it can have a definition in
8 // IR, but is never emitted in this compilation unit. Because it won't be
9 // emitted here, we cannot make an alias, but we won't need to in the first
10 // place.
11 // CHECK: @_ZTV1A = available_externally unnamed_addr constant { [3 x i32] }
12 // CHECK-NOT: @_ZTV1A = {{.*}}alias
13 
14 class A {
15 public:
16   virtual void foo();
17 };
18 void A_foo(A *a);
19 
func()20 void func() {
21   A a;
22   A_foo(&a);
23 }
24