From: John McCall Date: Wed, 23 Sep 2009 06:53:51 +0000 (+0000) Subject: Make the type traits for a const pointer defer to those for a unqualified X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=470e08e1d1ec4c3c0eae96fab98c1f4a1552c2a3;p=oota-llvm.git Make the type traits for a const pointer defer to those for a unqualified pointer, instead of providing independent values modelled on the default implementation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82620 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/PointerLikeTypeTraits.h b/include/llvm/Support/PointerLikeTypeTraits.h index b0edd3bd09f..d64993f54d1 100644 --- a/include/llvm/Support/PointerLikeTypeTraits.h +++ b/include/llvm/Support/PointerLikeTypeTraits.h @@ -50,12 +50,16 @@ public: // Provide PointerLikeTypeTraits for const pointers. template class PointerLikeTypeTraits { + typedef PointerLikeTypeTraits NonConst; + public: - static inline const void *getAsVoidPointer(const T* P) { return P; } + static inline const void *getAsVoidPointer(const T* P) { + return NonConst::getAsVoidPointer(const_cast(P)); + } static inline const T *getFromVoidPointer(const void *P) { - return static_cast(P); + return NonConst::getFromVoidPointer(const_cast(P)); } - enum { NumLowBitsAvailable = 2 }; + enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable }; }; // Provide PointerLikeTypeTraits for uintptr_t.