aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-06-18 15:55:13 +0000
committerHans Wennborg <hans@hanshq.net>2014-06-18 15:55:13 +0000
commitef2272c49e1da9ef22b142ea4a8dca86a9cf80e5 (patch)
tree0e5d398de6a617ade8213438b547087ac3e1ab5e /clang/lib/CodeGen/CGDecl.cpp
parentdbb3e3e64f40098a74e1d337cfbc1212959fe832 (diff)
downloadllvm-ef2272c49e1da9ef22b142ea4a8dca86a9cf80e5.zip
llvm-ef2272c49e1da9ef22b142ea4a8dca86a9cf80e5.tar.gz
llvm-ef2272c49e1da9ef22b142ea4a8dca86a9cf80e5.tar.bz2
Inherit dll attributes to static locals
This makes us handle static locals in exported/imported functions correctly. Differential Revision: http://reviews.llvm.org/D4136 llvm-svn: 211173
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 12c5207..a28e721 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -201,6 +201,13 @@ CodeGenFunction::CreateStaticVarDecl(const VarDecl &D,
if (D.getTLSKind())
CGM.setTLSMode(GV, D);
+ if (D.isExternallyVisible()) {
+ if (D.hasAttr<DLLImportAttr>())
+ GV->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass);
+ else if (D.hasAttr<DLLExportAttr>())
+ GV->setDLLStorageClass(llvm::GlobalVariable::DLLExportStorageClass);
+ }
+
// Make sure the result is of the correct type.
unsigned ExpectedAddrSpace = CGM.getContext().getTargetAddressSpace(Ty);
if (AddrSpace != ExpectedAddrSpace) {