From: Adrian McCarthy Date: Wed, 29 Mar 2017 17:11:27 +0000 (+0000) Subject: llvm-pdbdump: If we don't change the color, don't reset the color. X-Git-Tag: llvmorg-5.0.0-rc1~8953 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fcfc2c0257d442d6cf8610afa71f20c7067fc8d;p=platform%2Fupstream%2Fllvm.git llvm-pdbdump: If we don't change the color, don't reset the color. The -output-color option was successful at suppressing color changes, but was still allowing color resets. Differential Revision: https://reviews.llvm.org/D31468 llvm-svn: 299006 --- diff --git a/llvm/tools/llvm-pdbdump/LinePrinter.cpp b/llvm/tools/llvm-pdbdump/LinePrinter.cpp index 14f8c78..d376810 100644 --- a/llvm/tools/llvm-pdbdump/LinePrinter.cpp +++ b/llvm/tools/llvm-pdbdump/LinePrinter.cpp @@ -83,12 +83,16 @@ bool LinePrinter::IsCompilandExcluded(llvm::StringRef CompilandName) { 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) { diff --git a/llvm/tools/llvm-pdbdump/LinePrinter.h b/llvm/tools/llvm-pdbdump/LinePrinter.h index 29933e4..87c51e3 100644 --- a/llvm/tools/llvm-pdbdump/LinePrinter.h +++ b/llvm/tools/llvm-pdbdump/LinePrinter.h @@ -89,6 +89,7 @@ public: private: void applyColor(PDB_ColorItem C); raw_ostream &OS; + bool UseColor; }; } }