[llvm] r299006 - llvm-pdbdump: If we don't change the color, don't reset the color.
Adrian McCarthy via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 10:11:27 PDT 2017
Author: amccarth
Date: Wed Mar 29 12:11:27 2017
New Revision: 299006
URL: http://llvm.org/viewvc/llvm-project?rev=299006&view=rev
Log:
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
Modified:
llvm/trunk/tools/llvm-pdbdump/LinePrinter.cpp
llvm/trunk/tools/llvm-pdbdump/LinePrinter.h
Modified: llvm/trunk/tools/llvm-pdbdump/LinePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/LinePrinter.cpp?rev=299006&r1=299005&r2=299006&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/LinePrinter.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/LinePrinter.cpp Wed Mar 29 12:11:27 2017
@@ -83,12 +83,16 @@ bool LinePrinter::IsCompilandExcluded(ll
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) {
Modified: llvm/trunk/tools/llvm-pdbdump/LinePrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/LinePrinter.h?rev=299006&r1=299005&r2=299006&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/LinePrinter.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/LinePrinter.h Wed Mar 29 12:11:27 2017
@@ -89,6 +89,7 @@ public:
private:
void applyColor(PDB_ColorItem C);
raw_ostream &OS;
+ bool UseColor;
};
}
}
More information about the llvm-commits
mailing list