================
@@ -571,17 +560,30 @@ void
ClangTidyDiagnosticConsumer::checkFilters(SourceLocation Location,
}
StringRef FileName(File->getName());
- LastErrorRelatesToUserCode =
- LastErrorRelatesToUserCode || Sources.isInMainFile(Location) ||
- (HeaderFilter &&
- (HeaderFilter->match(FileName) &&
- !(ExcludeHeaderFilter && ExcludeHeaderFilter->match(FileName))));
+ LastErrorRelatesToUserCode = LastErrorRelatesToUserCode ||
+ Sources.isInMainFile(Location) ||
+ (getHeaderFilter()->match(FileName) &&
+ !getExcludeHeaderFilter()->match(FileName));
unsigned LineNumber = Sources.getExpansionLineNumber(Location);
LastErrorPassesLineFilter =
LastErrorPassesLineFilter || passesLineFilter(FileName, LineNumber);
}
+llvm::Regex *ClangTidyDiagnosticConsumer::getHeaderFilter() {
+ if (!HeaderFilter)
+ HeaderFilter =
+ std::make_unique<llvm::Regex>(*Context.getOptions().HeaderFilterRegex);
----------------
carlosgalvezp wrote:
Thanks, good point. That was also changed in the original PR so I will revert
that too. I wonder if it makes more sense to do a full revert and reland with
the right changes instead. But since the PR is 1 year old it might be tricky.
https://github.com/llvm/llvm-project/pull/133582
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits