Skip to content

Commit

Permalink
llvm-pdbdump: If we don't change the color, don't reset the color.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
amccarth-google committed Mar 29, 2017
1 parent d7f209a commit ebe3d55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/llvm-pdbdump/LinePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions tools/llvm-pdbdump/LinePrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class WithColor {
private:
void applyColor(PDB_ColorItem C);
raw_ostream &OS;
bool UseColor;
};
}
}
Expand Down

0 comments on commit ebe3d55

Please sign in to comment.