aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-09-17 20:35:18 +0000
committerJohn McCall <rjmccall@apple.com>2009-09-17 20:35:18 +0000
commitc953c1da67f69a4698a7f5379775000e12599134 (patch)
treeea48ee71ec5152e14c46cfb857fffb78e3c5bc62 /include/llvm
parent0ca4b2cefc8cb9260b1467917e630ed7d7d1f6a2 (diff)
downloadexternal_llvm-c953c1da67f69a4698a7f5379775000e12599134.zip
external_llvm-c953c1da67f69a4698a7f5379775000e12599134.tar.gz
external_llvm-c953c1da67f69a4698a7f5379775000e12599134.tar.bz2
Fix a few places where PointerIntPair was using PointerLikeTypeTraits<PointerTy>
instead of the PtrTraits provided. Allows PointerIntPair to contain a PointerUnion safely, as long as the bits add up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82163 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/PointerIntPair.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/llvm/ADT/PointerIntPair.h b/include/llvm/ADT/PointerIntPair.h
index 0aa478b..73ba3c7 100644
--- a/include/llvm/ADT/PointerIntPair.h
+++ b/include/llvm/ADT/PointerIntPair.h
@@ -65,7 +65,8 @@ public:
}
PointerTy getPointer() const {
- return reinterpret_cast<PointerTy>(Value & PointerBitMask);
+ return PtrTraits::getFromVoidPointer(
+ reinterpret_cast<void*>(Value & PointerBitMask));
}
IntType getInt() const {
@@ -73,7 +74,8 @@ public:
}
void setPointer(PointerTy Ptr) {
- intptr_t PtrVal = reinterpret_cast<intptr_t>(Ptr);
+ intptr_t PtrVal
+ = reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(Ptr));
assert((PtrVal & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 &&
"Pointer is not sufficiently aligned");
// Preserve all low bits, just update the pointer.
@@ -141,8 +143,7 @@ public:
return PointerIntPair<PointerTy, IntBits, IntType>::getFromOpaqueValue(P);
}
enum {
- NumLowBitsAvailable =
- PointerLikeTypeTraits<PointerTy>::NumLowBitsAvailable - IntBits
+ NumLowBitsAvailable = PtrTraits::NumLowBitsAvailable - IntBits
};
};