[Lldb-commits] [PATCH] D122293: [wip][intelpt] Refactoring instruction decoding for flexibility

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 23 23:08:39 PDT 2022


wallace added inline comments.


================
Comment at: lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp:149
+        thread.AppendError(insn_index, make_error<IntelPTError>(time_error, insn.ip));
+        thread.AppendInstruction(IntelPTInstruction(insn));
         break;
----------------
zrthxn wrote:
> wallace wrote:
> > This will create a copy of the IntelPTInstruction before storing it in the vector. Instead, you should use the same semantics as vector::emplace_back(), which uses paratemer packs/variadic templates. You can even rename Append to Emplace in this case
> Yea I was doing that before, the idea was to send those variadic args to emplace_back but that wasnt working. I introduced this to avoid having 2 Appends since we already have 2 constructors which fulfill that requirement, and I can change this to std::move to avoid copies if thats a concern
Yes, use the same pattern than emolace_back uses with a parameter pack


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122293



More information about the lldb-commits mailing list