[llvm] r320739 - Revert "Fix isPodLike for MSVC and use it in TypeHashing."

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 11:59:10 PST 2017


Author: zturner
Date: Thu Dec 14 11:59:10 2017
New Revision: 320739

URL: http://llvm.org/viewvc/llvm-project?rev=320739&view=rev
Log:
Revert "Fix isPodLike for MSVC and use it in TypeHashing."

This reverts commit ac5edc198eb612f82293850c3488042708b1c5fa.

Apparently this doesn't cover all the bases, so some compilers
and standard libraries still think this is not trivially copyable
even though it is.  Reverting this back to an MSVC-only check for
now so that at least we have some coverage.

Modified:
    llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h
    llvm/trunk/include/llvm/Support/type_traits.h

Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h?rev=320739&r1=320738&r2=320739&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h Thu Dec 14 11:59:10 2017
@@ -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> {

Modified: llvm/trunk/include/llvm/Support/type_traits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/type_traits.h?rev=320739&r1=320738&r2=320739&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/type_traits.h (original)
+++ llvm/trunk/include/llvm/Support/type_traits.h Thu Dec 14 11:59:10 2017
@@ -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;




More information about the llvm-commits mailing list