[PATCH] D77348: [clangd] Enable some nice clang-tidy checks by default.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 3 06:57:37 PDT 2020
sammccall marked 2 inline comments as done.
sammccall added inline comments.
================
Comment at: clang-tools-extra/clangd/tool/ClangdMain.cpp:695
+ auto EmptyDefaults = tidy::ClangTidyOptions::getDefaults();
+ EmptyDefaults.Checks.reset(); // So we can tell if checks were ever set.
+ tidy::ClangTidyOptions OverrideClangTidyOptions;
----------------
hokein wrote:
> `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`).
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...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77348/new/
https://reviews.llvm.org/D77348
More information about the cfe-commits
mailing list