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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user