[PATCH] D44560: [DWARF] Rework debug line parsing to use llvm::Error and callbacks

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 3 08:58:26 PDT 2018


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"... )

*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.

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?

On Tue, Apr 3, 2018 at 8:49 AM Jonas Devlieghere via Phabricator <
reviews at reviews.llvm.org> wrote:

> JDevlieghere added a comment.
>
> In https://reviews.llvm.org/D44560#1055714, @dblaikie wrote:
>
> > I was picturing the parser being the thing that exposes the iterator - so
> >  it would be an internal detail & wouldn't really warrant an extra Error
> >  type - but I haven't thought about it too hard & maybe that doesn't make
> >  sense?
>
>
> 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).
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D44560
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180403/4ce839d7/attachment-0001.html>


More information about the llvm-commits mailing list