forked from OSchip/llvm-project
[CodeGen] Propagate dllexport to thunks
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 llvm-svn: 306770
This commit is contained in:
parent
53b2cb77cc
commit
a2222fa1d2
|
@ -64,6 +64,10 @@ static void setThunkProperties(CodeGenModule &CGM, const ThunkInfo &Thunk,
|
|||
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()));
|
||||
}
|
||||
|
|
|
@ -53,3 +53,12 @@ USEMEMFUNC(outer<char>::inner, f)
|
|||
|
||||
// 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
|
||||
|
|
Loading…
Reference in New Issue