This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Enable some nice clang-tidy checks by default.
ClosedPublic

Authored by sammccall on Apr 2 2020, 4:41 PM.

Diff Detail

Event Timeline

sammccall created this revision.Apr 2 2020, 4:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2020, 4:41 PM
sammccall updated this revision to Diff 254650.Apr 2 2020, 5:11 PM

revert debugging noise

hokein accepted this revision.Apr 3 2020, 12:43 AM
hokein added inline comments.
clang-tools-extra/clangd/tool/ClangdMain.cpp
695

EmptyDefaults.Checks is not none, but it is an empty string I think , we could even assign our default checks to EmptyDefaults.Checks (instead of setting it in GetCalngTidyOptions).

724

bugprone-suspicious-include is a fairly new check, and hasn't been run internally, so I'd be conservative, not enable it.

This revision is now accepted and ready to land.Apr 3 2020, 12:43 AM
sammccall marked 2 inline comments as done.Apr 3 2020, 6:37 AM
sammccall added inline comments.
clang-tools-extra/clangd/tool/ClangdMain.cpp
695

That doesn't work :-(
The clang tidy options config is a tangled mess.
Ultimately it produces a vector of optionses that are merged in order to produce the final options.
In our case this vector is [EmptyDefaults, options from .clang-tidy, OverrideClangTidyOptions].

For the "Checks" field, the merge just joins the comma-separated lists together.
So the checks from EmptyDefaults would be enabled unless .clang-tidy *specifically* disables them, which is not the behavior I want - the existence of .clang-tidy should override the defaults.

This is what the complainy comment below is supposed to indicate...

This revision was automatically updated to reflect the committed changes.