171568a9eSLeonard Chan // Check that available_externally vtables do not receive aliases.
271568a9eSLeonard Chan // We check this specifically under the legacy pass manager because the new pass
371568a9eSLeonard Chan // manager seems to remove available_externally vtables from the IR entirely.
471568a9eSLeonard Chan 
5*29363f80SArthur Eubanks // RUN: %clang_cc1 %s -triple=aarch64-unknown-fuchsia -O1 -disable-llvm-passes -S -o - -emit-llvm | FileCheck %s
671568a9eSLeonard Chan 
771568a9eSLeonard Chan // The VTable for A is available_externally, meaning it can have a definition in
871568a9eSLeonard Chan // IR, but is never emitted in this compilation unit. Because it won't be
971568a9eSLeonard Chan // emitted here, we cannot make an alias, but we won't need to in the first
1071568a9eSLeonard Chan // place.
1171568a9eSLeonard Chan // CHECK: @_ZTV1A = available_externally unnamed_addr constant { [3 x i32] }
1271568a9eSLeonard Chan // CHECK-NOT: @_ZTV1A = {{.*}}alias
1371568a9eSLeonard Chan 
1471568a9eSLeonard Chan class A {
1571568a9eSLeonard Chan public:
1671568a9eSLeonard Chan   virtual void foo();
1771568a9eSLeonard Chan };
1871568a9eSLeonard Chan void A_foo(A *a);
1971568a9eSLeonard Chan 
func()2071568a9eSLeonard Chan void func() {
2171568a9eSLeonard Chan   A a;
2271568a9eSLeonard Chan   A_foo(&a);
2371568a9eSLeonard Chan }
24