This is an archive of the discontinued LLVM Phabricator instance.

Disable warnings when indexing as a standalone action.
ClosedPublic

Authored by sammccall on Mar 28 2019, 7:52 AM.

Details

Summary
  • we don't record the warnings at all
  • even when -Werror is set, we don't want to stop indexing for a warning
  • this allows some analyses to be skipped which can save some CPU

https://github.com/clangd/clangd/issues/24

Event Timeline

sammccall created this revision.Mar 28 2019, 7:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2019, 7:52 AM
hokein added inline comments.Mar 28 2019, 8:04 AM
clangd/index/IndexAction.cpp
140

Can we add a unittest for this?

IIRC, IgnoreWarnings option must be set before CompilerInstance is created, otherwise it doesn't take affect, see https://github.com/llvm-mirror/clang-tools-extra/blob/master/clangd/CodeComplete.cpp#L1029

sammccall updated this revision to Diff 192650.Mar 28 2019, 9:00 AM

Add tests, fix setting the flag too late.

sammccall updated this revision to Diff 192651.Mar 28 2019, 9:01 AM

fix baseline

sammccall marked an inline comment as done.Mar 28 2019, 9:02 AM
sammccall added inline comments.
clangd/index/IndexAction.cpp
140

Added test, thanks.

You're right, the flag has already been copied to the diagnostics client. It's too late to set it here.

Unfortunately we don't control where the CompilerInstance is created, but this is semantically the right layer to make the decision to suppress warnings. So I've just set it on the diagnostics client too :-/

hokein accepted this revision.Mar 28 2019, 9:21 AM
hokein added inline comments.
clangd/index/IndexAction.cpp
138

I think -Werror is't set should be -Werror is set?

This revision is now accepted and ready to land.Mar 28 2019, 9:21 AM
This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2019, 10:07 AM