[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 09:20:21 PDT 2017
amccarth created this revision.
The -output-color option was successful at suppressing color changes, but was still allowing color resets.
https://reviews.llvm.org/D31468
Files:
llvm/tools/llvm-pdbdump/LinePrinter.cpp
llvm/tools/llvm-pdbdump/LinePrinter.h
Index: llvm/tools/llvm-pdbdump/LinePrinter.h
===================================================================
--- llvm/tools/llvm-pdbdump/LinePrinter.h
+++ llvm/tools/llvm-pdbdump/LinePrinter.h
@@ -89,6 +89,7 @@
private:
void applyColor(PDB_ColorItem C);
raw_ostream &OS;
+ bool UseColor;
};
}
}
Index: llvm/tools/llvm-pdbdump/LinePrinter.cpp
===================================================================
--- llvm/tools/llvm-pdbdump/LinePrinter.cpp
+++ llvm/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.93381.patch
Type: text/x-patch
Size: 997 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170329/ffe1fe3f/attachment.bin>
More information about the llvm-commits
mailing list