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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299006 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian McCarthy 2017-03-29 17:11:27 +00:00
parent d7f209a331
commit ebe3d55fad
2 changed files with 8 additions and 3 deletions

View File

@ -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) {

View File

@ -89,6 +89,7 @@ public:
private:
void applyColor(PDB_ColorItem C);
raw_ostream &OS;
bool UseColor;
};
}
}