<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 10, 2015 at 9:15 AM, Yaron Keren via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@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">Author: yrnkrn<br>
Date: Mon Aug 10 11:15:51 2015<br>
New Revision: 244455<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=244455&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=244455&view=rev</a><br>
Log:<br>
Modify r244405 to clearer code, per David Blaikie suggestion.<br>
<br>
<br>
Modified:<br>
    llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br>
<br>
Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=244455&r1=244454&r2=244455&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=244455&r1=244454&r2=244455&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)<br>
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Mon Aug 10 11:15:51 2015<br>
@@ -2884,8 +2884,8 @@ void DwarfLinker::patchLineTableForUnit(<br>
       if (StopAddress != -1ULL && !Seq.empty()) {<br>
         // Insert end sequence row with the computed end address, but<br>
         // the same line as the previous one.<br>
-        Seq.reserve(Seq.size() + 1);<br>
-        Seq.emplace_back(Seq.back());<br>
+        auto NextLine = Seq.back();<br>
+        Seq.emplace_back(NextLine);<br></blockquote><div><br>I don't think there's any benefit to emplace_back here since there are no explicit conversions required. I'd probably usse push_back - and this still seems like it'd be easy for someone to just decide to fold the two statements together & create the original bug. The suggestion I was making was to avoid doing the initialization (the following several assignment statements \/ ) on the container element itself, but do it on the local. Then push that local onto the sequence - that seems less subtle (or at least it hides it better by not making it look like a trivial cleanup to collapse two expressions would be an improvement).<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
         Seq.back().Address = StopAddress;<br>
         Seq.back().EndSequence = 1;<br>
         Seq.back().PrologueEnd = 0;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>