[PATCH] D138554: [clang][Interp] Use placement new to construct opcode arguments into bytecode vector

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 23 07:38:42 PST 2022


sepavloff added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeEmitter.cpp:166
   if constexpr (!std::is_pointer_v<T>) {
-    const char *Data = reinterpret_cast<const char *>(&Val);
-    Code.insert(Code.end(), Data, Data + Size);
+    if constexpr (std::is_trivially_copyable_v<T>) {
+      const char *Data = reinterpret_cast<const char *>(&Val);
----------------
Do we really need a separate case for trivially copyable types?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138554/new/

https://reviews.llvm.org/D138554



More information about the cfe-commits mailing list