![]() |
P4C
The P4 Compiler
|
Public Types | |
| enum class | MessageType : std::size_t { None , Error , Warning , Info } |
Public Member Functions | |
| ErrorMessage () | |
| Used by errorWithSuffix. | |
| ErrorMessage (const std::string &prefix, const Util::SourceInfo &info, const std::string &suffix) | |
| ErrorMessage (MessageType type, const std::string &prefix, const std::string &message, const std::vector< Util::SourceInfo > &locations, const std::string &suffix) | |
| ErrorMessage (MessageType type, const std::string &prefix, const std::string &suffix) | |
| std::string | getPrefix () const |
| std::string | toString () const |
Public Attributes | |
| std::vector< Util::SourceInfo > | locations = {} |
| Particular formatted message. | |
| std::string | message |
| Typically error/warning type from catalog. | |
| std::string | prefix |
| std::string | suffix |
| Relevant source locations for this error. | |
| MessageType | type = MessageType::None |
Structure populated via error_helper functions
Typically, calls to ::error/::warning have many parameters, some of them might have SourceInfo attribute. ::error_helper parse those parameters, format parameters to output message and extracts SourceInfo wherever possible.
Populated structure can be serialized to canonical error message with toString() method.
This structure is mainly used inside ErrorReporter, but some uses invoke ::error_helper directly and those uses need to call toString() on returned object.