[PATCH] D31468: llvm-pdbdump: If we don't change the color, don't reset the color.

Adrian McCarthy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 10:23:57 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL299006: llvm-pdbdump: If we don't change the color, don't reset the color. (authored by amccarth).

Changed prior to commit:
  https://reviews.llvm.org/D31468?vs=93381&id=93386#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31468

Files:
  llvm/trunk/tools/llvm-pdbdump/LinePrinter.cpp
  llvm/trunk/tools/llvm-pdbdump/LinePrinter.h


Index: llvm/trunk/tools/llvm-pdbdump/LinePrinter.h
===================================================================
--- llvm/trunk/tools/llvm-pdbdump/LinePrinter.h
+++ llvm/trunk/tools/llvm-pdbdump/LinePrinter.h
@@ -89,6 +89,7 @@
 private:
   void applyColor(PDB_ColorItem C);
   raw_ostream &OS;
+  bool UseColor;
 };
 }
 }
Index: llvm/trunk/tools/llvm-pdbdump/LinePrinter.cpp
===================================================================
--- llvm/trunk/tools/llvm-pdbdump/LinePrinter.cpp
+++ llvm/trunk/tools/llvm-pdbdump/LinePrinter.cpp
@@ -83,12 +83,16 @@
                         ExcludeCompilandFilters);
 }
 
-WithColor::WithColor(LinePrinter &P, PDB_ColorItem C) : OS(P.OS) {
-  if (P.hasColor())
+WithColor::WithColor(LinePrinter &P, PDB_ColorItem C)
+    : OS(P.OS), UseColor(P.hasColor()) {
+  if (UseColor)
     applyColor(C);
 }
 
-WithColor::~WithColor() { OS.resetColor(); }
+WithColor::~WithColor() {
+  if (UseColor)
+    OS.resetColor();
+}
 
 void WithColor::applyColor(PDB_ColorItem C) {
   switch (C) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31468.93386.patch
Type: text/x-patch
Size: 1033 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170329/a7b39247/attachment.bin>


More information about the llvm-commits mailing list