Fix building ThreadLocal.cpp with --disable-threads.

llvm-svn: 158405
This commit is contained in:
Argyrios Kyrtzidis 2012-06-13 16:30:06 +00:00
parent f294921e24
commit 444fd42634
1 changed files with 9 additions and 2 deletions

View File

@ -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