[clang-tools-extra] [clang-tidy] Add IgnoredRegex to 'bugprone-suspicious-include' (PR #160958)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 4 03:55:53 PDT 2025


=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>,
=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>,
=?utf-8?q?Björn_Schäpers?= <github at hazardy.de>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/160958 at github.com>


================
@@ -57,6 +62,10 @@ void SuspiciousIncludePPCallbacks::InclusionDirective(
   if (IncludeTok.getIdentifierInfo()->getPPKeywordID() == tok::pp_import)
     return;
 
+  if (Check.IgnoredRegex.has_value())
+    if (llvm::Regex Regex{Check.IgnoredRegex.value()}; Regex.match(FileName))
+      return;
----------------
vbvictor wrote:

So we would construct Regex for each `#include` in the file? Could we make it once in `storeOptions`?

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


More information about the cfe-commits mailing list