[PATCH] D147876: [clang-tidy] Support introducing checks as a list in the config file
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 9 16:54:11 PDT 2023
njames93 requested changes to this revision.
njames93 added a comment.
This revision now requires changes to proceed.
>From an architectural point of view, is there any reason we don't change the backend to treat checks internally as a vector?
`clang-tools-extra/docs/clang-tidy/index.rst` also needs updating to specify this new behaviour.
================
Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:73
for (const auto &KeyValue : OptionMap)
- Options.emplace_back(std::string(KeyValue.getKey()), KeyValue.getValue().Value);
+ Options.emplace_back(std::string(KeyValue.getKey()),
+ KeyValue.getValue().Value);
----------------
Any reason for this line changing, this formatting change looks unrelated.
================
Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:129-141
+ // Special case for reading from YAML
+ // Must support reading from both a string or a list
+ Input &I = reinterpret_cast<Input &>(IO);
+ if (isa<ScalarNode>(I.getCurrentNode()) ||
+ isa<BlockScalarNode>(I.getCurrentNode())) {
+ Checks.AsString = std::string();
+ yamlize(IO, *Checks.AsString, true, Ctx);
----------------
All this code can just be inlined into the function below and this function can just be removed
================
Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:132-133
+ Input &I = reinterpret_cast<Input &>(IO);
+ if (isa<ScalarNode>(I.getCurrentNode()) ||
+ isa<BlockScalarNode>(I.getCurrentNode())) {
+ Checks.AsString = std::string();
----------------
================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:304
- Fixed an issue in :doc:`modernize-concat-nested-namespaces
- <clang-tidy/checks/modernize/concat-nested-namespaces>` when using macro between
+ <clang-tidy/checks/modernize/concat-nested-namespaces>` when using macro between
namespace declarations could result incorrect fix.
----------------
This change is unrelated and should be pushed as an NFC commit
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147876/new/
https://reviews.llvm.org/D147876
More information about the cfe-commits
mailing list