diff options
-rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h | 7 | ||||
-rw-r--r-- | llvm/include/llvm/Support/type_traits.h | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h b/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h index 6b675e27036..74133753370 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h @@ -132,10 +132,15 @@ struct GloballyHashedType { return Hashes; } }; -static_assert(isPodLike<GloballyHashedType>::value, +#if defined(_MSC_VER) +// is_trivially_copyable is not available in older versions of libc++, but it is +// available in all supported versions of MSVC, so at least this gives us some +// coverage. +static_assert(std::is_trivially_copyable<GloballyHashedType>::value, "GloballyHashedType must be trivially copyable so that we can " "reinterpret_cast arrays of hash data to arrays of " "GloballyHashedType"); +#endif } // namespace codeview template <> struct DenseMapInfo<codeview::LocallyHashedType> { diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h index 4f1295f1b48..cc087835880 100644 --- a/llvm/include/llvm/Support/type_traits.h +++ b/llvm/include/llvm/Support/type_traits.h @@ -30,9 +30,9 @@ namespace llvm { template <typename T> struct isPodLike { // std::is_trivially_copyable is available in libc++ with clang, libstdc++ - // that comes with GCC 5, and MSVC. + // that comes with GCC 5. #if (__has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)) || \ - (defined(__GNUC__) && __GNUC__ >= 5) || defined(_MSC_VER) + (defined(__GNUC__) && __GNUC__ >= 5) // If the compiler supports the is_trivially_copyable trait use it, as it // matches the definition of isPodLike closely. static const bool value = std::is_trivially_copyable<T>::value; |