[cfe-commits] [PATCH] Set Diag.ErrorOccurred even if a DiagnosticConsumer does not want it in diagnostic count

Daniel Jasper reviews at llvm-reviews.chandlerc.com
Fri Sep 28 02:19:33 PDT 2012


Hi rsmith, doug.gregor,

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).

http://llvm-reviews.chandlerc.com/D53

Files:
  lib/Basic/DiagnosticIDs.cpp

Index: lib/Basic/DiagnosticIDs.cpp
===================================================================
--- lib/Basic/DiagnosticIDs.cpp
+++ lib/Basic/DiagnosticIDs.cpp
@@ -628,9 +628,9 @@
   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 @@
   unsigned cat = getCategoryNumberForDiag(DiagID);
   return DiagnosticIDs::getCategoryNameFromID(cat).startswith("ARC ");
 }
-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53.1.patch
Type: text/x-patch
Size: 622 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120928/16e41e86/attachment.bin>


More information about the cfe-commits mailing list