From 46785f946194f335c302cc1e5702de1d1276c0d0 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 26 Jun 2012 17:13:58 +0000 Subject: Fix ThreadLocalImpl::getInstance for --disable-threads. PR13114. llvm-svn: 159210 --- llvm/lib/Support/ThreadLocal.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Support') diff --git a/llvm/lib/Support/ThreadLocal.cpp b/llvm/lib/Support/ThreadLocal.cpp index 109580478de..0587aaec7e6 100644 --- a/llvm/lib/Support/ThreadLocal.cpp +++ b/llvm/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 -- cgit v1.2.3