summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/tools/llvm-pdbdump/LinePrinter.cpp10
-rw-r--r--llvm/tools/llvm-pdbdump/LinePrinter.h1
2 files changed, 8 insertions, 3 deletions
diff --git a/llvm/tools/llvm-pdbdump/LinePrinter.cpp b/llvm/tools/llvm-pdbdump/LinePrinter.cpp
index 14f8c78160f..d3768104d88 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 29933e4004d..87c51e34f44 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;
};
}
}
OpenPOWER on IntegriCloud