diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-11-03 01:04:44 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-11-03 01:04:44 +0000 |
| commit | fa05aacd3b775431d3a8e8815740e38880c9a662 (patch) | |
| tree | 928d3c051cd8231b78966ad2b89c330fced8f2ba /llvm/tools/llvm-pdbdump/LinePrinter.cpp | |
| parent | 78aa1de3ae7032cbb0be46ccea916f39f5bd192b (diff) | |
| download | bcm5719-llvm-fa05aacd3b775431d3a8e8815740e38880c9a662.tar.gz bcm5719-llvm-fa05aacd3b775431d3a8e8815740e38880c9a662.zip | |
llvm-pdbdump: Simplify. NFC.
llvm-svn: 251873
Diffstat (limited to 'llvm/tools/llvm-pdbdump/LinePrinter.cpp')
| -rw-r--r-- | llvm/tools/llvm-pdbdump/LinePrinter.cpp | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/llvm/tools/llvm-pdbdump/LinePrinter.cpp b/llvm/tools/llvm-pdbdump/LinePrinter.cpp index 9f0f5d8c068..4f3ee54c769 100644 --- a/llvm/tools/llvm-pdbdump/LinePrinter.cpp +++ b/llvm/tools/llvm-pdbdump/LinePrinter.cpp @@ -84,54 +84,40 @@ bool LinePrinter::IsCompilandExcluded(llvm::StringRef CompilandName) { } WithColor::WithColor(LinePrinter &P, PDB_ColorItem C) : OS(P.OS) { - if (C == PDB_ColorItem::None) - OS.resetColor(); - else { - raw_ostream::Colors Color; - bool Bold; - translateColor(C, Color, Bold); - OS.changeColor(Color, Bold); - } + applyColor(C); } WithColor::~WithColor() { OS.resetColor(); } -void WithColor::translateColor(PDB_ColorItem C, raw_ostream::Colors &Color, - bool &Bold) const { +void WithColor::applyColor(PDB_ColorItem C) { switch (C) { + case PDB_ColorItem::None: + OS.resetColor(); + return; case PDB_ColorItem::Address: - Color = raw_ostream::YELLOW; - Bold = true; + OS.changeColor(raw_ostream::YELLOW, /*bold=*/true); return; case PDB_ColorItem::Keyword: - Color = raw_ostream::MAGENTA; - Bold = true; + OS.changeColor(raw_ostream::MAGENTA, true); return; case PDB_ColorItem::Register: case PDB_ColorItem::Offset: - Color = raw_ostream::YELLOW; - Bold = false; + OS.changeColor(raw_ostream::YELLOW, false); return; case PDB_ColorItem::Type: - Color = raw_ostream::CYAN; - Bold = true; + OS.changeColor(raw_ostream::CYAN, true); return; case PDB_ColorItem::Identifier: - Color = raw_ostream::CYAN; - Bold = false; + OS.changeColor(raw_ostream::CYAN, false); return; case PDB_ColorItem::Path: - Color = raw_ostream::CYAN; - Bold = false; + OS.changeColor(raw_ostream::CYAN, false); return; case PDB_ColorItem::SectionHeader: - Color = raw_ostream::RED; - Bold = true; + OS.changeColor(raw_ostream::RED, true); return; case PDB_ColorItem::LiteralValue: - Color = raw_ostream::GREEN; - Bold = true; - default: + OS.changeColor(raw_ostream::GREEN, true); return; } } |

