]> granicus.if.org Git - clang/commitdiff
Missing files.
authorJohn McCall <rjmccall@apple.com>
Wed, 15 Jun 2011 22:11:51 +0000 (22:11 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 15 Jun 2011 22:11:51 +0000 (22:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133096 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Diagnostic.h
include/clang/Basic/DiagnosticIDs.h

index fa763246d1b863304c46f4f4c39293dd599f6080..9f12c548f51f2ca4b90a1b9123d783c2365ef23d 100644 (file)
@@ -251,6 +251,11 @@ private:
   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 @@ private:
 /// 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;
+  }
 };
 
 //===----------------------------------------------------------------------===//
index fa816de4fddb8688f53e10585e7e5a41e4125bb6..ae4ed5bbb13c33bbc39f160ff0bc5f2605988743 100644 (file)
@@ -227,6 +227,10 @@ private:
   /// 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;
 };