diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-16 21:03:24 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-16 21:03:24 +0000 | 
| commit | 7c7aba6e5fef47a01a136be655b0a92cfd7090f6 (patch) | |
| tree | 99ec531924f6078534b100ab9d7696abce848099 /tools/llvm-pdbutil/LinePrinter.cpp | |
| parent | 7ab83427af0f77b59941ceba41d509d7d097b065 (diff) | |
Notes
Diffstat (limited to 'tools/llvm-pdbutil/LinePrinter.cpp')
| -rw-r--r-- | tools/llvm-pdbutil/LinePrinter.cpp | 33 | 
1 files changed, 30 insertions, 3 deletions
diff --git a/tools/llvm-pdbutil/LinePrinter.cpp b/tools/llvm-pdbutil/LinePrinter.cpp index ef56b5fe8e6a1..718d3394e211d 100644 --- a/tools/llvm-pdbutil/LinePrinter.cpp +++ b/tools/llvm-pdbutil/LinePrinter.cpp @@ -13,6 +13,7 @@  #include "llvm/ADT/STLExtras.h"  #include "llvm/DebugInfo/PDB/UDTLayout.h" +#include "llvm/Support/Format.h"  #include "llvm/Support/Regex.h"  #include <algorithm> @@ -60,10 +61,16 @@ LinePrinter::LinePrinter(int Indent, bool UseColor, llvm::raw_ostream &Stream)               opts::pretty::IncludeCompilands.end());  } -void LinePrinter::Indent() { CurrentIndent += IndentSpaces; } +void LinePrinter::Indent(uint32_t Amount) { +  if (Amount == 0) +    Amount = IndentSpaces; +  CurrentIndent += Amount; +} -void LinePrinter::Unindent() { -  CurrentIndent = std::max(0, CurrentIndent - IndentSpaces); +void LinePrinter::Unindent(uint32_t Amount) { +  if (Amount == 0) +    Amount = IndentSpaces; +  CurrentIndent = std::max<int>(0, CurrentIndent - Amount);  }  void LinePrinter::NewLine() { @@ -71,6 +78,13 @@ void LinePrinter::NewLine() {    OS.indent(CurrentIndent);  } +void LinePrinter::print(const Twine &T) { OS << T; } + +void LinePrinter::printLine(const Twine &T) { +  NewLine(); +  OS << T; +} +  bool LinePrinter::IsClassExcluded(const ClassLayout &Class) {    if (IsTypeExcluded(Class.getName(), Class.getSize()))      return true; @@ -79,6 +93,19 @@ bool LinePrinter::IsClassExcluded(const ClassLayout &Class) {    return false;  } +void LinePrinter::formatBinary(StringRef Label, ArrayRef<uint8_t> Data, +                               uint32_t StartOffset) { +  NewLine(); +  OS << Label << " ("; +  if (!Data.empty()) { +    OS << "\n"; +    OS << format_bytes_with_ascii(Data, StartOffset, 32, 4, +                                  CurrentIndent + IndentSpaces, true); +    NewLine(); +  } +  OS << ")"; +} +  bool LinePrinter::IsTypeExcluded(llvm::StringRef TypeName, uint32_t Size) {    if (IsItemExcluded(TypeName, IncludeTypeFilters, ExcludeTypeFilters))      return true;  | 
