This is an archive of the discontinued LLVM Phabricator instance.

Give guidance on report_fatal_error in CodingStandards.rst and ProgrammersManual.rst
ClosedPublic

Authored by asb on Aug 17 2017, 5:37 AM.

Details

Summary

The current ProgrammersManual.rst document has a lot of well-written documentation on error handling thanks to @lhames. It suggests errors can be split cleanly into "programmatic" and "recoverable" errors. However, the reality in current LLVM seems to be there are a number of cases where a non-programmatic error is not easily recoverable. Therefore, add a note to indicate the existence of report_fatal_error for these cases. I've also added a reminder to CodingStandards.rst in the section on assertions, to indicate that llvm_unreachable and assertions should not be relied upon to report errors triggered by user input.

Thanks to @majnemer for pointing out out my llvm_unreachable abuse in a number of my RISC-V patches.

The ProgrammersManual is also silent on the use of LLVMContext::diagnose, which is used in BPF+WebAssembly+AMDGPU to report some errors during instruction selection. I don't address that in this patch, as it's not quite clear how to fit in to the current error handling story.

Diff Detail

Event Timeline

asb created this revision.Aug 17 2017, 5:37 AM
asb edited the summary of this revision. (Show Details)Aug 17 2017, 5:38 AM
lhames accepted this revision.Aug 17 2017, 8:56 PM

Looks good to me. Thanks very much Alex!

This revision is now accepted and ready to land.Aug 17 2017, 8:56 PM
This revision was automatically updated to reflect the committed changes.