summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-12-05 21:52:58 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-12-05 21:52:58 +0000
commita2686713ef3a783b0735e93342ce3d7714f8816e (patch)
tree2592b322cd81466b678d8b50ffab68d4738edbf8 /clang/lib
parentbe68a99f20ea2e6fb38e46b3675d3615a789bdfd (diff)
downloadbcm5719-llvm-a2686713ef3a783b0735e93342ce3d7714f8816e.tar.gz
bcm5719-llvm-a2686713ef3a783b0735e93342ce3d7714f8816e.zip
Make DiagnosticErrorTrap work even if SuppressAllDiagnostics is enabled.
Patch by Brad King! llvm-svn: 223525
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Basic/DiagnosticIDs.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp
index 282e75e4ca3..1c68375f3cd 100644
--- a/clang/lib/Basic/DiagnosticIDs.cpp
+++ b/clang/lib/Basic/DiagnosticIDs.cpp
@@ -606,9 +606,6 @@ StringRef DiagnosticIDs::getNearestOption(diag::Flavor Flavor,
bool DiagnosticIDs::ProcessDiag(DiagnosticsEngine &Diag) const {
Diagnostic Info(&Diag);
- if (Diag.SuppressAllDiagnostics)
- return false;
-
assert(Diag.getClient() && "DiagnosticClient not set!");
// Figure out the diagnostic level of this message.
@@ -616,6 +613,17 @@ bool DiagnosticIDs::ProcessDiag(DiagnosticsEngine &Diag) const {
DiagnosticIDs::Level DiagLevel
= getDiagnosticLevel(DiagID, Info.getLocation(), Diag);
+ // Update counts for DiagnosticErrorTrap even if a fatal error occurred
+ // or diagnostics are suppressed.
+ if (DiagLevel >= DiagnosticIDs::Error) {
+ ++Diag.TrapNumErrorsOccurred;
+ if (isUnrecoverable(DiagID))
+ ++Diag.TrapNumUnrecoverableErrorsOccurred;
+ }
+
+ if (Diag.SuppressAllDiagnostics)
+ return false;
+
if (DiagLevel != DiagnosticIDs::Note) {
// Record that a fatal error occurred only when we see a second
// non-note diagnostic. This allows notes to be attached to the
@@ -627,13 +635,6 @@ bool DiagnosticIDs::ProcessDiag(DiagnosticsEngine &Diag) const {
Diag.LastDiagLevel = DiagLevel;
}
- // Update counts for DiagnosticErrorTrap even if a fatal error occurred.
- if (DiagLevel >= DiagnosticIDs::Error) {
- ++Diag.TrapNumErrorsOccurred;
- if (isUnrecoverable(DiagID))
- ++Diag.TrapNumUnrecoverableErrorsOccurred;
- }
-
// If a fatal error has already been emitted, silence all subsequent
// diagnostics.
if (Diag.FatalErrorOccurred) {
OpenPOWER on IntegriCloud