Remove the hack where, to get the return status, we had special case for VerifyDiagnosticsClient
and just check the number of errors from the DiagnosticClient.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119736 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index c3eaea1..1f3b2cd 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -894,6 +894,7 @@
/// DiagnosticClient - This is an abstract interface implemented by clients of
/// the front-end, which formats and prints fully processed diagnostics.
class DiagnosticClient {
+protected:
unsigned NumWarnings; // Number of warnings reported
unsigned NumErrors; // Number of errors reported
diff --git a/include/clang/Frontend/VerifyDiagnosticsClient.h b/include/clang/Frontend/VerifyDiagnosticsClient.h
index 6f45e49..793cedd 100644
--- a/include/clang/Frontend/VerifyDiagnosticsClient.h
+++ b/include/clang/Frontend/VerifyDiagnosticsClient.h
@@ -68,7 +68,6 @@
llvm::OwningPtr<DiagnosticClient> PrimaryClient;
llvm::OwningPtr<TextDiagnosticBuffer> Buffer;
Preprocessor *CurrentPreprocessor;
- unsigned NumErrors;
private:
void CheckDiagnostics();
@@ -88,9 +87,6 @@
virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
const DiagnosticInfo &Info);
-
- /// HadErrors - Check if there were any mismatches in expected diagnostics.
- bool HadErrors();
};
} // end namspace clang
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 152dd6d..6755274 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -573,15 +573,7 @@
OS << "\n";
}
- // Return the appropriate status when verifying diagnostics.
- //
- // FIXME: If we could make getNumErrors() do the right thing, we wouldn't need
- // this.
- if (getDiagnosticOpts().VerifyDiagnostics)
- return !static_cast<VerifyDiagnosticsClient&>(
- getDiagnosticClient()).HadErrors();
-
- return !getDiagnostics().getNumErrors();
+ return !getDiagnostics().getClient()->getNumErrors();
}
diff --git a/lib/Frontend/VerifyDiagnosticsClient.cpp b/lib/Frontend/VerifyDiagnosticsClient.cpp
index 31eb28f..51b351f 100644
--- a/lib/Frontend/VerifyDiagnosticsClient.cpp
+++ b/lib/Frontend/VerifyDiagnosticsClient.cpp
@@ -23,7 +23,7 @@
VerifyDiagnosticsClient::VerifyDiagnosticsClient(Diagnostic &_Diags,
DiagnosticClient *_Primary)
: Diags(_Diags), PrimaryClient(_Primary),
- Buffer(new TextDiagnosticBuffer()), CurrentPreprocessor(0), NumErrors(0) {
+ Buffer(new TextDiagnosticBuffer()), CurrentPreprocessor(0) {
}
VerifyDiagnosticsClient::~VerifyDiagnosticsClient() {
@@ -57,14 +57,6 @@
Buffer->HandleDiagnostic(DiagLevel, Info);
}
-// FIXME: It would be nice to just get this from the primary diagnostic client
-// or something.
-bool VerifyDiagnosticsClient::HadErrors() {
- CheckDiagnostics();
-
- return NumErrors != 0;
-}
-
//===----------------------------------------------------------------------===//
// Checking diagnostics implementation.
//===----------------------------------------------------------------------===//