Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame] | 1 | //===- PdbYAML.h ---------------------------------------------- *- 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 | #ifndef LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H |
| 11 | #define LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H |
| 12 | |
| 13 | #include "OutputStyle.h" |
| 14 | |
| 15 | #include "llvm/ADT/Optional.h" |
| 16 | #include "llvm/Support/Endian.h" |
| 17 | #include "llvm/Support/YAMLTraits.h" |
| 18 | |
| 19 | #include <vector> |
| 20 | |
| 21 | namespace llvm { |
| 22 | namespace pdb { |
| 23 | class PDBFile; |
| 24 | |
| 25 | namespace yaml { |
| 26 | struct MsfHeaders { |
| 27 | uint32_t BlockSize; |
| 28 | uint32_t Unknown0; |
| 29 | uint32_t BlockCount; |
| 30 | uint32_t NumDirectoryBytes; |
| 31 | uint32_t Unknown1; |
| 32 | uint32_t BlockMapIndex; |
| 33 | uint32_t NumDirectoryBlocks; |
| 34 | uint32_t BlockMapOffset; |
| 35 | std::vector<uint32_t> DirectoryBlocks; |
| 36 | uint32_t NumStreams; |
| 37 | }; |
| 38 | |
Zachary Turner | 25e8b05 | 2016-06-06 20:37:17 +0000 | [diff] [blame^] | 39 | struct StreamSizeEntry { |
| 40 | uint32_t Size; |
| 41 | }; |
| 42 | |
| 43 | struct StreamMapEntry { |
| 44 | std::vector<uint32_t> Blocks; |
| 45 | }; |
| 46 | |
Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame] | 47 | struct PdbObject { |
| 48 | Optional<MsfHeaders> Headers; |
Zachary Turner | 25e8b05 | 2016-06-06 20:37:17 +0000 | [diff] [blame^] | 49 | Optional<std::vector<StreamSizeEntry>> StreamSizes; |
| 50 | Optional<std::vector<StreamMapEntry>> StreamMap; |
Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame] | 51 | }; |
| 52 | } |
| 53 | } |
Zachary Turner | 25e8b05 | 2016-06-06 20:37:17 +0000 | [diff] [blame^] | 54 | } |
Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame] | 55 | |
Zachary Turner | 25e8b05 | 2016-06-06 20:37:17 +0000 | [diff] [blame^] | 56 | namespace llvm { |
Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame] | 57 | namespace yaml { |
Zachary Turner | 25e8b05 | 2016-06-06 20:37:17 +0000 | [diff] [blame^] | 58 | template <> struct MappingTraits<pdb::yaml::StreamSizeEntry> { |
| 59 | static void mapping(IO &IO, pdb::yaml::StreamSizeEntry &Obj); |
| 60 | }; |
| 61 | |
| 62 | template <> struct MappingTraits<pdb::yaml::StreamMapEntry> { |
| 63 | static void mapping(IO &IO, pdb::yaml::StreamMapEntry &Obj); |
| 64 | }; |
| 65 | |
Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame] | 66 | template <> struct MappingTraits<pdb::yaml::MsfHeaders> { |
| 67 | static void mapping(IO &IO, pdb::yaml::MsfHeaders &Obj); |
| 68 | }; |
| 69 | template <> struct MappingTraits<pdb::yaml::PdbObject> { |
| 70 | static void mapping(IO &IO, pdb::yaml::PdbObject &Obj); |
| 71 | }; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | LLVM_YAML_IS_SEQUENCE_VECTOR(uint32_t) |
Zachary Turner | 25e8b05 | 2016-06-06 20:37:17 +0000 | [diff] [blame^] | 76 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamSizeEntry) |
| 77 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamMapEntry) |
Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame] | 78 | |
| 79 | #endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H |