Fix ctor/dtor aliases losing 'dllexport' (for Itanium ABI)
This patch makes sure that the dllexport attribute is transferred to the alias when such alias is created. It only affects the Itanium ABI because for the MSVC ABI a workaround is in place to not generate aliases of dllexport ctors/dtors. A new CodeGenModule function is provided, CodeGenModule::setAliasAttributes, to factor the code for transferring attributes to aliases. llvm-svn: 218159
This commit is contained in:
@@ -786,6 +786,16 @@ void CodeGenModule::SetCommonAttributes(const Decl *D,
|
||||
addUsedGlobal(GV);
|
||||
}
|
||||
|
||||
void CodeGenModule::setAliasAttributes(const Decl *D,
|
||||
llvm::GlobalValue *GV) {
|
||||
SetCommonAttributes(D, GV);
|
||||
|
||||
// Process the dllexport attribute based on whether the original definition
|
||||
// (not necessarily the aliasee) was exported.
|
||||
if (D->hasAttr<DLLExportAttr>())
|
||||
GV->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
|
||||
}
|
||||
|
||||
void CodeGenModule::setNonAliasAttributes(const Decl *D,
|
||||
llvm::GlobalObject *GO) {
|
||||
SetCommonAttributes(D, GO);
|
||||
|
||||
Reference in New Issue
Block a user