diff options
author | Reid Kleckner <rnk@google.com> | 2017-12-21 19:44:23 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-12-21 19:44:23 +0000 |
commit | 4baa1a65a7582da751df49a519edc4f43097d554 (patch) | |
tree | b64200550c79ca476e1575f426e6c9a70a50d3de /lib/CodeGen/CodeGenModule.cpp | |
parent | dadec7da208c7f5236133872613a09c2231c4bb7 (diff) |
Revert "Fix for PR32990"
This reverts commit r321239. It broke the Chromium DLL build:
[8834/50217] LINK(DLL) icui18n.dll icui18n.dll.lib icui18n.dll.pdb
FAILED: icui18n.dll icui18n.dll.lib icui18n.dll.pdb
zrule.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) public: void __cdecl icu_60::UnicodeString::`vbase destructor'(void)"
(__imp_??_DUnicodeString@icu_60@@QEAAXXZ)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321298 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 053c71d8c7..5bdf81aaf6 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -856,25 +856,14 @@ CodeGenModule::getFunctionLinkage(GlobalDecl GD) { GVALinkage Linkage = getContext().GetGVALinkageForFunction(D); if (isa<CXXDestructorDecl>(D) && - Context.getTargetInfo().getCXXABI().isMicrosoft()) { - switch (GD.getDtorType()) { - case CXXDtorType::Dtor_Base: - break; - case CXXDtorType::Dtor_Comdat: - case CXXDtorType::Dtor_Complete: - if (D->hasAttr<DLLImportAttr>() && - (cast<CXXDestructorDecl>(D)->getParent()->getNumVBases() || - (Linkage == GVA_AvailableExternally || - Linkage == GVA_StrongExternal))) - return llvm::Function::AvailableExternallyLinkage; - else - return Linkage == GVA_Internal ? llvm::GlobalValue::InternalLinkage - : llvm::GlobalValue::LinkOnceODRLinkage; - case CXXDtorType::Dtor_Deleting: - return Linkage == GVA_Internal ? llvm::GlobalValue::InternalLinkage - : llvm::GlobalValue::LinkOnceODRLinkage; - } + getCXXABI().useThunkForDtorVariant(cast<CXXDestructorDecl>(D), + GD.getDtorType())) { + // Destructor variants in the Microsoft C++ ABI are always internal or + // linkonce_odr thunks emitted on an as-needed basis. + return Linkage == GVA_Internal ? llvm::GlobalValue::InternalLinkage + : llvm::GlobalValue::LinkOnceODRLinkage; } + if (isa<CXXConstructorDecl>(D) && cast<CXXConstructorDecl>(D)->isInheritingConstructor() && Context.getTargetInfo().getCXXABI().isMicrosoft()) { @@ -890,25 +879,12 @@ CodeGenModule::getFunctionLinkage(GlobalDecl GD) { void CodeGenModule::setFunctionDLLStorageClass(GlobalDecl GD, llvm::Function *F) { const auto *FD = cast<FunctionDecl>(GD.getDecl()); - if (dyn_cast_or_null<CXXDestructorDecl>(FD)) { - switch (GD.getDtorType()) { - case CXXDtorType::Dtor_Comdat: - case CXXDtorType::Dtor_Deleting: { + if (const auto *Dtor = dyn_cast_or_null<CXXDestructorDecl>(FD)) { + if (getCXXABI().useThunkForDtorVariant(Dtor, GD.getDtorType())) { // Don't dllexport/import destructor thunks. F->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass); return; } - case CXXDtorType::Dtor_Complete: - if (FD->hasAttr<DLLImportAttr>()) - F->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass); - else if (FD->hasAttr<DLLExportAttr>()) - F->setDLLStorageClass(llvm::GlobalVariable::DLLExportStorageClass); - else - F->setDLLStorageClass(llvm::GlobalVariable::DefaultStorageClass); - return; - case CXXDtorType::Dtor_Base: - break; - } } if (FD->hasAttr<DLLImportAttr>()) |