/// packed into four bits per diagnostic.
unsigned char DiagMappings[diag::DIAG_UPPER_LIMIT/2];
- /// ErrorOccurred - This is set to true when an error is emitted, and is
- /// sticky.
+ /// ErrorOccurred / FatalErrorOccurred - This is set to true when an error or
+ /// fatal error is emitted, and is sticky.
bool ErrorOccurred;
+ bool FatalErrorOccurred;
unsigned NumDiagnostics; // Number of diagnostics reported
unsigned NumErrors; // Number of diagnostics that are errors
}
bool hasErrorOccurred() const { return ErrorOccurred; }
+ bool hasFatalErrorOccurred() const { return FatalErrorOccurred; }
unsigned getNumErrors() const { return NumErrors; }
unsigned getNumDiagnostics() const { return NumDiagnostics; }
memset(DiagMappings, 0, sizeof(DiagMappings));
ErrorOccurred = false;
+ FatalErrorOccurred = false;
NumDiagnostics = 0;
NumErrors = 0;
CustomDiagInfo = 0;
void Diagnostic::ProcessDiag() {
DiagnosticInfo Info(this);
+ // If a fatal error has already been emitted, silence all subsequent
+ // diagnostics.
+ if (FatalErrorOccurred)
+ return;
+
// Figure out the diagnostic level of this message.
Diagnostic::Level DiagLevel = getDiagnosticLevel(Info.getID());
if (DiagLevel >= Diagnostic::Error) {
ErrorOccurred = true;
-
++NumErrors;
+
+ if (DiagLevel == Diagnostic::Fatal)
+ FatalErrorOccurred = true;
}
// Finally, report it.