Fix ThreadLocalImpl::getInstance for --disable-threads.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 26 Jun 2012 17:13:58 +0000 (17:13 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 26 Jun 2012 17:13:58 +0000 (17:13 +0000)
PR13114.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159210 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/ThreadLocal.cpp

index 109580478deeb6003cc615cb246503813a428ed2..0587aaec7e68fc2c9ca6dacef2095610dac2c2c1 100644 (file)
@@ -30,10 +30,12 @@ void ThreadLocalImpl::setInstance(const void* d) {
   void **pd = reinterpret_cast<void**>(&data);
   *pd = const_cast<void*>(d);
 }
-const void* ThreadLocalImpl::getInstance() { return data; }
-void ThreadLocalImpl::removeInstance() {
+const void* ThreadLocalImpl::getInstance() {
   void **pd = reinterpret_cast<void**>(&data);
-  *pd = 0;
+  return *pd;
+}
+void ThreadLocalImpl::removeInstance() {
+  setInstance(0);
 }
 }
 #else