[llvm-exegesis] Improve error reporting
authorMiloš Stojanović <Milos.Stojanovic@rt-rk.com>
Thu, 6 Feb 2020 09:48:41 +0000 (10:48 +0100)
committerMiloš Stojanović <Milos.Stojanovic@rt-rk.com>
Thu, 6 Feb 2020 11:26:08 +0000 (12:26 +0100)
commitb3576f60ebc8f660afad8120a72473be47517573
treee7e2649cd7e96e9246b7f17de2dcbba1e02fc818
parent529e6f8791b624d94c10a04dc4e530e4a22ac520
[llvm-exegesis] Improve error reporting

Fix inconsistencies in error reporting created by mixing
`report_fatal_error()` and `ExitOnErr()`, and add additional information
to the error message to make it more user friendly. Minimize the use
`report_fatal_error()` because it's meant for use in very rare cases and
it results in low information density of the error messages.

Summary of the new design:

 * For command line argument errors output `llvm-exegesis: <error_message>`,
   which is consistent with the error output format emitted by the backend
   which checks correctness of the command line arguments.
 * For other errors the format `llvm-exegesis error: <error_message>` is used.
 ** If the error occurred during file access `<error_message>` will have
    of two parts: `'<file_name>': <rest_of_the_error_message>`

Differential Revision: https://reviews.llvm.org/D74085
llvm/tools/llvm-exegesis/llvm-exegesis.cpp