teach PointerLikeTypeTraits that all pointers to pointers may only be 4-byte aligned.
[oota-llvm.git] / include / llvm / Support / PointerLikeTypeTraits.h
index c5f79ccb83567605c79de167349160b7fe89628c..226dacf36118bf69b0ce185e1a2be9c902eee3b6 100644 (file)
@@ -58,6 +58,20 @@ public:
   enum { NumLowBitsAvailable = 3 };
 };
 
+// Pointers to pointers are only 4-byte aligned on 32-bit systems.
+template<typename T>
+class PointerLikeTypeTraits<T**> {
+public:
+  static inline void *getAsVoidPointer(T** P) { return P; }
+  static inline T **getFromVoidPointer(void *P) {
+    return static_cast<T**>(P);
+  }
+  enum { NumLowBitsAvailable = 2 };
+};
+  
+  
+  
+  
 // Provide PointerLikeTypeTraits for uintptr_t.
 template<>
 class PointerLikeTypeTraits<uintptr_t> {