[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
Thu May 9 11:29:23 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);
----------------
PiotrZSL wrote:
i thing this doesn't work, i mean that ExcludeHeaderFilterRegex is always set because init value is set to '' and is used as default value for option, therfor ExcludeHeaderFilterRegex will never be nullptr. try adding check here to verify also that string is not empty.
https://github.com/llvm/llvm-project/pull/91400
More information about the cfe-commits
mailing list