[PATCH] D67060: [Support] Support restoring colors in WithColor

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 20:29:04 PDT 2019


ruiu added inline comments.


================
Comment at: llvm/include/llvm/Support/WithColor.h:40-41
   bool DisableColors;
+  raw_ostream::ColorState PrevColor = {raw_ostream::Colors::RESET, false,
+                                       false};
 
----------------
... then you can remove {}


================
Comment at: llvm/include/llvm/Support/raw_ostream.h:90-93
+    Colors Color;
+    bool Bold;
+    /// If true, the background color is changed instead of the foreground.
+    bool Background;
----------------
C++11 allows to write default values for member variables, i.e.

  Colors Color = Colors::RESET;
  bool Bold = false;
  bool Background = false;


================
Comment at: llvm/include/llvm/Support/raw_ostream.h:309
+  /// (changeColor, etc).
+  virtual ColorState getColor() { return {Colors::RESET, false, false}; }
+
----------------
and this {}


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

https://reviews.llvm.org/D67060





More information about the llvm-commits mailing list