From: Argyrios Kyrtzidis Date: Tue, 26 Jun 2012 17:13:58 +0000 (+0000) Subject: Fix ThreadLocalImpl::getInstance for --disable-threads. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=da72dd2a01a9f3e686699d01f4d40b936a52eab6;p=oota-llvm.git Fix ThreadLocalImpl::getInstance for --disable-threads. PR13114. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159210 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/ThreadLocal.cpp b/lib/Support/ThreadLocal.cpp index 109580478de..0587aaec7e6 100644 --- a/lib/Support/ThreadLocal.cpp +++ b/lib/Support/ThreadLocal.cpp @@ -30,10 +30,12 @@ void ThreadLocalImpl::setInstance(const void* d) { void **pd = reinterpret_cast(&data); *pd = const_cast(d); } -const void* ThreadLocalImpl::getInstance() { return data; } -void ThreadLocalImpl::removeInstance() { +const void* ThreadLocalImpl::getInstance() { void **pd = reinterpret_cast(&data); - *pd = 0; + return *pd; +} +void ThreadLocalImpl::removeInstance() { + setInstance(0); } } #else