[clang] [clang] Apply internal buffering to clang diagnostics printing (PR #113440)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 3 09:37:29 PST 2024


================
@@ -133,12 +133,16 @@ void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
   // diagnostics in a context that lacks language options, a source manager, or
   // other infrastructure necessary when emitting more rich diagnostics.
   if (!Info.getLocation().isValid()) {
-    TextDiagnostic::printDiagnosticLevel(OS, Level, DiagOpts->ShowColors);
+    SmallString<1000> OutText;
+    llvm::raw_svector_ostream OutputBuffer(OutText);
+    OutputBuffer.enable_colors(true);
----------------
AaronBallman wrote:

Same here as above; shouldn't this be looking at `ShowColors` first?

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


More information about the cfe-commits mailing list