Add --suppress-system-warnings (on by default, use =0 to disable)
- For investigating warnings in system headers / builtins.
- Currently also enables the behavior that allows silent redefinition
of types in system headers. Conceptually these are separate but I
didn't feel it was worth two options (or changing LangOptions).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56163 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index f9e1d2b..0f8f314 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -113,6 +113,7 @@
WarningsAsErrors = false;
WarnOnExtensions = false;
ErrorOnExtensions = false;
+ SuppressSystemWarnings = false;
// Clear all mappings, setting them to MAP_DEFAULT.
memset(DiagMappings, 0, sizeof(DiagMappings));
@@ -224,7 +225,8 @@
// have to check on the original DiagID here, because we also want to
// ignore extensions and warnings in -Werror and -pedantic-errors modes,
// which *map* warnings/extensions to errors.
- if (DiagID < diag::NUM_BUILTIN_DIAGNOSTICS &&
+ if (SuppressSystemWarnings &&
+ DiagID < diag::NUM_BUILTIN_DIAGNOSTICS &&
getBuiltinDiagClass(DiagID) != ERROR &&
Loc.isValid() && Loc.isFileID() && Loc.isInSystemHeader())
return;