Satisfy C++ aliasing rules, per suggestion by Chandler.
[oota-llvm.git] / include / llvm / Support / ThreadLocal.h
index 1a0a00fd515fb06904078b771d48de5b0b40e86a..2957034ec74d5423d477c406f31bb4e51e64bf8b 100644 (file)
@@ -28,7 +28,12 @@ namespace llvm {
       ///
       /// 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;
+      union {
+        char data[sizeof(ThreadLocalDataTy)];
+        struct {
+          ThreadLocalDataTy align_data;
+        };
+      };
     public:
       ThreadLocalImpl();
       virtual ~ThreadLocalImpl();