[cfe-commits] r67320 - in /cfe/trunk: Driver/Warnings.cpp lib/Basic/Diagnostic.cpp
Douglas Gregor
dgregor at apple.com
Thu Mar 19 11:55:06 PDT 2009
Author: dgregor
Date: Thu Mar 19 13:55:06 2009
New Revision: 67320
URL: http://llvm.org/viewvc/llvm-project?rev=67320&view=rev
Log:
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!
Modified:
cfe/trunk/Driver/Warnings.cpp
cfe/trunk/lib/Basic/Diagnostic.cpp
Modified: cfe/trunk/Driver/Warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/Warnings.cpp?rev=67320&r1=67319&r2=67320&view=diff
==============================================================================
--- cfe/trunk/Driver/Warnings.cpp (original)
+++ cfe/trunk/Driver/Warnings.cpp Thu Mar 19 13:55:06 2009
@@ -170,6 +170,8 @@
diag::MAP_IGNORE);
Diags.setDiagnosticMapping(diag::err_pp_file_not_found, diag::MAP_FATAL);
+ Diags.setDiagnosticMapping(diag::err_template_recursion_depth_exceeded,
+ diag::MAP_FATAL);
Diags.setSuppressSystemWarnings(!OptWarnInSystemHeaders);
for (OptionsList::iterator it = Options.begin(), e = Options.end();
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=67320&r1=67319&r2=67320&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Thu Mar 19 13:55:06 2009
@@ -217,7 +217,7 @@
NumErrors = 0;
CustomDiagInfo = 0;
CurDiagID = ~0U;
- LastDiagLevel = Fatal;
+ LastDiagLevel = Ignored;
ArgToStringFn = DummyArgToStringFn;
ArgToStringCookie = 0;
@@ -336,12 +336,7 @@
/// 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 @@
}
}
- 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 @@
if (DiagLevel >= Diagnostic::Error) {
ErrorOccurred = true;
++NumErrors;
-
- if (DiagLevel == Diagnostic::Fatal)
- FatalErrorOccurred = true;
}
// Finally, report it.
More information about the cfe-commits
mailing list