Missing files.

llvm-svn: 133096
This commit is contained in:
John McCall 2011-06-15 22:11:51 +00:00
parent f7456194a3
commit c20b1393e1
2 changed files with 21 additions and 4 deletions

View File

@ -251,6 +251,11 @@ private:
bool ErrorOccurred; bool ErrorOccurred;
bool FatalErrorOccurred; 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 /// LastDiagLevel - This is the level of the last diagnostic emitted. This is
/// used to emit continuation diagnostics with the same level as the /// used to emit continuation diagnostics with the same level as the
/// diagnostic that they follow. /// diagnostic that they follow.
@ -621,20 +626,28 @@ private:
/// queried. /// queried.
class DiagnosticErrorTrap { class DiagnosticErrorTrap {
Diagnostic &Diag; Diagnostic &Diag;
unsigned PrevErrors;
public: public:
explicit DiagnosticErrorTrap(Diagnostic &Diag) explicit DiagnosticErrorTrap(Diagnostic &Diag)
: Diag(Diag), PrevErrors(Diag.NumErrors) {} : Diag(Diag) { reset(); }
/// \brief Determine whether any errors have occurred since this /// \brief Determine whether any errors have occurred since this
/// object instance was created. /// object instance was created.
bool hasErrorOccurred() const { 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". // Set to initial state of "no errors occurred".
void reset() { PrevErrors = Diag.NumErrors; } void reset() {
Diag.TrapErrorOccurred = false;
Diag.TrapUnrecoverableErrorOccurred = false;
}
}; };
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@ -227,6 +227,10 @@ private:
/// suppressed. /// suppressed.
bool ProcessDiag(Diagnostic &Diag) const; 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; friend class Diagnostic;
}; };