Fix PR1966 by ignoring non-error diagnostics from system headers even if they are
*mapped* onto errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46686 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/TextDiagnostics.cpp b/Driver/TextDiagnostics.cpp
index 01484e0..7a78e94 100644
--- a/Driver/TextDiagnostics.cpp
+++ b/Driver/TextDiagnostics.cpp
@@ -39,19 +39,14 @@
return Msg;
}
-bool TextDiagnostics::IgnoreDiagnostic(Diagnostic::Level Level,
- FullSourceLoc Pos) {
- if (Pos.isValid()) {
- // If this is a warning or note, and if it a system header, suppress the
- // diagnostic.
- if (Level == Diagnostic::Warning || Level == Diagnostic::Note) {
- if (const FileEntry *F = Pos.getFileEntryForLoc()) {
- DirectoryLookup::DirType DirInfo = TheHeaderSearch->getFileDirFlavor(F);
- if (DirInfo == DirectoryLookup::SystemHeaderDir ||
- DirInfo == DirectoryLookup::ExternCSystemHeaderDir)
- return true;
- }
- }
+bool TextDiagnostics::isInSystemHeader(FullSourceLoc Pos) const {
+ if (!Pos.isValid()) return false;
+
+ if (const FileEntry *F = Pos.getFileEntryForLoc()) {
+ DirectoryLookup::DirType DirInfo = TheHeaderSearch->getFileDirFlavor(F);
+ if (DirInfo == DirectoryLookup::SystemHeaderDir ||
+ DirInfo == DirectoryLookup::ExternCSystemHeaderDir)
+ return true;
}
return false;