Skip to content

Commit

Permalink
Don't emit more diagnostics after hitting -ferror-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Dec 23, 2017
1 parent ea95d10 commit 8f57411
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/clang_complete.cc
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,13 @@ void TryEnsureDocumentParsed(ClangCompleteManager* manager,
for (unsigned i = 0; i < num_diagnostics; ++i) {
optional<lsDiagnostic> diagnostic = BuildAndDisposeDiagnostic(
clang_getDiagnostic((*tu)->cx_tu, i), session->file.filename);
if (diagnostic)
if (diagnostic) {
// "too many errors emitted, stopping now [-ferror-limit=]" has line = 0
// and got subtracted by 1 after conversion to lsDiagnostic
if (diagnostic->range.start.line == -1)
break;
ls_diagnostics.push_back(*diagnostic);
}
}
manager->on_diagnostic_(session->file.filename, ls_diagnostics);
}
Expand Down Expand Up @@ -504,8 +509,13 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
CXDiagnostic cx_diag = clang_getDiagnostic(session->tu->cx_tu, i);
optional<lsDiagnostic> diagnostic =
BuildAndDisposeDiagnostic(cx_diag, path);
if (diagnostic)
if (diagnostic) {
// "too many errors emitted, stopping now [-ferror-limit=]" has line = 0
// and got subtracted by 1 after conversion to lsDiagnostic
if (diagnostic->range.start.line == -1)
break;
ls_diagnostics.push_back(*diagnostic);
}
}
completion_manager->on_diagnostic_(session->file.filename,
ls_diagnostics);
Expand Down

0 comments on commit 8f57411

Please sign in to comment.