summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-04-19 16:42:07 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-04-19 16:42:07 +0000
commit2fd1d7aee3cc168e0d9b78ca53fb2c1fc6684705 (patch)
tree62e445b7ece6c358846e067997a9d3ac2cb084c0 /clang/lib/CodeGen/CGExpr.cpp
parent6ac9d13e610dc9005660594ee4325483d2c97fb4 (diff)
downloadbcm5719-llvm-2fd1d7aee3cc168e0d9b78ca53fb2c1fc6684705.tar.gz
bcm5719-llvm-2fd1d7aee3cc168e0d9b78ca53fb2c1fc6684705.zip
Implement CodeGen for C++11 thread_local, following the Itanium ABI specification as discussed on cxx-abi-dev.
llvm-svn: 179858
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 1c06b7d2d98..a0725b5f9cd 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -1824,8 +1824,12 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
if (const VarDecl *VD = dyn_cast<VarDecl>(ND)) {
// Check if this is a global variable.
- if (VD->hasLinkage() || VD->isStaticDataMember())
+ if (VD->hasLinkage() || VD->isStaticDataMember()) {
+ // If it's thread_local, emit a call to its wrapper function instead.
+ if (VD->getTLSKind() == VarDecl::TLS_Dynamic)
+ return CGM.getCXXABI().EmitThreadLocalDeclRefExpr(*this, E);
return EmitGlobalVarDeclLValue(*this, E, VD);
+ }
bool isBlockVariable = VD->hasAttr<BlocksAttr>();
OpenPOWER on IntegriCloud