X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FSupport%2FThreadLocal.h;h=427a67e2a96d0ead04980385f60f91593a7ba101;hb=07a3b97f20bf63f196ce76e8bfa47d129cf6d8c4;hp=15350a7afff7e6544b526b5217c4edb53a779876;hpb=53ca1f3190680f3e86aebe0f72f7918d63f71e0d;p=oota-llvm.git diff --git a/include/llvm/Support/ThreadLocal.h b/include/llvm/Support/ThreadLocal.h index 15350a7afff..427a67e2a96 100644 --- a/include/llvm/Support/ThreadLocal.h +++ b/include/llvm/Support/ThreadLocal.h @@ -11,9 +11,10 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_SYSTEM_THREAD_LOCAL_H -#define LLVM_SYSTEM_THREAD_LOCAL_H +#ifndef LLVM_SUPPORT_THREADLOCAL_H +#define LLVM_SUPPORT_THREADLOCAL_H +#include "llvm/Support/DataTypes.h" #include "llvm/Support/Threading.h" #include @@ -22,12 +23,20 @@ namespace llvm { // ThreadLocalImpl - Common base class of all ThreadLocal instantiations. // YOU SHOULD NEVER USE THIS DIRECTLY. class ThreadLocalImpl { - void* data; + typedef uint64_t ThreadLocalDataTy; + /// \brief Platform-specific thread local data. + /// + /// This is embedded in the class and we avoid malloc'ing/free'ing it, + /// to make this class more safe for use along with CrashRecoveryContext. + union { + char data[sizeof(ThreadLocalDataTy)]; + ThreadLocalDataTy align_data; + }; public: ThreadLocalImpl(); virtual ~ThreadLocalImpl(); void setInstance(const void* d); - const void* getInstance(); + void *getInstance(); void removeInstance(); };