[clang] [Clang][Modules] Ensure global diagnostic overrides are respected in system modules (PR #180684)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 16 03:53:45 PST 2026
================
@@ -549,8 +549,14 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc,
// If we are in a system header, we ignore it. We look at the diagnostic class
// because we also want to ignore extensions and warnings in -Werror and
// -pedantic-errors modes, which *map* warnings/extensions to errors.
- if (State->SuppressSystemWarnings && Loc.isValid() &&
- SM.isInSystemHeader(SM.getExpansionLoc(Loc))) {
+ //
+ // We check both the location-specific state and the global engine state.
+ // In some cases (like template instantiations from system modules), the
+ // location-specific state might have suppression enabled, but the global
+ // engine state might have an override (e.g. AllowWarningInSystemHeaders)
+ // to show the warning.
----------------
zmodem wrote:
I think this comment should be updated to not talk about the global state, but the override specifically.
https://github.com/llvm/llvm-project/pull/180684
More information about the cfe-commits
mailing list