Fix broken ipo_ext_iterator constructors.
[oota-llvm.git] / include / llvm / ADT / PointerIntPair.h
index 64f4a7cee4b9973656d15fd77224243e25658778..ccdcd1a8d1b949c5f1698d4a74b0288f28420e84 100644 (file)
@@ -91,6 +91,17 @@ public:
     Value |= IntVal << IntShift;  // Set new integer.
   }
 
+  PointerTy const *getAddrOfPointer() const {
+    return const_cast<PointerIntPair *>(this)->getAddrOfPointer();
+  }
+
+  PointerTy *getAddrOfPointer() {
+    assert(Value == reinterpret_cast<intptr_t>(getPointer()) &&
+           "Can only return the address if IntBits is cleared and "
+           "PtrTraits doesn't change the pointer");
+    return reinterpret_cast<PointerTy *>(&Value);
+  }
+
   void *getOpaqueValue() const { return reinterpret_cast<void*>(Value); }
   void setFromOpaqueValue(void *Val) { Value = reinterpret_cast<intptr_t>(Val);}