diff --git a/llvm/include/llvm/Support/PointerLikeTypeTraits.h b/llvm/include/llvm/Support/PointerLikeTypeTraits.h --- a/llvm/include/llvm/Support/PointerLikeTypeTraits.h +++ b/llvm/include/llvm/Support/PointerLikeTypeTraits.h @@ -56,7 +56,8 @@ static inline void *getAsVoidPointer(T *P) { return P; } static inline T *getFromVoidPointer(void *P) { return static_cast(P); } - enum { NumLowBitsAvailable = detail::ConstantLog2::value }; + static constexpr int NumLowBitsAvailable = + detail::ConstantLog2::value; }; template <> struct PointerLikeTypeTraits { @@ -70,7 +71,7 @@ /// /// All clients should use assertions to do a run-time check to ensure that /// this is actually true. - enum { NumLowBitsAvailable = 2 }; + static constexpr int NumLowBitsAvailable = 2; }; // Provide PointerLikeTypeTraits for const things. @@ -83,7 +84,7 @@ static inline const T getFromVoidPointer(const void *P) { return NonConst::getFromVoidPointer(const_cast(P)); } - enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable }; + static constexpr int NumLowBitsAvailable = NonConst::NumLowBitsAvailable; }; // Provide PointerLikeTypeTraits for const pointers. @@ -96,7 +97,7 @@ static inline const T *getFromVoidPointer(const void *P) { return NonConst::getFromVoidPointer(const_cast(P)); } - enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable }; + static constexpr int NumLowBitsAvailable = NonConst::NumLowBitsAvailable; }; // Provide PointerLikeTypeTraits for uintptr_t. @@ -108,7 +109,7 @@ return reinterpret_cast(P); } // No bits are available! - enum { NumLowBitsAvailable = 0 }; + static constexpr int NumLowBitsAvailable = 0; }; /// Provide suitable custom traits struct for function pointers. @@ -121,7 +122,8 @@ /// potentially use alignment attributes on functions to satisfy that. template struct FunctionPointerLikeTypeTraits { - enum { NumLowBitsAvailable = detail::ConstantLog2::value }; + static constexpr int NumLowBitsAvailable = + detail::ConstantLog2::value; static inline void *getAsVoidPointer(FunctionPointerT P) { assert((reinterpret_cast(P) & ~((uintptr_t)-1 << NumLowBitsAvailable)) == 0 &&