diff --git a/llvm/include/llvm/ADT/bit.h b/llvm/include/llvm/ADT/bit.h --- a/llvm/include/llvm/ADT/bit.h +++ b/llvm/include/llvm/ADT/bit.h @@ -14,7 +14,6 @@ #ifndef LLVM_ADT_BIT_H #define LLVM_ADT_BIT_H -#include "llvm/Support/Compiler.h" #include #include @@ -25,34 +24,10 @@ // - It requires trivially-constructible To, to avoid UB in the implementation. template < typename To, typename From, - typename = std::enable_if_t -#if (__has_feature(is_trivially_constructible) && defined(_LIBCPP_VERSION)) || \ - (defined(__GNUC__) && __GNUC__ >= 5) - , - typename = std::enable_if_t::value> -#elif __has_feature(is_trivially_constructible) - , - typename = std::enable_if_t<__is_trivially_constructible(To)> -#else - // See comment below. -#endif -#if (__has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)) || \ - (defined(__GNUC__) && __GNUC__ >= 5) - , + typename = std::enable_if_t, + typename = std::enable_if_t::value>, typename = std::enable_if_t::value>, - typename = std::enable_if_t::value> -#elif __has_feature(is_trivially_copyable) - , - typename = std::enable_if_t<__is_trivially_copyable(To)>, - typename = std::enable_if_t<__is_trivially_copyable(From)> -#else -// This case is GCC 4.x. clang with libc++ or libstdc++ never get here. Unlike -// llvm/Support/type_traits.h's is_trivially_copyable we don't want to -// provide a good-enough answer here: developers in that configuration will hit -// compilation failures on the bots instead of locally. That's acceptable -// because it's very few developers, and only until we move past C++11. -#endif - > + typename = std::enable_if_t::value>> inline To bit_cast(const From &from) noexcept { To to; std::memcpy(&to, &from, sizeof(To));