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

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Wed May 8 10:27:42 PDT 2024


================
@@ -578,6 +579,13 @@ llvm::Regex *ClangTidyDiagnosticConsumer::getHeaderFilter() {
   return HeaderFilter.get();
 }
 
+llvm::Regex *ClangTidyDiagnosticConsumer::getExcludeHeaderFilter() {
+  if (!ExcludeHeaderFilter)
+    ExcludeHeaderFilter = std::make_unique<llvm::Regex>(
+        *Context.getOptions().ExcludeHeaderFilterRegex);
----------------
PiotrZSL wrote:

My idea were simply to keep this optional uninitialized in such case, instead of initializing it with empty string, and then simply do not call match for such regexp

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


More information about the cfe-commits mailing list