diff options
author | John McCall <rjmccall@apple.com> | 2009-09-23 06:53:51 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-09-23 06:53:51 +0000 |
commit | e9cbef31ba8c374d41249635197e58c102fe41fb (patch) | |
tree | 3d08895920874e8dfd6295ff795a6afa960e00de /include/llvm | |
parent | d062bf740651c35ed3ee80b66b02d8363fd14a3a (diff) | |
download | external_llvm-e9cbef31ba8c374d41249635197e58c102fe41fb.zip external_llvm-e9cbef31ba8c374d41249635197e58c102fe41fb.tar.gz external_llvm-e9cbef31ba8c374d41249635197e58c102fe41fb.tar.bz2 |
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
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Support/PointerLikeTypeTraits.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/llvm/Support/PointerLikeTypeTraits.h b/include/llvm/Support/PointerLikeTypeTraits.h index b0edd3b..d64993f 100644 --- a/include/llvm/Support/PointerLikeTypeTraits.h +++ b/include/llvm/Support/PointerLikeTypeTraits.h @@ -50,12 +50,16 @@ public: // Provide PointerLikeTypeTraits for const pointers. template<typename T> class PointerLikeTypeTraits<const T*> { + typedef PointerLikeTypeTraits<T*> 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<T*>(P)); + } static inline const T *getFromVoidPointer(const void *P) { - return static_cast<const T*>(P); + return NonConst::getFromVoidPointer(const_cast<void*>(P)); } - enum { NumLowBitsAvailable = 2 }; + enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable }; }; // Provide PointerLikeTypeTraits for uintptr_t. |