Index: lib/CodeGen/MicrosoftCXXABI.cpp =================================================================== --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -3800,11 +3800,11 @@ static void emitCXXDestructor(CodeGenModule &CGM, const CXXDestructorDecl *dtor, StructorType dtorType) { - // If the class has dllimport attribute and has a virual base, the destructor + // If the class has dllimport attribute and has a virtual base, the destructor // is equivalent to the virtual base destrutor. if (dtor->getParent()->getNumVBases() && dtor->hasAttr() && - (dtorType == StructorType::Complete || dtorType == StructorType::Base) && - CGM.TryEmitBaseDestructorAsAlias(dtor)) + CGM.getTriple().isWindowsMSVCEnvironment() && + (dtorType == StructorType::Complete || dtorType == StructorType::Base)) return; // The complete destructor is equivalent to the base destructor for // classes with no virtual bases, so try to emit it as an alias. Index: test/CodeGenCXX/dllimport-base.cpp =================================================================== --- test/CodeGenCXX/dllimport-base.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// RUN: %clang_cc1 -triple i386-pc-windows -emit-llvm -fms-compatibility %s -x c++ -o - | FileCheck %s - -// CHECK: declare dllimport x86_thiscallcc void @"\01??1VirtualClass@test1@@UAE@XZ" -// CHECK: declare dllimport x86_thiscallcc void @"\01??1VirtualClass@test2@@UAE@XZ" -// CHECK-NOT: ??_DVirtualClass@@QEAAXXZ - -namespace test1 { -struct __declspec(dllimport) VirtualClass { -public: - virtual ~VirtualClass(){}; -}; - -int main() { - VirtualClass c; - return 0; -} -} // namespace test1 - -namespace test2 { -class BaseClass { -public: - virtual ~BaseClass(){}; -}; - -class __declspec(dllimport) VirtualClass : public BaseClass { -public: - virtual ~VirtualClass(){}; -}; - -int main() { - VirtualClass c; - return 0; -} -} // namespace test2 - -namespace test3 { -class BaseClass { -public: - virtual ~BaseClass(){}; -}; - -class __declspec(dllimport) VirtualClass : public virtual BaseClass { -public: - virtual ~VirtualClass(){}; -}; - -int main() { - VirtualClass c; - return 0; -} -} // namespace test3 Index: test/CodeGenCXX/dllimport-dtor-thunks.cpp =================================================================== --- test/CodeGenCXX/dllimport-dtor-thunks.cpp +++ test/CodeGenCXX/dllimport-dtor-thunks.cpp @@ -23,9 +23,7 @@ virtual ~ImportOverrideVDtor() {} }; -// Virtually inherits from a non-dllimport base class. This time we need to call -// the complete destructor and emit it inline. It's not exported from the DLL, -// and it must be emitted. +// Virtually inherits from a non-dllimport base class. Emit the virtual base destructor. struct __declspec(dllimport) ImportVBaseOverrideVDtor : public virtual BaseClass { virtual ~ImportVBaseOverrideVDtor() {} Index: test/CodeGenCXX/dllimport-virtual-base.cpp =================================================================== --- test/CodeGenCXX/dllimport-virtual-base.cpp +++ test/CodeGenCXX/dllimport-virtual-base.cpp @@ -63,5 +63,6 @@ // CHECK-LABEL: declare dllimport x86_thiscallcc %"struct.test1::Concrete"* @"\01??0Concrete@test1@@QAE@XZ" // CHECK-LABEL: declare dllimport x86_thiscallcc %"class.test2::VirtualClass"* @"\01??0VirtualClass@test2@@QAE@XZ" // CHECK-LABEL: declare dllimport x86_thiscallcc %"class.test3::ConcreteClass"* @"\01??0ConcreteClass@test3@@QAE@H@Z" -// CHECK-NOT: ??_DVirtualClass@@QEAAXXZ -// CHECK-NOT: ??_DConcreteClass@@QEAAXXZ +// CHECK-NOT: ??_DConcrete@test1@@QEAAXXZ +// CHECK-NOT: ??_DVirtualClass@test2@@QEAAXXZ +// CHECK-NOT: ??_DConcreteClass@test3@@QEAAXXZ