Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame^] | 1 | //===- YAMLOutputStyle.cpp ------------------------------------ *- C++ --*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "YAMLOutputStyle.h" |
| 11 | |
| 12 | #include "PdbYaml.h" |
| 13 | #include "llvm-pdbdump.h" |
| 14 | |
| 15 | #include "llvm/DebugInfo/PDB/Raw/PDBFile.h" |
| 16 | |
| 17 | using namespace llvm; |
| 18 | using namespace llvm::pdb; |
| 19 | |
| 20 | YAMLOutputStyle::YAMLOutputStyle(PDBFile &File) : File(File), Out(outs()) {} |
| 21 | |
| 22 | Error YAMLOutputStyle::dumpFileHeaders() { |
| 23 | if (!opts::DumpHeaders) |
| 24 | return Error::success(); |
| 25 | |
| 26 | yaml::MsfHeaders Headers; |
| 27 | Headers.BlockCount = File.getBlockCount(); |
| 28 | Headers.BlockMapIndex = File.getBlockMapIndex(); |
| 29 | Headers.BlockMapOffset = File.getBlockMapOffset(); |
| 30 | Headers.BlockSize = File.getBlockSize(); |
| 31 | auto Blocks = File.getDirectoryBlockArray(); |
| 32 | Headers.DirectoryBlocks.assign(Blocks.begin(), Blocks.end()); |
| 33 | Headers.NumDirectoryBlocks = File.getNumDirectoryBlocks(); |
| 34 | Headers.NumDirectoryBytes = File.getNumDirectoryBytes(); |
| 35 | Headers.NumStreams = File.getNumStreams(); |
| 36 | Headers.Unknown0 = File.getUnknown0(); |
| 37 | Headers.Unknown1 = File.getUnknown1(); |
| 38 | |
| 39 | Obj.Headers.emplace(Headers); |
| 40 | |
| 41 | return Error::success(); |
| 42 | } |
| 43 | |
| 44 | Error YAMLOutputStyle::dumpStreamSummary() { |
| 45 | if (!opts::DumpStreamSummary) |
| 46 | return Error::success(); |
| 47 | |
| 48 | return Error::success(); |
| 49 | } |
| 50 | |
| 51 | Error YAMLOutputStyle::dumpStreamBlocks() { |
| 52 | if (!opts::DumpStreamBlocks) |
| 53 | return Error::success(); |
| 54 | |
| 55 | return Error::success(); |
| 56 | } |
| 57 | |
| 58 | Error YAMLOutputStyle::dumpStreamData() { |
| 59 | uint32_t StreamCount = File.getNumStreams(); |
| 60 | StringRef DumpStreamStr = opts::DumpStreamDataIdx; |
| 61 | uint32_t DumpStreamNum; |
| 62 | if (DumpStreamStr.getAsInteger(/*Radix=*/0U, DumpStreamNum) || |
| 63 | DumpStreamNum >= StreamCount) |
| 64 | return Error::success(); |
| 65 | |
| 66 | return Error::success(); |
| 67 | } |
| 68 | |
| 69 | Error YAMLOutputStyle::dumpInfoStream() { |
| 70 | if (!opts::DumpHeaders) |
| 71 | return Error::success(); |
| 72 | return Error::success(); |
| 73 | } |
| 74 | |
| 75 | Error YAMLOutputStyle::dumpNamedStream() { |
| 76 | if (opts::DumpStreamDataName.empty()) |
| 77 | return Error::success(); |
| 78 | |
| 79 | return Error::success(); |
| 80 | } |
| 81 | |
| 82 | Error YAMLOutputStyle::dumpTpiStream(uint32_t StreamIdx) { |
| 83 | return Error::success(); |
| 84 | } |
| 85 | |
| 86 | Error YAMLOutputStyle::dumpDbiStream() { return Error::success(); } |
| 87 | |
| 88 | Error YAMLOutputStyle::dumpSectionContribs() { |
| 89 | if (!opts::DumpSectionContribs) |
| 90 | return Error::success(); |
| 91 | |
| 92 | return Error::success(); |
| 93 | } |
| 94 | |
| 95 | Error YAMLOutputStyle::dumpSectionMap() { |
| 96 | if (!opts::DumpSectionMap) |
| 97 | return Error::success(); |
| 98 | |
| 99 | return Error::success(); |
| 100 | } |
| 101 | |
| 102 | Error YAMLOutputStyle::dumpPublicsStream() { |
| 103 | if (!opts::DumpPublics) |
| 104 | return Error::success(); |
| 105 | |
| 106 | return Error::success(); |
| 107 | } |
| 108 | |
| 109 | Error YAMLOutputStyle::dumpSectionHeaders() { |
| 110 | if (!opts::DumpSectionHeaders) |
| 111 | return Error::success(); |
| 112 | |
| 113 | return Error::success(); |
| 114 | } |
| 115 | |
| 116 | Error YAMLOutputStyle::dumpFpoStream() { |
| 117 | if (!opts::DumpFpo) |
| 118 | return Error::success(); |
| 119 | |
| 120 | return Error::success(); |
| 121 | } |
| 122 | |
| 123 | void YAMLOutputStyle::flush() { |
| 124 | Out << Obj; |
| 125 | outs().flush(); |
| 126 | } |