[llvm-commits] [llvm] r82620 - /llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h
John McCall
rjmccall at apple.com
Tue Sep 22 23:53:52 PDT 2009
Author: rjmccall
Date: Wed Sep 23 01:53:51 2009
New Revision: 82620
URL: http://llvm.org/viewvc/llvm-project?rev=82620&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h
Modified: llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h?rev=82620&r1=82619&r2=82620&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h (original)
+++ llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h Wed Sep 23 01:53:51 2009
@@ -50,12 +50,16 @@
// 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.
More information about the llvm-commits
mailing list