vtable-linkage.cpp revision 891c8b739917ec4d171a62ceaefc640115089e7d
1// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s 2 3namespace { 4 struct A { 5 virtual void f() { } 6 }; 7} 8 9void f() { A b; } 10 11struct B { 12 B(); 13 virtual void f(); 14}; 15 16B::B() { } 17 18struct C { 19 C(); 20 virtual void f() { } 21}; 22 23C::C() { } 24 25// B has a key function that is not defined in this translation unit so its vtable 26// has external linkage. 27// CHECK: @_ZTV1B = external constant 28 29// C has no key function, so its vtable should have weak_odr linkage. 30// CHECK: @_ZTV1C = weak_odr constant 31 32// The A vtable should have internal linkage since it is inside an anonymous 33// namespace. 34// CHECK: @_ZTVN12_GLOBAL__N_11AE = internal constant 35