Under Windows Itanium, we need to export virtual and non-virtual thunks
if the functions being thunked are exported. These thunks would
previously inherit their dllexport attribute from the declaration, but
r298330 changed declarations to not have dllexport attributes. We
therefore need to add the dllexport attribute to the definition
ourselves now.
Differential Revision: https://reviews.llvm.org/D34850
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306770
91177308-0d34-0410-b5e6-
96231b3b80d8
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
setThunkVisibility(CGM, MD, Thunk, ThunkFn);
+ // Propagate dllexport storage.
+ if (MD->hasAttr<DLLExportAttr>())
+ ThunkFn->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
+
if (CGM.supportsCOMDAT() && ThunkFn->isWeakForLinker())
ThunkFn->setComdat(CGM.getModule().getOrInsertComdat(ThunkFn->getName()));
}
// CHECK: declare dllimport {{.*}} @_ZN5outerIcE1fEv
// CHECK: define {{.*}} @_ZN5outerIcE5inner1fEv
+
+struct base {
+ virtual ~base();
+};
+struct __declspec(dllexport) derived : public virtual base {
+ virtual ~derived() {}
+};
+
+// CHECK: define {{.*}} dllexport {{.*}} @_ZTv0_n12_N7derivedD0Ev