[PATCH] D147876: [clang-tidy] Support introducing checks as a list in the config file

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 9 23:30:19 PDT 2023


carlosgalvezp marked an inline comment as done.
carlosgalvezp added a comment.

In D147876#4254451 <https://reviews.llvm.org/D147876#4254451>, @njames93 wrote:

> 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.

I believe that makes sense, just wanted to keep changes as minimal as possible! Our reliance on Checks being a string is spread into quite a few files, but I'm happy to change to a vector on a separate patch. I posted an RFC on discourse with a couple more follow-up questions, would be great if you could take a look:
https://discourse.llvm.org/t/rfc-support-specifying-checks-as-a-list-in-the-config-file/69856/1

Do note that the `index.rst` file is indeed updated with the new behavior.



================
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);
----------------
njames93 wrote:
> Any reason for this line changing, this formatting change looks unrelated.
clang-format applied the change. Can fix in a separate patch.


================
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();
----------------
njames93 wrote:
> 
Neat, thank you!


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