[llvm] r295526 - Use llvm workaround for missing is_trivially_copyable.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 17:46:01 PST 2017


Author: zturner
Date: Fri Feb 17 19:46:01 2017
New Revision: 295526

URL: http://llvm.org/viewvc/llvm-project?rev=295526&view=rev
Log:
Use llvm workaround for missing is_trivially_copyable.

some versions of GCC don't have this, so LLVM provides a
workaround.

Modified:
    llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h
    llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h

Modified: llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h?rev=295526&r1=295525&r2=295526&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/MSF/StreamReader.h Fri Feb 17 19:46:01 2017
@@ -17,8 +17,10 @@
 #include "llvm/DebugInfo/MSF/StreamRef.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/type_traits.h"
 
 #include <string>
+#include <type_traits>
 
 namespace llvm {
 namespace msf {
@@ -63,7 +65,7 @@ public:
   }
 
   template <typename T> Error readObject(const T *&Dest) {
-    static_assert(std::is_trivially_copyable<T>::value,
+    static_assert(isPodLike<T>::value,
                   "Can only read trivially copyable object types!");
     ArrayRef<uint8_t> Buffer;
     if (auto EC = readBytes(Buffer, sizeof(T)))
@@ -74,7 +76,7 @@ public:
 
   template <typename T>
   Error readArray(ArrayRef<T> &Array, uint32_t NumElements) {
-    static_assert(std::is_trivially_copyable<T>::value,
+    static_assert(isPodLike<T>::value,
                   "Can only read trivially copyable object types!");
     ArrayRef<uint8_t> Bytes;
     if (NumElements == 0) {
@@ -102,7 +104,7 @@ public:
 
   template <typename T>
   Error readArray(FixedStreamArray<T> &Array, uint32_t NumItems) {
-    static_assert(std::is_trivially_copyable<T>::value,
+    static_assert(isPodLike<T>::value,
                   "Can only read trivially copyable object types!");
     if (NumItems == 0) {
       Array = FixedStreamArray<T>();

Modified: llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h?rev=295526&r1=295525&r2=295526&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h Fri Feb 17 19:46:01 2017
@@ -17,6 +17,7 @@
 #include "llvm/DebugInfo/MSF/StreamRef.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/type_traits.h"
 #include <cstdint>
 #include <type_traits>
 
@@ -61,14 +62,14 @@ public:
                   "writeObject should not be used with pointers, to write "
                   "the pointed-to value dereference the pointer before calling "
                   "writeObject");
-    static_assert(std::is_trivially_copyable<T>::value,
+    static_assert(isPodLike<T>::value,
                   "Can only serialize trivially copyable object types");
     return writeBytes(
         ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(&Obj), sizeof(T)));
   }
 
   template <typename T> Error writeArray(ArrayRef<T> Array) {
-    static_assert(std::is_trivially_copyable<T>::value,
+    static_assert(isPodLike<T>::value,
                   "Can only serialize trivially copyable object types");
     if (Array.empty())
       return Error::success();
@@ -87,7 +88,7 @@ public:
   }
 
   template <typename T> Error writeArray(FixedStreamArray<T> Array) {
-    static_assert(std::is_trivially_copyable<T>::value,
+    static_assert(isPodLike<T>::value,
                   "Can only serialize trivially copyable object types");
     return writeStreamRef(Array.getUnderlyingStream());
   }




More information about the llvm-commits mailing list