[clang-tools-extra] [clang-tidy] Add `IgnoredFilesList` option to `readability-duplicate-include` (PR #168196)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 15 04:08:47 PST 2025


================
@@ -62,10 +71,32 @@ class DuplicateIncludeCallbacks : public PPCallbacks {
   SmallVector<FileList> Files;
   DuplicateIncludeCheck &Check;
   const SourceManager &SM;
+  std::vector<llvm::Regex> AllowedRegexes;
+
+  bool isAllowedDuplicate(StringRef FileName, OptionalFileEntryRef File) const {
+    if (llvm::any_of(AllowedRegexes,
+                     [&](const llvm::Regex &R) { return R.match(FileName); }))
+      return true;
+
+    if (File) {
+      const StringRef Resolved = File->getName();
+      if (llvm::any_of(AllowedRegexes,
----------------
vbvictor wrote:

we can just `return any_of(..)` here

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


More information about the cfe-commits mailing list