[PATCH] D120187: [clang-tidy] Allow newline characters as separators for checks in Clang-Tidy configurations

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 19 08:59:29 PST 2022


njames93 added inline comments.


================
Comment at: .clang-tidy:1-10
+Checks: |
+  -*
+  clang-diagnostic-*
+  llvm-*
+  misc-*
+  -misc-unused-parameters
+  -misc-non-private-member-variables-in-classes
----------------
This change doesn't belong in this patch.


================
Comment at: clang-tools-extra/clang-tidy/GlobList.cpp:30-31
 static llvm::Regex consumeGlob(StringRef &GlobList) {
-  StringRef UntrimmedGlob = GlobList.substr(0, GlobList.find(','));
+  auto NextSplitIndex = std::min(GlobList.find(','), GlobList.find('\n'));
+  StringRef UntrimmedGlob = GlobList.substr(0, NextSplitIndex);
   StringRef Glob = UntrimmedGlob.trim();
----------------



================
Comment at: clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp:100
+  EXPECT_TRUE(!!Options);
+  EXPECT_EQ("-*,misc-*\nllvm-*\n-clang-*,\ngoogle-*\n", *Options->Checks);
+}
----------------
This seems like a shortcoming in llvms YAML parser. Isn't the fold character `>` supposed to replace newlines with spaces and strip trailing ws
```lang=c++
"-*,misc-* llvm-* -clang-* google-*"
```
Using the pipe `|` instead should yield the output you are currently expecting,


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120187/new/

https://reviews.llvm.org/D120187



More information about the cfe-commits mailing list