<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 10, 2015 at 9:56 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">Oops, I didn't notice that additional change when editing and did not copy & paste.</div><div dir="ltr">Fixed + added comment in r244461.</div></div></blockquote><div><br>It's still pretty easy to roll the two expressions in together (the comment helps, for sure - though it's easy to gloss over them). Doing all the variable initialization on the local, rather than in the vector, would separate the local creation from the push_back a lot & make this probably fine without a comment, I think.<br><br>- David<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr"><br></div></div><div><div><div class="gmail_extra"><div dir="ltr"><br><div class="gmail_quote">2015-08-10 19:46 GMT+03:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>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></span><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><span><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" target="_blank">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></span></div><br></div></blockquote></div></div></div>
</div></div></blockquote></div><br></div></div>