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

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 02:32:36 PST 2024


================
@@ -656,15 +656,19 @@ static bool printWordWrapped(raw_ostream &OS, StringRef Str, unsigned Columns,
 TextDiagnostic::TextDiagnostic(raw_ostream &OS, const LangOptions &LangOpts,
                                DiagnosticOptions *DiagOpts,
                                const Preprocessor *PP)
-    : DiagnosticRenderer(LangOpts, DiagOpts), OS(OS), PP(PP) {}
+    : DiagnosticRenderer(LangOpts, DiagOpts), Out(OS), PP(PP),
+      OS(InternalBuffer) {
+  this->OS.buffer().clear();
+  this->OS.enable_colors(true);
----------------
Fznamznon wrote:

Good point. I think we do have tests checking colors. We probably don't have the tests that check there is no colors.

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


More information about the cfe-commits mailing list