summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Basic/Diagnostic.cpp9
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp3
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index bd1d6e8b70e..755fbed66f3 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -227,6 +227,7 @@ Diagnostic::Diagnostic(DiagnosticClient *client) : Client(client) {
NumWarnings = 0;
NumErrors = 0;
+ NumErrorsSuppressed = 0;
CustomDiagInfo = 0;
CurDiagID = ~0U;
LastDiagLevel = Ignored;
@@ -537,8 +538,14 @@ bool Diagnostic::ProcessDiag() {
// If a fatal error has already been emitted, silence all subsequent
// diagnostics.
- if (FatalErrorOccurred)
+ if (FatalErrorOccurred) {
+ if (DiagLevel >= Diagnostic::Error) {
+ ++NumErrors;
+ ++NumErrorsSuppressed;
+ }
+
return false;
+ }
// If the client doesn't care about this message, don't issue it. If this is
// a note and the last real diagnostic was ignored, ignore it too.
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 685e6c281cc..5ed9c409a3d 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -515,7 +515,8 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
if (getDiagnosticOpts().ShowCarets) {
unsigned NumWarnings = getDiagnostics().getNumWarnings();
- unsigned NumErrors = getDiagnostics().getNumErrors();
+ unsigned NumErrors = getDiagnostics().getNumErrors() -
+ getDiagnostics().getNumErrorsSuppressed();
if (NumWarnings)
OS << NumWarnings << " warning" << (NumWarnings == 1 ? "" : "s");
OpenPOWER on IntegriCloud