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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Oct 27 13:55:04 PDT 2014


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? 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. I will write a patch to see what it
looks like and post it in this thread.

Cheers,
Rafael



More information about the llvm-commits mailing list