aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Support/ThreadLocal.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-06-12 00:21:31 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-06-12 00:21:31 +0000
commit793537d21f8aa46458a5733d96816ba8bddeef50 (patch)
tree441f269114a3f3b693c2f8fb15ad7fef979f2562 /include/llvm/Support/ThreadLocal.h
parent0eb3a3524e9d68642e574780d19c781386ed4469 (diff)
For llvm::sys::ThreadLocalImpl instead of malloc'ing the platform-specific
thread local data, embed them in the class using a uint64_t and make sure we get compiler errors if there's a platform where this is not big enough. This makes ThreadLocal more safe for using it in conjunction with CrashRecoveryContext. Related to crash in rdar://11434201. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158342 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/ThreadLocal.h')
-rw-r--r--include/llvm/Support/ThreadLocal.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/llvm/Support/ThreadLocal.h b/include/llvm/Support/ThreadLocal.h
index 15350a7aff..1a0a00fd51 100644
--- a/include/llvm/Support/ThreadLocal.h
+++ b/include/llvm/Support/ThreadLocal.h
@@ -15,6 +15,7 @@
#define LLVM_SYSTEM_THREAD_LOCAL_H
#include "llvm/Support/Threading.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
namespace llvm {
@@ -22,7 +23,12 @@ 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.
+ ThreadLocalDataTy data;
public:
ThreadLocalImpl();
virtual ~ThreadLocalImpl();