[clang-tools-extra] [clang-tidy] Add filtering of check options by enabled checks in '--dump-config' (PR #147142)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 13 00:27:39 PDT 2025


================
@@ -503,6 +503,21 @@ getCheckNames(const ClangTidyOptions &Options,
   return Factory.getCheckNames();
 }
 
+void filterCheckOptions(ClangTidyOptions &Options,
+                        const std::vector<std::string> &EnabledChecks) {
+  StringSet<> EnabledChecksSet(llvm::from_range, EnabledChecks);
----------------
vbvictor wrote:

We can not return `StringSet` from the start because it is a hashtable, and we need ordering for future use. The only option I see is to use `std::set` (which is not a good data structure IMO). [LLVM guide suggests](https://llvm.org/docs/ProgrammersManual.html#a-sorted-vector) sorted vector is a good thing, so I removed dependency on `StringSet` and used `llvm::binary_seach` instead.

https://github.com/llvm/llvm-project/pull/147142


More information about the cfe-commits mailing list