[cfe-commits] r119736 - in /cfe/trunk: include/clang/Basic/Diagnostic.h include/clang/Frontend/VerifyDiagnosticsClient.h lib/Frontend/CompilerInstance.cpp lib/Frontend/VerifyDiagnosticsClient.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Nov 18 13:13:57 PST 2010
Author: akirtzidis
Date: Thu Nov 18 15:13:57 2010
New Revision: 119736
URL: http://llvm.org/viewvc/llvm-project?rev=119736&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Basic/Diagnostic.h
cfe/trunk/include/clang/Frontend/VerifyDiagnosticsClient.h
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp
Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=119736&r1=119735&r2=119736&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Thu Nov 18 15:13:57 2010
@@ -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
Modified: cfe/trunk/include/clang/Frontend/VerifyDiagnosticsClient.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/VerifyDiagnosticsClient.h?rev=119736&r1=119735&r2=119736&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/VerifyDiagnosticsClient.h (original)
+++ cfe/trunk/include/clang/Frontend/VerifyDiagnosticsClient.h Thu Nov 18 15:13:57 2010
@@ -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
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=119736&r1=119735&r2=119736&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Thu Nov 18 15:13:57 2010
@@ -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();
}
Modified: cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp?rev=119736&r1=119735&r2=119736&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp (original)
+++ cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp Thu Nov 18 15:13:57 2010
@@ -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.
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list