]> granicus.if.org Git - clang/commitdiff
Remove the hack where, to get the return status, we had special case for VerifyDiagno...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 18 Nov 2010 21:13:57 +0000 (21:13 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 18 Nov 2010 21:13:57 +0000 (21:13 +0000)
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

include/clang/Basic/Diagnostic.h
include/clang/Frontend/VerifyDiagnosticsClient.h
lib/Frontend/CompilerInstance.cpp
lib/Frontend/VerifyDiagnosticsClient.cpp

index c3eaea153935d7cad6d7cd8f5f6ec538dbe0232a..1f3b2cd5f47ca86c32a5ac87baef021bde2810ef 100644 (file)
@@ -894,6 +894,7 @@ public:
 /// 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
   
index 6f45e49ec0efee8060956aa2306a91ea4356fa59..793cedd8578f40b249d73981d83336e99fd268f9 100644 (file)
@@ -68,7 +68,6 @@ public:
   llvm::OwningPtr<DiagnosticClient> PrimaryClient;
   llvm::OwningPtr<TextDiagnosticBuffer> Buffer;
   Preprocessor *CurrentPreprocessor;
-  unsigned NumErrors;
 
 private:
   void CheckDiagnostics();
@@ -88,9 +87,6 @@ public:
 
   virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
                                 const DiagnosticInfo &Info);
-
-  /// HadErrors - Check if there were any mismatches in expected diagnostics.
-  bool HadErrors();
 };
 
 } // end namspace clang
index 152dd6d5b6b637bb5dd0fb5c7382eafd46263ffc..67552747d44802c7d69ebab13dec404089ba3b9a 100644 (file)
@@ -573,15 +573,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
     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();
 }
 
 
index 31eb28f912ca7eb13460c80894a63d439033c02a..51b351f4a923dca0ea233fd27749183dbcfc0243 100644 (file)
@@ -23,7 +23,7 @@ using namespace clang;
 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 @@ void VerifyDiagnosticsClient::HandleDiagnostic(Diagnostic::Level DiagLevel,
   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.
 //===----------------------------------------------------------------------===//