<div dir="ltr">iterator or iterator-like thing. One option would be a callback with Error when the iterator is retrieved - and that's called back for any error (& the user wouldn't need to differentiate the different kinds of error - the iterator would stop when it couldn't continue). Or an Iterator-like but not-actually-iterator API that exposes the Error during iteration (but that'd probably look a bit awkward & be something like pair<Error, Optional<T>> or, yes, as suggested - a separate Error type to communicate "fail and cotninue" separately from "fail and stop"... )<br><br>*ponders* Yeah, sort of feel like the callback would be pretty suitable - a plain/real iterator that only gives valid line tables (or sufficiently valid to have some interesting content for dumping, etc?) & anything invalid triggers the Error callback, etc.<br><br>I know I've discussed this sort of API (iteration with an Error callback) with Lang before - I think he used that in libObject in some places already? Maybe? Might be worth chatting with him a bit?</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Apr 3, 2018 at 8:49 AM Jonas Devlieghere via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">JDevlieghere added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D44560#1055714" rel="noreferrer" target="_blank">https://reviews.llvm.org/D44560#1055714</a>, @dblaikie wrote:<br>
<br>
> I was picturing the parser being the thing that exposes the iterator - so<br>
>  it would be an internal detail & wouldn't really warrant an extra Error<br>
>  type - but I haven't thought about it too hard & maybe that doesn't make<br>
>  sense?<br>
<br>
<br>
The way the code is currently structured, `Parse` initializes the object on which you call it. What you say makes a lot of sense to have in DWARFContext, or alternatively in an abstraction between the two. Still, with the iterator you don't know what the reason is you don't have a line table, which I think was the motivation for this patch (to expose this to LLD).<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D44560" rel="noreferrer" target="_blank">https://reviews.llvm.org/D44560</a><br>
<br>
<br>
<br>
</blockquote></div>