diff options
author | Dario Domizioli <dario.domizioli@gmail.com> | 2014-09-19 22:06:24 +0000 |
---|---|---|
committer | Dario Domizioli <dario.domizioli@gmail.com> | 2014-09-19 22:06:24 +0000 |
commit | c4fb8ca7aa4dfbd7a78cbff92d7065dff7e583e3 (patch) | |
tree | fd8612abbd12c683bcc948b8246386c676645038 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 44a7c7f1aa34c725d65aad46fe33b4a8247e71a0 (diff) | |
download | bcm5719-llvm-c4fb8ca7aa4dfbd7a78cbff92d7065dff7e583e3.tar.gz bcm5719-llvm-c4fb8ca7aa4dfbd7a78cbff92d7065dff7e583e3.zip |
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 5e87fc2799c..6e7da49a44d 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -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); |