diff --git a/lib/error.h b/lib/error.h index c80e24d92bf..ce0f3d1a971 100644 --- a/lib/error.h +++ b/lib/error.h @@ -422,6 +422,12 @@ class ErrorReporter final { return warningCount; } + // Resets this ErrorReporter to its initial state. + void clear() { + errorCount = 0; + warningCount = 0; + } + // Special error functions to be called from the parser only. // In the parser the IR objects don't yet have position information. // Use printf-format style arguments. @@ -469,4 +475,8 @@ inline void warning(const char* format, T... args) { ErrorReporter::instance.warning(format, args...); } +inline void clearErrorReporter() { + ErrorReporter::instance.clear(); +} + #endif /* P4C_LIB_ERROR_H_ */