<div dir="ltr">Hi Rafael,<div><br></div><div>How could you ignore the error in Kevin's solution?</div><div><br></div><div>I think your solution and his are essentially the same, except that you check the error on increment and he checks it on dereference. In practice you always have to do both operations (you can't do multiple increments without checking the error anyway, and you can just do that by deref'ing), and checking via deref allows you to used range-based for, which makes the code neater.</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div><div><div class="gmail_extra"><div class="gmail_quote">On Thu, Oct 29, 2015 at 5:11 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On 28 October 2015 at 15:21, Kevin Enderby <<a href="mailto:enderby@apple.com">enderby@apple.com</a>> wrote:<br>
> enderby added a comment.<br>
><br>
> I agree with Lang and like the original patch where were were handling failure was done inside the iterator.  It does allow use of ranged-based for loops and appears to me much cleaner in the code especially in the lld changes needed in <a href="http://reviews.llvm.org/D13990" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13990</a> .<br>
<br>
</span>I think that the most important consideration is making the error hard<br>
to ignore. That means using ErrorOr.<br>
<br>
The sad reality is that the archive format can cause us to find an<br>
error when going from one member to the next. That, with the above<br>
requirement means that it doesn't fit on range loop.<br>
<span class=""><br>
> Rafael, I did "finish it up" based on your t.diff patch and that is below and includes the re-formatting with clang-format-diff, removal of the malformed-archives directory putting the .a files in Inputs and removal of the "nice but independent" changes.<br>
><br>
> F1026846: llvm_updated_t.diff <<a href="http://reviews.llvm.org/F1026846" rel="noreferrer" target="_blank">http://reviews.llvm.org/F1026846</a>><br>
<br>
<br>
</span>Thanks!<br>
<br>
You don't need to change ErrorOr.h.<br>
<br>
The change to detect the end of the archive seems more complicated<br>
than necessary (see the attached patch for a suggestion).<br>
<br>
Cases like the Increment in BinaryHolder expose a naked EC, which is<br>
what using ErrorOr is trying to avoid. Just inlining it solves the<br>
problem (see patch).<br>
<br>
Please convert the remaining user of Increment to return void when possible.<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div></div></div>