Set Diag.ErrorOccurred even if a DiagnosticConsumer does not want it in
authorDaniel Jasper <djasper@google.com>
Fri, 28 Sep 2012 15:45:07 +0000 (15:45 +0000)
committerDaniel Jasper <djasper@google.com>
Fri, 28 Sep 2012 15:45:07 +0000 (15:45 +0000)
diagnostic count.

If a DiagnosticConsumer sub-class overwrites IncludeInDiagnosticCounts,
this should change diagnostic counts. However, it currently also
influences Diag.ErrorOccurred, which in turn influences the behavior of
parsing and semantic analysis (in a way that can make it crash).

llvm-svn: 164824

clang/lib/Basic/DiagnosticIDs.cpp

index ca96fd2..ed97643 100644 (file)
@@ -628,9 +628,9 @@ bool DiagnosticIDs::ProcessDiag(DiagnosticsEngine &Diag) const {
   if (DiagLevel >= DiagnosticIDs::Error) {
     if (isUnrecoverable(DiagID))
       Diag.UnrecoverableErrorOccurred = true;
-    
+
+    Diag.ErrorOccurred = true;
     if (Diag.Client->IncludeInDiagnosticCounts()) {
-      Diag.ErrorOccurred = true;
       ++Diag.NumErrors;
     }
 
@@ -686,4 +686,3 @@ bool DiagnosticIDs::isARCDiagnostic(unsigned DiagID) {
   unsigned cat = getCategoryNumberForDiag(DiagID);
   return DiagnosticIDs::getCategoryNameFromID(cat).startswith("ARC ");
 }
-