[Lldb-commits] [PATCH] D87675: [lldb/DWARF] Refactor to prefer emplace_back() vs. push_back()

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 15 03:58:55 PDT 2020

labath added a comment.

Using emplacement instead of construction is a good idea, where it makes sense. However, I am not convinced that adding constructors to otherwise-trivial structures is worth it. These structures are usually trivially copyable and/or movable and so an emplacement does not really save much.

And I am definitely sure that the constructors we do add should be taking (lvalue) references -- that precludes construction with anything other than an lvalue, which is just weird. They also force at least one copy, whereas a equivalent (properly written) push_back call could use no copies.

So, I'd just limit this patch to the cases where one does not need to add additional constructors to make emplace_back work.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list