This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Correct setting ignoreWarnings in CodeCompletion.
ClosedPublic

Authored by hokein on Feb 21 2018, 5:21 AM.

Details

Summary

We should set the flag before creating ComplierInstance -- when
CopmilerInstance gets initialized, it also initializes the DiagnosticsEngine
using the DiagnosticOptions.

This was hidden deeply -- as clang suppresses all diagnostics when we
hit the code-completion (but internally it does do unnecessary analysis stuff).

As a bonus point, this fix will optmize the completion speed -- clang won't do
any analysis (e.g. -Wunreachable-code, -Wthread-safety-analysisi) at all internally.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Feb 21 2018, 5:21 AM
ilya-biryukov accepted this revision.Feb 22 2018, 5:05 AM

LGTM with a minor nit.

clangd/CodeComplete.cpp
705 ↗(On Diff #135235)

Could we add a comment that this should be done before calling prepareCompilerInstance?
I'm afraid this can be accidentally reordered when changing the code.

This revision is now accepted and ready to land.Feb 22 2018, 5:05 AM
hokein updated this revision to Diff 135399.Feb 22 2018, 5:22 AM
  • add a comment
  • find one more incorrect usage, and fix it.
hokein marked an inline comment as done.Feb 22 2018, 5:22 AM
hokein added inline comments.
clangd/CodeComplete.cpp
705 ↗(On Diff #135235)

Yeah! Done.

This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.