diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-16 00:51:21 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-16 00:51:21 +0000 |
| commit | 65fd2a4e905daf579a5497ed9cd1d177e96f3e10 (patch) | |
| tree | b0e349dba293b38b97d14616b2c82093b063c6ee /clang/test | |
| parent | 83a6e3bfabb392cfa636d921b19db48ef45b69d0 (diff) | |
| download | bcm5719-llvm-65fd2a4e905daf579a5497ed9cd1d177e96f3e10.tar.gz bcm5719-llvm-65fd2a4e905daf579a5497ed9cd1d177e96f3e10.zip | |
Emit vtables for an extern template class as available_externally, not as
linkonce_odr. Emit construction vtables as internal in this case, since the ABI
does not guarantee that they will be availble externally.
llvm-svn: 175330
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGenCXX/vtable-linkage.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/vtable-linkage.cpp b/clang/test/CodeGenCXX/vtable-linkage.cpp index 4633a3fe956..b945e569afb 100644 --- a/clang/test/CodeGenCXX/vtable-linkage.cpp +++ b/clang/test/CodeGenCXX/vtable-linkage.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o %t // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fhidden-weak-vtables -emit-llvm -o %t.hidden +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -disable-llvm-optzns -O3 -emit-llvm -o %t.opt // RUN: FileCheck --check-prefix=CHECK-1 %s < %t // RUN: FileCheck --check-prefix=CHECK-2 %s < %t // RUN: FileCheck --check-prefix=CHECK-2-HIDDEN %s < %t.hidden @@ -12,7 +13,9 @@ // RUN: FileCheck --check-prefix=CHECK-7 %s < %t // RUN: FileCheck --check-prefix=CHECK-8 %s < %t // RUN: FileCheck --check-prefix=CHECK-9 %s < %t +// RUN: FileCheck --check-prefix=CHECK-9-OPT %s < %t.opt // RUN: FileCheck --check-prefix=CHECK-10 %s < %t +// RUN: FileCheck --check-prefix=CHECK-10-OPT %s < %t.opt // RUN: FileCheck --check-prefix=CHECK-11 %s < %t // RUN: FileCheck --check-prefix=CHECK-12 %s < %t // RUN: FileCheck --check-prefix=CHECK-13 %s < %t @@ -160,11 +163,13 @@ void use_F() { // F<int> is an explicit template instantiation declaration without a // key function, so its vtable should have external linkage. // CHECK-9: @_ZTV1FIiE = external unnamed_addr constant +// CHECK-9-OPT: @_ZTV1FIiE = available_externally unnamed_addr constant // E<int> is an explicit template instantiation declaration. It has a // key function that is not instantiated, so we should only reference // its vtable, not define it. // CHECK-10: @_ZTV1EIiE = external unnamed_addr constant +// CHECK-10-OPT: @_ZTV1EIiE = available_externally unnamed_addr constant // The anonymous struct for e has no linkage, so the vtable should have // internal linkage. @@ -214,3 +219,24 @@ public: void use_H() { H<int> h; } + +// RUN: FileCheck --check-prefix=CHECK-I %s < %t +// RUN: FileCheck --check-prefix=CHECK-I-OPT %s < %t.opt + +// I<int> has an explicit instantiation declaration and needs a VTT and +// construction vtables. We emit the VTT available_externally, but point it at +// internal construction vtables because there is no way to form a reference to +// the real construction vtables. + +// CHECK-I: @_ZTV1IIiE = external unnamed_addr constant +// CHECK-I: @_ZTT1IIiE = external unnamed_addr constant +// CHECK-I-NOT: @_ZTC1IIiE +// +// CHECK-I-OPT: @_ZTV1IIiE = available_externally unnamed_addr constant +// CHECK-I-OPT: @_ZTT1IIiE = available_externally unnamed_addr constant {{.*}} @_ZTC1IIiE0_6VBase2 +// CHECK-I-OPT: @_ZTC1IIiE0_6VBase2 = internal unnamed_addr constant +struct VBase1 { virtual void f(); }; struct VBase2 : virtual VBase1 {}; +template<typename T> +struct I : VBase2 {}; +extern template struct I<int>; +I<int> i; |

