[PATCH] D65564: Improve raw_ostream so that you can "write" colors using operator<<

George Rimar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 1 04:00:00 PDT 2019


grimar added a comment.

It looks good to me. A minor nit is inlined.



================
Comment at: clang/tools/diagtool/TreeView.cpp:30
 
-  TreePrinter(llvm::raw_ostream &out)
-      : out(out), ShowColors(hasColors(out)), Internal(false) {}
-
-  void setColor(llvm::raw_ostream::Colors Color) {
-    if (ShowColors)
-      out << llvm::sys::Process::OutputColor(Color, false, false);
-  }
-
-  void resetColor() {
-    if (ShowColors)
-      out << llvm::sys::Process::ResetColor();
+  TreePrinter(llvm::raw_ostream &out) : out(out), Internal(false) {
+    if (&out != &llvm::errs() && &out != &llvm::outs())
----------------
nit: Seems `out` should be uppercase here.
(I see it was like that before your changes, but seems you touching all the places where it was used, so seems you can fix it).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65564/new/

https://reviews.llvm.org/D65564





More information about the cfe-commits mailing list