2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
|
2009-12-06 01:04:47 +08:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
struct A {
|
|
|
|
virtual void f() { }
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-12-06 06:19:10 +08:00
|
|
|
void f() { A b; }
|
|
|
|
|
|
|
|
struct B {
|
|
|
|
B();
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
B::B() { }
|
|
|
|
|
2009-12-06 06:24:38 +08:00
|
|
|
struct C {
|
|
|
|
C();
|
|
|
|
virtual void f() { }
|
|
|
|
};
|
|
|
|
|
|
|
|
C::C() { }
|
|
|
|
|
2009-12-06 08:53:22 +08:00
|
|
|
struct D {
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
void D::f() { }
|
|
|
|
|
2009-12-12 04:48:18 +08:00
|
|
|
static struct : D { } e;
|
|
|
|
|
2009-12-06 06:19:10 +08:00
|
|
|
// B has a key function that is not defined in this translation unit so its vtable
|
|
|
|
// has external linkage.
|
|
|
|
// CHECK: @_ZTV1B = external constant
|
|
|
|
|
2009-12-06 06:24:38 +08:00
|
|
|
// C has no key function, so its vtable should have weak_odr linkage.
|
2009-12-11 10:46:30 +08:00
|
|
|
// CHECK: @_ZTS1C = weak_odr constant
|
|
|
|
// CHECK: @_ZTI1C = weak_odr constant
|
2009-12-06 06:24:38 +08:00
|
|
|
// CHECK: @_ZTV1C = weak_odr constant
|
|
|
|
|
2009-12-06 08:53:22 +08:00
|
|
|
// D has a key function that is defined in this translation unit so its vtable is
|
|
|
|
// defined in the translation unit.
|
2009-12-11 10:46:30 +08:00
|
|
|
// CHECK: @_ZTS1D = constant
|
|
|
|
// CHECK: @_ZTI1D = constant
|
2009-12-06 08:53:22 +08:00
|
|
|
// CHECK: @_ZTV1D = constant
|
|
|
|
|
2009-12-12 04:48:18 +08:00
|
|
|
// The anonymous struct for e has no linkage, so the vtable should have
|
|
|
|
// internal linkage.
|
|
|
|
// CHECK: @"_ZTS3$_0" = internal constant
|
|
|
|
// CHECK: @"_ZTI3$_0" = internal constant
|
|
|
|
// CHECK: @"_ZTV3$_0" = internal constant
|
|
|
|
|
2009-12-06 06:19:10 +08:00
|
|
|
// The A vtable should have internal linkage since it is inside an anonymous
|
|
|
|
// namespace.
|
2009-12-11 10:46:30 +08:00
|
|
|
// CHECK: @_ZTSN12_GLOBAL__N_11AE = internal constant
|
|
|
|
// CHECK: @_ZTIN12_GLOBAL__N_11AE = internal constant
|
2009-12-06 06:19:10 +08:00
|
|
|
// CHECK: @_ZTVN12_GLOBAL__N_11AE = internal constant
|