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

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 05:02:21 PDT 2023


njames93 accepted this revision.
njames93 added inline comments.
This revision is now accepted and ready to land.


================
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);
----------------
carlosgalvezp wrote:
> carlosgalvezp wrote:
> > njames93 wrote:
> > > All this code can just be inlined into the function below and this function can just be removed
> > Can you elaborate on how to do it? I cannot call `mapOptional("Checks"` twice, one for string and one for vector, since it will print an error message on either case.
> > 
> > The function `yamlize` does not exp
> ... The function `yamlize` does not allow one to specify the `Checks` key as far as I can tell either.
I think you're right, I was getting confused with a different serialisation library that does support that kind of logic


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