[PATCH] D25425: [AST] Convert Marshallers to use unique_ptr.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 09:03:17 PDT 2016


jlebar marked 2 inline comments as done.
jlebar added inline comments.


================
Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.h:514
+      MutableArrayRef<std::unique_ptr<MatcherDescriptor>> Callbacks)
+      : Overloads(std::make_move_iterator(Callbacks.begin()),
+                  std::make_move_iterator(Callbacks.end())) {}
----------------
timshen wrote:
> Notice that this is 2x slower, because move on unique_ptr resets the move-from side. But it is less likely to have an issue.
It may be even worse than that because we used to be able to do memcpy, but now, unless llvm is incredibly smart, we're forced to copy one element at a time.

I think these lists are at most two elements, though.


https://reviews.llvm.org/D25425





More information about the cfe-commits mailing list