summaryrefslogtreecommitdiff
path: root/include/llvm/Support/PointerLikeTypeTraits.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-29 06:00:21 +0000
committerChris Lattner <sabre@nondot.org>2009-03-29 06:00:21 +0000
commit911c8b21dac9678e458798b150cebff196a6fc7a (patch)
tree6177c154d12dee71b39561fe4553da3154b4b8a4 /include/llvm/Support/PointerLikeTypeTraits.h
parentaab3d88bc481fdc3081d2280dab4f7efd7e74a61 (diff)
downloadllvm-911c8b21dac9678e458798b150cebff196a6fc7a.tar.gz
llvm-911c8b21dac9678e458798b150cebff196a6fc7a.tar.bz2
llvm-911c8b21dac9678e458798b150cebff196a6fc7a.tar.xz
Add a PointerLikeTypeTraits specialization for uintptr_t
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/PointerLikeTypeTraits.h')
-rw-r--r--include/llvm/Support/PointerLikeTypeTraits.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/Support/PointerLikeTypeTraits.h b/include/llvm/Support/PointerLikeTypeTraits.h
index 000919ca10..c5f79ccb83 100644
--- a/include/llvm/Support/PointerLikeTypeTraits.h
+++ b/include/llvm/Support/PointerLikeTypeTraits.h
@@ -15,6 +15,8 @@
#ifndef LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
#define LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
+#include "llvm/Support/DataTypes.h"
+
namespace llvm {
/// PointerLikeTypeTraits - This is a traits object that is used to handle
@@ -55,6 +57,20 @@ public:
}
enum { NumLowBitsAvailable = 3 };
};
+
+// Provide PointerLikeTypeTraits for uintptr_t.
+template<>
+class PointerLikeTypeTraits<uintptr_t> {
+public:
+ static inline void *getAsVoidPointer(uintptr_t P) {
+ return reinterpret_cast<void*>(P);
+ }
+ static inline uintptr_t getFromVoidPointer(void *P) {
+ return reinterpret_cast<uintptr_t>(P);
+ }
+ // No bits are available!
+ enum { NumLowBitsAvailable = 0 };
+};
} // end namespace llvm