Revert "[MS] Don't expect vftables to be provided for extern template instantiations"
This reverts commit r273296, it broke the Windows self-host.
llvm-svn: 273305
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index da9b742..3846144 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -794,10 +794,6 @@
return DiscardableODRLinkage;
case TSK_ExplicitInstantiationDeclaration:
- // Explicit instantiations in MSVC do not provide vtables, so we must emit
- // our own.
- if (getTarget().getCXXABI().isMicrosoft())
- return DiscardableODRLinkage;
return shouldEmitAvailableExternallyVTable(*this, RD)
? llvm::GlobalVariable::AvailableExternallyLinkage
: llvm::GlobalVariable::ExternalLinkage;
@@ -843,9 +839,9 @@
bool CodeGenVTables::isVTableExternal(const CXXRecordDecl *RD) {
assert(RD->isDynamicClass() && "Non-dynamic classes have no VTable.");
- // We always synthesize vtables if they are needed in the MS ABI. MSVC doesn't
- // emit them even if there is an explicit template instantiation.
- if (CGM.getTarget().getCXXABI().isMicrosoft())
+ // We always synthesize vtables on the import side regardless of whether or
+ // not it is an explicit instantiation declaration.
+ if (CGM.getTarget().getCXXABI().isMicrosoft() && RD->hasAttr<DLLImportAttr>())
return false;
// If we have an explicit instantiation declaration (and not a