tvm
|
An abstraction around how errors are stored and reported. Designed to be opaque to users, so we can support a robust and simpler error reporting mode, as well as a more complex mode. More...
#include <error.h>
Public Member Functions | |
ErrorReporter () | |
default constructor. More... | |
void | Report (const CompileError &err) |
Report a CompileError. More... | |
void | ReportAt (const GlobalVar &global, const ObjectRef &node, std::stringstream &err) |
Report an error against a program, using the full program error reporting strategy. More... | |
void | ReportAt (const GlobalVar &global, const ObjectRef &node, const CompileError &err) |
Report an error against a program, using the full program error reporting strategy. More... | |
void | RenderErrors (const IRModule &module, bool use_color=true) |
Render all reported errors and exit the program. More... | |
bool | AnyErrors () |
An abstraction around how errors are stored and reported. Designed to be opaque to users, so we can support a robust and simpler error reporting mode, as well as a more complex mode.
The first mode is the most accurate: we report a Relay error at a specific Span, and then render the error message directly against a textual representation of the program, highlighting the exact lines in which it occurs. This mode is not implemented in this PR and will not work.
The second mode is a general-purpose mode, which attempts to annotate the program's textual format with errors.
The final mode represents the old mode, if we report an error that has no span or expression, we will default to throwing an exception with a textual representation of the error and no indication of where it occurred in the original program.
The latter mode is not ideal, and the goal of the new error reporting machinery is to avoid ever reporting errors in this style.
|
inline |
default constructor.
|
inline |
void tvm::relay::ErrorReporter::RenderErrors | ( | const IRModule & | module, |
bool | use_color = true |
||
) |
Render all reported errors and exit the program.
This function should be used after executing a pass to render reported errors.
It will build an error message from the set of errors, depending on the error reporting strategy.
module | The module to report errors on. |
use_color | Controls whether to colorize the output. |
|
inline |
Report a CompileError.
This API is useful for reporting spanned errors.
err | The error to report. |
void tvm::relay::ErrorReporter::ReportAt | ( | const GlobalVar & | global, |
const ObjectRef & | node, | ||
const CompileError & | err | ||
) |
Report an error against a program, using the full program error reporting strategy.
This error reporting method requires the global function in which to report an error, the expression to report the error on, and the error object.
global | The global function in which the expression is contained. |
node | The expression or type to report the error at. |
err | The error to report. |
|
inline |
Report an error against a program, using the full program error reporting strategy.
This error reporting method requires the global function in which to report an error, the expression to report the error on, and the error object.
global | The global function in which the expression is contained. |
node | The expression or type to report the error at. |
err | The error message to report. |