diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-12-15 01:04:45 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-12-15 01:04:45 +0000 |
commit | 421c89debc9616598ddc2bb5bbfd57d096f21e2d (patch) | |
tree | dcc2eca485392a01c5b0a07603a862b669260c16 /llvm/lib | |
parent | 574f6d460860cd8baacf7d8d6258a9ea30040109 (diff) | |
download | bcm5719-llvm-421c89debc9616598ddc2bb5bbfd57d096f21e2d.tar.gz bcm5719-llvm-421c89debc9616598ddc2bb5bbfd57d096f21e2d.zip |
ThreadLocal: Return a mutable pointer if templated with a non-const type
It makes more sense for ThreadLocal<const T>::get to return a const T*
and ThreadLocal<T>::get to return a T*.
llvm-svn: 224225
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Support/ThreadLocal.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Support/Unix/ThreadLocal.inc | 2 | ||||
-rw-r--r-- | llvm/lib/Support/Windows/ThreadLocal.inc | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Support/ThreadLocal.cpp b/llvm/lib/Support/ThreadLocal.cpp index 2dec9eb417f..e0622192566 100644 --- a/llvm/lib/Support/ThreadLocal.cpp +++ b/llvm/lib/Support/ThreadLocal.cpp @@ -31,7 +31,7 @@ void ThreadLocalImpl::setInstance(const void* d) { void **pd = reinterpret_cast<void**>(&data); *pd = const_cast<void*>(d); } -const void* ThreadLocalImpl::getInstance() { +void *ThreadLocalImpl::getInstance() { void **pd = reinterpret_cast<void**>(&data); return *pd; } @@ -72,7 +72,7 @@ void ThreadLocalImpl::setInstance(const void* d) { (void) errorcode; } -const void* ThreadLocalImpl::getInstance() { +void *ThreadLocalImpl::getInstance() { pthread_key_t* key = reinterpret_cast<pthread_key_t*>(&data); return pthread_getspecific(*key); } diff --git a/llvm/lib/Support/Unix/ThreadLocal.inc b/llvm/lib/Support/Unix/ThreadLocal.inc index f14d0fa3d52..fa746a628e3 100644 --- a/llvm/lib/Support/Unix/ThreadLocal.inc +++ b/llvm/lib/Support/Unix/ThreadLocal.inc @@ -21,6 +21,6 @@ using namespace sys; ThreadLocalImpl::ThreadLocalImpl() : data() { } ThreadLocalImpl::~ThreadLocalImpl() { } void ThreadLocalImpl::setInstance(const void* d) { data = const_cast<void*>(d);} -const void* ThreadLocalImpl::getInstance() { return data; } +void *ThreadLocalImpl::getInstance() { return data; } void ThreadLocalImpl::removeInstance() { setInstance(0); } } diff --git a/llvm/lib/Support/Windows/ThreadLocal.inc b/llvm/lib/Support/Windows/ThreadLocal.inc index 14ce61933cb..b9cb8ff9836 100644 --- a/llvm/lib/Support/Windows/ThreadLocal.inc +++ b/llvm/lib/Support/Windows/ThreadLocal.inc @@ -34,7 +34,7 @@ ThreadLocalImpl::~ThreadLocalImpl() { TlsFree(*tls); } -const void* ThreadLocalImpl::getInstance() { +void *ThreadLocalImpl::getInstance() { DWORD* tls = reinterpret_cast<DWORD*>(&data); return TlsGetValue(*tls); } |