Errorifying the bitcode reader

Hi all,

Just a heads up that I’m working on Errorifying the bitcode reader. Basically any errors that are currently being reported with the DiagnosticHandler would now be reported with an Error instead.

It’s turning out to be a rather large patch, but it should permit some much needed cleanups (e.g. not requiring an LLVMContext in some parts of the bitcode reader interface simply in order to provide a diagnostic handler) so I’m looking forward to the end result.


Thanks Peter!
(Both for the heads up and for doing this)

BTW I tried to do this a while ago, but held off on the patches because of the ThinLTO work I didn’t want to interfere with.

The easiest way I could find to do it was to use Error internally, but stop at API boundaries. So all the BitCodeReader methods used publicly would still be std::error_code. That made for a manageable patch, then a follow on could propagate errors out of the API to the clients.

Of course feel free to convert this however you feel is right. Just wanted to give some insight having done this before.