[PATCH] D59135: Add check for matching HeaderFilter before emitting Diagnostic
Thorsten via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 8 07:13:24 PST 2019
thorsten-klein created this revision.
thorsten-klein added reviewers: aaron.ballman, klimek, alexfh.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Fixed issue of not considering HeaderFilter which resulted in findings although they should be filtered out.
Patch by Thorsten Klein.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D59135
Files:
clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
Index: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
===================================================================
--- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -449,8 +449,13 @@
FullSourceLoc Loc;
if (Info.getLocation().isValid() && Info.hasSourceManager())
Loc = FullSourceLoc(Info.getLocation(), Info.getSourceManager());
- Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
+
+ StringRef FileName(Loc.printToString(Loc.getManager()));
+ if(getHeaderFilter()->match(FileName)) // only emit if FileName is matching
+ {
+ Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
Info.getFixItHints());
+ }
if (Info.hasSourceManager())
checkFilters(Info.getLocation(), Info.getSourceManager());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59135.189857.patch
Type: text/x-patch
Size: 888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190308/44e63844/attachment-0001.bin>
More information about the cfe-commits
mailing list