Reset error count when hitting ext_return_has_expr.

This commit is contained in:
Axel Naumann 2017-01-10 13:58:24 +01:00 committed by sftnight
parent 4b78d08dfa
commit 8c3e5b2e2b

View File

@ -137,17 +137,19 @@ namespace {
if (Ignoring()) {
if (Info.getID() == diag::warn_unused_expr
|| Info.getID() == diag::warn_unused_call
|| Info.getID() == diag::warn_unused_comparison
|| Info.getID() == diag::ext_return_has_expr)
|| Info.getID() == diag::warn_unused_comparison)
return; // ignore!
if (Info.getID() == diag::warn_falloff_nonvoid_function) {
DiagLevel = DiagnosticsEngine::Error;
}
if (Info.getID() == diag::ext_return_has_expr) {
// An error that we need to suppress.
auto Diags = const_cast<DiagnosticsEngine*>(Info.getDiags());
assert(Diags->NumErrors && "Expected NumErrors");
if (!--Diags->NumErrors) {
assert(Diags->ErrorOccurred && "Expected ErrorOccurred");
Diags->ErrorOccurred = false;
}
assert(Diags->hasErrorOccurred() && "Expected ErrorOccurred");
if (fOwnedTarget->getNumErrors() == 0) { // first error
Diags->Reset(true /*soft - only counts, not mappings*/);
} // else we had other errors, too.
return; // ignore!
}
}
ForwardingDiagnosticConsumer::HandleDiagnostic(DiagLevel, Info);