<div dir="ltr">Transformation as in clang-tidy? Or as in optimization in Clang? I doubt the latter, but could imagine the former. I'm not sure if it's a universally preferred transformation, though (but that's one of the benefits of clang-tidy, it doesn't have to be)</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 28, 2016 at 7:00 PM, Vedant Kumar via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
It's common to see code which does this:<br>
<br>
  (1) V.push_back(T(args, ...));<br>
<br>
When it could do this instead:<br>
<br>
  (2) V.emplace_back(args, ...);<br>
<br>
IIUC, the copy constructor for T is never called in case (2).<br>
<br>
Would it be possible/worthwhile/correctness-preserving to perform this transformation in clang? Based on a cursory grep it doesn't seem like we do this today, but I could've missed something.<br>
<br>
thanks<br>
vedant<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>