[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 15:23:44 PDT 2024


================
@@ -311,7 +311,12 @@ ClangTidyDiagnosticConsumer::ClangTidyDiagnosticConsumer(
     : Context(Ctx), ExternalDiagEngine(ExternalDiagEngine),
       RemoveIncompatibleErrors(RemoveIncompatibleErrors),
       GetFixesFromNotes(GetFixesFromNotes),
-      EnableNolintBlocks(EnableNolintBlocks) {}
+      EnableNolintBlocks(EnableNolintBlocks) {
+
+  if (Context.getOptions().ExcludeHeaderFilterRegex)
+    ExcludeHeaderFilter = std::make_unique<llvm::Regex>(
+        *Context.getOptions().ExcludeHeaderFilterRegex);
+}
----------------
5chmidti wrote:

> which I think is handled in the latest revision

I agree

> I could migrate HeaderFilter to mirror the new and improved ExcludeHeaderFilter...though I worry a bit about this change growing larger and larger

Sure, a small follow-up pr would probably be better.

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


More information about the cfe-commits mailing list