[PATCH] D18483: NFC: static_assert instead of comment

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 15:00:46 PDT 2016

jfb created this revision.
jfb added a subscriber: llvm-commits.

isPodLike is as close as we have for is_trivially_copyable.



Index: lib/CodeGen/MachineInstr.cpp
--- lib/CodeGen/MachineInstr.cpp
+++ lib/CodeGen/MachineInstr.cpp
@@ -38,6 +38,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/type_traits.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetRegisterInfo.h"
@@ -757,7 +758,8 @@
   if (MRI)
     return MRI->moveOperands(Dst, Src, NumOps);
-  // MachineOperand is a trivially copyable type so we can just use memmove.
+  static_assert(isPodLike<MachineOperand>::value,
+                "must be trivially copyable to memmove");
   std::memmove(Dst, Src, NumOps * sizeof(MachineOperand));

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18483.51690.patch
Type: text/x-patch
Size: 808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160325/4f2a890f/attachment.bin>

More information about the llvm-commits mailing list