// Figure out the right linkage.
llvm::GlobalVariable::LinkageTypes Linkage =
- llvm::GlobalValue::LinkOnceODRLinkage;
+ llvm::GlobalValue::WeakODRLinkage;
if (!Init)
Linkage = llvm::GlobalValue::ExternalLinkage;
else if (RD->isInAnonymousNamespace())
b.getVtable().size());
}
llvm::GlobalVariable *OGV = GV;
- GV = createGlobalVariable(*this, LayoutClass, ntype, C, Name);
+ GV = createGlobalVariable(*this, LayoutClass, ArrayType, Init, Name);
if (OGV) {
GV->takeName(OGV);
llvm::Constant *NewPtr =
B::B() { }
+struct C {
+ C();
+ virtual void f() { }
+};
+
+C::C() { }
+
// B has a key function that is not defined in this translation unit so its vtable
// has external linkage.
// CHECK: @_ZTV1B = external constant
+// C has no key function, so its vtable should have weak_odr linkage.
+// CHECK: @_ZTV1C = weak_odr constant
+
// The A vtable should have internal linkage since it is inside an anonymous
// namespace.
// CHECK: @_ZTVN12_GLOBAL__N_11AE = internal constant