[PATCH] D20550: Linker: error_code'ify the IR mover. NFC.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 17:34:19 PDT 2016

Hi Rafael,

Just in case it's useful: You can accumulate Error instances using the
join_errors function. It's intended for situations where you want to
accumulate multiple diagnostics before bailing out. That said, I think it
would be reasonable to just bail early here as you suggested.

Convertibility to error_code is important: Unless you can be certain that
all clients of the interface have transitioned 100% to Error, you have to
assume that a client might call errorToErrorCode, and if you haven't
implemented the conversion that call will crash.

I've generally aimed for error_code <-> Error mappings that are reasonably
information preserving, but we could introduce a new error_category and
enum in the Error header: IndescribableError, and allow people who are
introducing new Error types to map to that. It might even serve as a handy
forcing function to get people to move over.

- Lang.

On Tue, May 24, 2016 at 5:09 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> With this patch the linker would be using all 3 error handling systems
> in llvm, which is way too much.
> What I think needs to happen is for it to have an Error class that is
> not converted to error_code. We also have to decide if we are keeping
> a list of error or just failing early. I don't think it is worth it
> keeping multiple errors, so I would suggest refactoring the code to
> return early and only store the error when it hits an interface that
> returns void.
> We should also stop logging error to the streamer and instead have the
> caller uses log on the Error.
> The attached patch implements part of that. What do you think?
> Cheers,
> Rafael
> On 24 May 2016 at 18:53, Rafael EspĂ­ndola <rafael.espindola at gmail.com>
> wrote:
> > Taking a look.
> >
> > On 24 May 2016 at 18:30, Peter Collingbourne <peter at pcc.me.uk> wrote:
> >> pcc added a comment.
> >>
> >> Thanks Lang. This new patch does as you suggested: it retains the
> std::error_category, but converts the error_code to an Error at the last
> moment. I have also updated the call sites to handle a non-null Error in
> the same way as they handled a true return value before.
> >>
> >>
> >> http://reviews.llvm.org/D20550
> >>
> >>
> >>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160524/7552ae78/attachment.html>

More information about the llvm-commits mailing list