P4C
The P4 Compiler
|
Public Types | |
enum class | CheckResult { NO_TESTS , SUCCESS , FAILURE } |
Public Member Functions | |
void | add_check (ErrorMessage::MessageType type, const std::string &msg) |
Adds a check with no specified source code line. | |
void | add_check (ErrorMessage::MessageType type, int line, const std::string &msg) |
Adds a check which requires that an error/warning message includes the specified regex as well as the specified line number. | |
void | increment_the_error_count () |
CheckResult | verify_checks () const |
Verify error/warning checks in the program. During compilation, if an error/warning message matches the check message regex and its source line, the check is considered to be successful. | |
Protected Member Functions | |
void | emit_message (const ErrorMessage &msg) override |
void | emit_message (const ParserErrorMessage &msg) override |
void BfErrorReporter::add_check | ( | ErrorMessage::MessageType | type, |
const std::string & | msg ) |
Adds a check with no specified source code line.
type | error or warning |
msg | expected regex |
void BfErrorReporter::add_check | ( | ErrorMessage::MessageType | type, |
int | line, | ||
const std::string & | msg ) |
Adds a check which requires that an error/warning message includes the specified regex as well as the specified line number.
type | error or warning |
line | source location that the error/warning has to include, value of 0 means that no source location is required |
msg | expected regex |
BfErrorReporter::CheckResult BfErrorReporter::verify_checks | ( | ) | const |
Verify error/warning checks in the program. During compilation, if an error/warning message matches the check message regex and its source line, the check is considered to be successful.
This method should be called at the end of compilation. It will report any unmatched checks as errors as well as any additional errors that weren't matched to a check. If there are no checks in the program, the method does nothing and returns NO_TESTS.