[cfe-commits] r133096 - in /cfe/trunk/include/clang/Basic: Diagnostic.h DiagnosticIDs.h

John McCall rjmccall at apple.com
Wed Jun 15 15:11:51 PDT 2011


Author: rjmccall
Date: Wed Jun 15 17:11:51 2011
New Revision: 133096

URL: http://llvm.org/viewvc/llvm-project?rev=133096&view=rev
Log:
Missing files.


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

Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=133096&r1=133095&r2=133096&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Wed Jun 15 17:11:51 2011
@@ -251,6 +251,11 @@
   bool ErrorOccurred;
   bool FatalErrorOccurred;
 
+  /// \brief Toggles for DiagnosticErrorTrap to check whether an error occurred
+  /// during a parsing section, e.g. during parsing a function.
+  bool TrapErrorOccurred;
+  bool TrapUnrecoverableErrorOccurred;
+
   /// LastDiagLevel - This is the level of the last diagnostic emitted.  This is
   /// used to emit continuation diagnostics with the same level as the
   /// diagnostic that they follow.
@@ -621,20 +626,28 @@
 /// queried.
 class DiagnosticErrorTrap {
   Diagnostic &Diag;
-  unsigned PrevErrors;
 
 public:
   explicit DiagnosticErrorTrap(Diagnostic &Diag)
-    : Diag(Diag), PrevErrors(Diag.NumErrors) {}
+    : Diag(Diag) { reset(); }
 
   /// \brief Determine whether any errors have occurred since this
   /// object instance was created.
   bool hasErrorOccurred() const {
-    return Diag.NumErrors > PrevErrors;
+    return Diag.TrapErrorOccurred;
+  }
+
+  /// \brief Determine whether any unrecoverable errors have occurred since this
+  /// object instance was created.
+  bool hasUnrecoverableErrorOccurred() const {
+    return Diag.TrapUnrecoverableErrorOccurred;
   }
 
   // Set to initial state of "no errors occurred".
-  void reset() { PrevErrors = Diag.NumErrors; }
+  void reset() {
+    Diag.TrapErrorOccurred = false;
+    Diag.TrapUnrecoverableErrorOccurred = false;
+  }
 };
 
 //===----------------------------------------------------------------------===//

Modified: cfe/trunk/include/clang/Basic/DiagnosticIDs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticIDs.h?rev=133096&r1=133095&r2=133096&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticIDs.h (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticIDs.h Wed Jun 15 17:11:51 2011
@@ -227,6 +227,10 @@
   /// suppressed.
   bool ProcessDiag(Diagnostic &Diag) const;
 
+  /// \brief Whether the diagnostic may leave the AST in a state where some
+  /// invariants can break.
+  bool isUnrecoverable(unsigned DiagID) const;
+
   friend class Diagnostic;
 };
 





More information about the cfe-commits mailing list