[llvm] r220608 - Update the error handling of lib/Linker.

Alexander Kornienko alexfh at google.com
Mon Oct 27 14:00:58 PDT 2014


On Mon, Oct 27, 2014 at 1:55 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> On 27 October 2014 13:36, Alexander Kornienko <alexfh at google.com> wrote:
> > Also, I don't like the boilerplate code that saves the old diagnostic
> > handler, sets the new one, and then restores the old one after the use of
> > the Linker.
> >
> > Maybe add some kind of a scoped handler for the users that just need to
> > handle an error from a single api call?
>
>
> So, by "get an error" you mean "get a diagnostic message", right?


Exactly.


> The
> main intention of the patch was to split two very different concerns:
>
> * Informing the caller that something has failed. This should be a
> bool or, if more information is needed, an error_code with simple
> errors like: different_triple, read_error, etc.
>
> * Providing diagnostics for the human: "appending variable 'foo' has
> different types in different modules".
>
> I went with at DiagnosticInfo because that is what was at hand, but I
> agree there was more boilerplate than I was hopping for.
>
> What about passing an optional diagnostic handler? If nullptr is
> passed, the system one is used.


That could also work. We'd still need an adapter to avoid writing a handler
function each time.


> I will write a patch to see what it
> looks like and post it in this thread.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141027/f6ed63c3/attachment.html>


More information about the llvm-commits mailing list