[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 06:14:24 PDT 2024


================
@@ -571,8 +571,7 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc,
   }
 
   // If explicitly requested, map fatal errors to errors.
-  if (Result == diag::Severity::Fatal &&
-      Diag.CurDiagID != diag::fatal_too_many_errors && Diag.FatalsAsError)
----------------
AaronBallman wrote:

That came from 878271b2945e89b868fb8daefea3dfaffce32710 and doesn't appear to have been tested. I think the logic is: if the severity is fatal, we would downgrade to error, but we do not want to downgrade the "too many fatal errors" diagnostic because that *has* to be fatal.

We could probably use better test coverage in this area; I suspect that code is still needed.

https://github.com/llvm/llvm-project/pull/108187


More information about the cfe-commits mailing list