summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/ThreadLocal.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-06-13 16:30:06 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-06-13 16:30:06 +0000
commit444fd42634110442ed2af42afe78add7fc6e5f7b (patch)
treed55a5ef6695f976e9fa2996dd9156acd3b18161a /llvm/lib/Support/ThreadLocal.cpp
parentf294921e247ee27af1605108c868a328be2f87db (diff)
downloadbcm5719-llvm-444fd42634110442ed2af42afe78add7fc6e5f7b.tar.gz
bcm5719-llvm-444fd42634110442ed2af42afe78add7fc6e5f7b.zip
Fix building ThreadLocal.cpp with --disable-threads.
llvm-svn: 158405
Diffstat (limited to 'llvm/lib/Support/ThreadLocal.cpp')
-rw-r--r--llvm/lib/Support/ThreadLocal.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Support/ThreadLocal.cpp b/llvm/lib/Support/ThreadLocal.cpp
index 17e0fe15b02..109580478de 100644
--- a/llvm/lib/Support/ThreadLocal.cpp
+++ b/llvm/lib/Support/ThreadLocal.cpp
@@ -25,9 +25,16 @@ namespace llvm {
using namespace sys;
ThreadLocalImpl::ThreadLocalImpl() { }
ThreadLocalImpl::~ThreadLocalImpl() { }
-void ThreadLocalImpl::setInstance(const void* d) { data = const_cast<void*>(d);}
+void ThreadLocalImpl::setInstance(const void* d) {
+ typedef int SIZE_TOO_BIG[sizeof(d) <= sizeof(data) ? 1 : -1];
+ void **pd = reinterpret_cast<void**>(&data);
+ *pd = const_cast<void*>(d);
+}
const void* ThreadLocalImpl::getInstance() { return data; }
-void ThreadLocalImpl::removeInstance() { data = 0; }
+void ThreadLocalImpl::removeInstance() {
+ void **pd = reinterpret_cast<void**>(&data);
+ *pd = 0;
+}
}
#else
OpenPOWER on IntegriCloud