[clang-tools-extra] clang tidy: add header ignore option to include duplicate files (PR #167046)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 10 06:25:35 PST 2025


================
@@ -109,9 +133,41 @@ void DuplicateIncludeCallbacks::MacroUndefined(const Token &MacroNameTok,
   Files.back().clear();
 }
 
+bool DuplicateIncludeCallbacks::IsAllowedDuplicateInclude(StringRef FileName) {
+  // try to match with each regex
+  for (const llvm::Regex &reg : AllowedDuplicateRegex) {
+    if (reg.match(FileName))
+      return true;
+  }
+  return false;
+}
----------------
zwuis wrote:

This function is used only once. Use `llvm::any_of` so that we don't need to introduce a new function.

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


More information about the cfe-commits mailing list