aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/Diagnostic.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-19 18:55:06 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-19 18:55:06 +0000
commit525c4b0d1bd1a70bf269adecf91b192f3e6c1a89 (patch)
treeb822677ff43d423f8312459d5ffe6cd415bcab32 /lib/Basic/Diagnostic.cpp
parent76766017c1a490682460caa993b40197126b178a (diff)
Allow notes to be printed following a fatal error, then suppress any
diagnostics following those notes. Make exceeding the template instantiation depth a fatal error. Thanks to Daniel for pointing out the problem! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67320 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Diagnostic.cpp')
-rw-r--r--lib/Basic/Diagnostic.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 890b0c2ca5..378b8f514d 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -217,7 +217,7 @@ Diagnostic::Diagnostic(DiagnosticClient *client) : Client(client) {
NumErrors = 0;
CustomDiagInfo = 0;
CurDiagID = ~0U;
- LastDiagLevel = Fatal;
+ LastDiagLevel = Ignored;
ArgToStringFn = DummyArgToStringFn;
ArgToStringCookie = 0;
@@ -336,12 +336,7 @@ Diagnostic::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass) const {
/// finally fully formed.
void Diagnostic::ProcessDiag() {
DiagnosticInfo Info(this);
-
- // If a fatal error has already been emitted, silence all subsequent
- // diagnostics.
- if (FatalErrorOccurred)
- return;
-
+
// Figure out the diagnostic level of this message.
Diagnostic::Level DiagLevel;
unsigned DiagID = Info.getID();
@@ -375,9 +370,22 @@ void Diagnostic::ProcessDiag() {
}
}
- if (DiagLevel != Diagnostic::Note)
+ if (DiagLevel != Diagnostic::Note) {
+ // Record that a fatal error occurred only when we see a second
+ // non-note diagnostic. This allows notes to be attached to the
+ // fatal error, but suppresses any diagnostics that follow those
+ // notes.
+ if (LastDiagLevel == Diagnostic::Fatal)
+ FatalErrorOccurred = true;
+
LastDiagLevel = DiagLevel;
-
+ }
+
+ // If a fatal error has already been emitted, silence all subsequent
+ // diagnostics.
+ if (FatalErrorOccurred)
+ return;
+
// If the client doesn't care about this message, don't issue it. If this is
// a note and the last real diagnostic was ignored, ignore it too.
if (DiagLevel == Diagnostic::Ignored ||
@@ -397,9 +405,6 @@ void Diagnostic::ProcessDiag() {
if (DiagLevel >= Diagnostic::Error) {
ErrorOccurred = true;
++NumErrors;
-
- if (DiagLevel == Diagnostic::Fatal)
- FatalErrorOccurred = true;
}
// Finally, report it.