mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-31 18:00:26 +00:00
Don't emit more diagnostics after hitting -ferror-limit
This commit is contained in:
parent
c04c9fa750
commit
af5ae31c34
@ -335,13 +335,11 @@ void TryEnsureDocumentParsed(ClangCompleteManager* manager,
|
|||||||
for (unsigned i = 0; i < num_diagnostics; ++i) {
|
for (unsigned i = 0; i < num_diagnostics; ++i) {
|
||||||
optional<lsDiagnostic> diagnostic = BuildAndDisposeDiagnostic(
|
optional<lsDiagnostic> diagnostic = BuildAndDisposeDiagnostic(
|
||||||
clang_getDiagnostic((*tu)->cx_tu, i), session->file.filename);
|
clang_getDiagnostic((*tu)->cx_tu, i), session->file.filename);
|
||||||
if (diagnostic) {
|
// Filter messages like "too many errors emitted, stopping now
|
||||||
// "too many errors emitted, stopping now [-ferror-limit=]" has line = 0
|
// [-ferror-limit=]" which has line = 0 and got subtracted by 1 after
|
||||||
// and got subtracted by 1 after conversion to lsDiagnostic
|
// conversion to lsDiagnostic
|
||||||
if (diagnostic->range.start.line == -1)
|
if (diagnostic && diagnostic->range.start.line >= 0)
|
||||||
break;
|
|
||||||
ls_diagnostics.push_back(*diagnostic);
|
ls_diagnostics.push_back(*diagnostic);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
manager->on_diagnostic_(session->file.filename, ls_diagnostics);
|
manager->on_diagnostic_(session->file.filename, ls_diagnostics);
|
||||||
}
|
}
|
||||||
@ -509,13 +507,11 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
|
|||||||
CXDiagnostic cx_diag = clang_getDiagnostic(session->tu->cx_tu, i);
|
CXDiagnostic cx_diag = clang_getDiagnostic(session->tu->cx_tu, i);
|
||||||
optional<lsDiagnostic> diagnostic =
|
optional<lsDiagnostic> diagnostic =
|
||||||
BuildAndDisposeDiagnostic(cx_diag, path);
|
BuildAndDisposeDiagnostic(cx_diag, path);
|
||||||
if (diagnostic) {
|
// Filter messages like "too many errors emitted, stopping now
|
||||||
// "too many errors emitted, stopping now [-ferror-limit=]" has line = 0
|
// [-ferror-limit=]" which has line = 0 and got subtracted by 1 after
|
||||||
// and got subtracted by 1 after conversion to lsDiagnostic
|
// conversion to lsDiagnostic
|
||||||
if (diagnostic->range.start.line == -1)
|
if (diagnostic && diagnostic->range.start.line >= 0)
|
||||||
break;
|
|
||||||
ls_diagnostics.push_back(*diagnostic);
|
ls_diagnostics.push_back(*diagnostic);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
completion_manager->on_diagnostic_(session->file.filename,
|
completion_manager->on_diagnostic_(session->file.filename,
|
||||||
ls_diagnostics);
|
ls_diagnostics);
|
||||||
|
Loading…
Reference in New Issue
Block a user