From: Chris Lattner Date: Sun, 29 Mar 2009 06:00:21 +0000 (+0000) Subject: Add a PointerLikeTypeTraits specialization for uintptr_t X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=911c8b21dac9678e458798b150cebff196a6fc7a;p=oota-llvm.git Add a PointerLikeTypeTraits specialization for uintptr_t git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67985 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/PointerLikeTypeTraits.h b/include/llvm/Support/PointerLikeTypeTraits.h index 000919ca109..c5f79ccb835 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 { +public: + static inline void *getAsVoidPointer(uintptr_t P) { + return reinterpret_cast(P); + } + static inline uintptr_t getFromVoidPointer(void *P) { + return reinterpret_cast(P); + } + // No bits are available! + enum { NumLowBitsAvailable = 0 }; +}; } // end namespace llvm