[cfe-commits] r39502 - in /cfe/cfe/trunk: Basic/Diagnostic.cpp include/clang/Basic/Diagnostic.h

clattner at cs.uiuc.edu clattner at cs.uiuc.edu
Wed Jul 11 09:45:03 PDT 2007


Author: clattner
Date: Wed Jul 11 11:45:03 2007
New Revision: 39502

URL: http://llvm.org/viewvc/llvm-project?rev=39502&view=rev
Log:
track whether an error has been emitted.

Modified:
    cfe/cfe/trunk/Basic/Diagnostic.cpp
    cfe/cfe/trunk/include/clang/Basic/Diagnostic.h

Modified: cfe/cfe/trunk/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Basic/Diagnostic.cpp?rev=39502&r1=39501&r2=39502&view=diff

==============================================================================
--- cfe/cfe/trunk/Basic/Diagnostic.cpp (original)
+++ cfe/cfe/trunk/Basic/Diagnostic.cpp Wed Jul 11 11:45:03 2007
@@ -57,6 +57,8 @@
   ErrorOnExtensions = false;
   // Clear all mappings, setting them to MAP_DEFAULT.
   memset(DiagMappings, 0, sizeof(DiagMappings));
+  
+  ErrorOccurred = false;
 }
 
 /// isNoteWarningOrExtension - Return true if the unmapped diagnostic level of
@@ -126,6 +128,9 @@
   if (DiagLevel == Diagnostic::Ignored)
     return;
   
+  if (DiagLevel >= Diagnostic::Error)
+    ErrorOccurred = true;
+  
   // Finally, report it.
   Client.HandleDiagnostic(DiagLevel, Pos, (diag::kind)DiagID, Strs, NumStrs,
                           Ranges, NumRanges);

Modified: cfe/cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=39502&r1=39501&r2=39502&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/cfe/trunk/include/clang/Basic/Diagnostic.h Wed Jul 11 11:45:03 2007
@@ -55,6 +55,10 @@
   /// DiagMappings - Mapping information for diagnostics.  Mapping info is
   /// packed into two bits per diagnostic.
   unsigned char DiagMappings[(diag::NUM_DIAGNOSTICS+3)/4];
+  
+  /// ErrorOccurred - This is set to true when an error is emitted, and is
+  /// sticky.
+  bool ErrorOccurred;
 public:
   explicit Diagnostic(DiagnosticClient &client);
   
@@ -93,6 +97,7 @@
     return (diag::Mapping)((DiagMappings[Diag/4] >> (Diag & 3)*2) & 3);
   }
   
+  bool hasErrorOccurred() const { return ErrorOccurred; }
   
   //===--------------------------------------------------------------------===//
   // Diagnostic classification and reporting interfaces.





More information about the cfe-commits mailing list