File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -1343,6 +1343,13 @@ void MicrosoftCXXABI::EmitCXXDestructors(const CXXDestructorDecl *D) {
1343
1343
// The TU defining a dtor is only guaranteed to emit a base destructor. All
1344
1344
// other destructor variants are delegating thunks.
1345
1345
CGM.EmitGlobal (GlobalDecl (D, Dtor_Base));
1346
+
1347
+ // If the class is dllexported, emit the complete (vbase) destructor wherever
1348
+ // the base dtor is emitted.
1349
+ // FIXME: To match MSVC, this should only be done when the class is exported
1350
+ // with -fdllexport-inlines enabled.
1351
+ if (D->getParent ()->getNumVBases () > 0 && D->hasAttr <DLLExportAttr>())
1352
+ CGM.EmitGlobal (GlobalDecl (D, Dtor_Complete));
1346
1353
}
1347
1354
1348
1355
CharUnits
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -mconstructor-aliases -fms-extensions %s -emit-llvm -o - -triple x86_64-windows-msvc | FileCheck %s
2
2
3
+ namespace test1 {
4
+ struct A { ~A (); };
5
+ struct __declspec (dllexport) B : virtual A { };
6
+ // CHECK: define weak_odr dso_local dllexport void @"??1B@test1@@QEAA@XZ"
7
+ // CHECK: define weak_odr dso_local dllexport void @"??_DB@test1@@QEAAXXZ"
8
+ }
9
+
3
10
struct __declspec (dllexport) A { virtual ~A (); };
4
11
struct __declspec (dllexport) B { virtual ~B (); };
5
12
struct __declspec (dllexport) C : A, B { virtual ~C (); };
Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ struct __declspec(dllimport) ImportOverrideVDtor : public BaseClass {
19
19
virtual ~ImportOverrideVDtor () {}
20
20
};
21
21
22
- // Virtually inherits from a non-dllimport base class. This time we need to call
23
- // the complete destructor and emit it inline. It's not exported from the DLL,
24
- // and it must be emitted .
22
+ // Virtually inherits from a non-dllimport base class. In this case, we can
23
+ // expect the DLL to provide a definition of the complete dtor. See
24
+ // dllexport-dtor-thunks.cpp .
25
25
struct __declspec (dllimport) ImportVBaseOverrideVDtor
26
26
: public virtual BaseClass {
27
27
virtual ~ImportVBaseOverrideVDtor () {}
You can’t perform that action at this time.
0 commit comments