[PATCH] D64565: [clangd] Don't run the prepare for tweaks that are disabled.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 11 09:04:00 PDT 2019
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/clangd/ClangdServer.h:138
+ std::function<bool(const Tweak &)> TweakFilter = [](const Tweak &T) {
+ return true; // always enabled all tweaks.
+ };
----------------
the default value should reject hidden checks, for API users. The duplication is a bit sad
================
Comment at: clang-tools-extra/clangd/tool/ClangdMain.cpp:535
+ Opts.TweakFilter = [&](const Tweak &T) {
+ // Enable non-hidden tweaks and hidden tweaks if -hiden-features flag is on.
+ bool DefaultEnable = !T.hidden() || HiddenFeatures;
----------------
nit: -hidden-features
================
Comment at: clang-tools-extra/clangd/tool/ClangdMain.cpp:536
+ // Enable non-hidden tweaks and hidden tweaks if -hiden-features flag is on.
+ bool DefaultEnable = !T.hidden() || HiddenFeatures;
+ if (TweakList.getNumOccurrences())
----------------
nit: seems clearer to write:
```
if (hidden && !HiddenFeatures)
return false;
if (flag passed && !name matches flag)
return false;
return true
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64565/new/
https://reviews.llvm.org/D64565
More information about the cfe-commits
mailing list