P4C
The P4 Compiler
|
#include <pass_utils.h>
Public Member Functions | |
DiagnosticCountInfo (BaseCompileContext &ctxt=BaseCompileContext::get()) | |
void | emitInfo (std::string_view componentInfo) |
DiagnosticCountInfoGuard | getInfoGuard (std::string_view componentInfo) |
DebugHook | getPassManagerHook () |
An alternative interface to the diagnostic count info that allows using it outside of pass manager (but can also generate a pass manager hook). All copies of one object and all hooks and guards derived from it share the same diagnostic message counts so they can provide consistent logs.
|
explicit |
ctxt | Optionally, you can provide a compilation context to take the diagnostic counts from. If not provied BaseCompileContext::get() is used. |
void P4::DiagnosticCountInfo::emitInfo | ( | std::string_view | componentInfo | ) |
Emits the information like printed by the debug hook, except using componentInfo as the info at the beginning of the line: the line will be in form "<componentInfo> emitted <counts>". This is useful e.g. for printing info about diagnostics in parser.
DiagnosticCountInfoGuard P4::DiagnosticCountInfo::getInfoGuard | ( | std::string_view | componentInfo | ) |
Similar to emitInfo, but prints the info at the moment the returned guard is destructed.
DebugHook P4::DiagnosticCountInfo::getPassManagerHook | ( | ) |
Very similar to getDiagnosticCountInPassHook, but the state is tied with this instance so that calling the hook and the emitInfo/ getInfoGuard during one compilation will produce the correct counts.