blob: a7c942a3bd8ecd63dc3fc7e5ed5cf63fb8332f77 [file] [log] [blame]
Zachary Turner7120a472016-06-06 20:37:05 +00001//===- 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
21namespace llvm {
22namespace pdb {
23class PDBFile;
24
25namespace yaml {
26struct 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 Turner25e8b052016-06-06 20:37:17 +000039struct StreamSizeEntry {
40 uint32_t Size;
41};
42
43struct StreamMapEntry {
44 std::vector<uint32_t> Blocks;
45};
46
Zachary Turner7120a472016-06-06 20:37:05 +000047struct PdbObject {
48 Optional<MsfHeaders> Headers;
Zachary Turner25e8b052016-06-06 20:37:17 +000049 Optional<std::vector<StreamSizeEntry>> StreamSizes;
50 Optional<std::vector<StreamMapEntry>> StreamMap;
Zachary Turner7120a472016-06-06 20:37:05 +000051};
52}
53}
Zachary Turner25e8b052016-06-06 20:37:17 +000054}
Zachary Turner7120a472016-06-06 20:37:05 +000055
Zachary Turner25e8b052016-06-06 20:37:17 +000056namespace llvm {
Zachary Turner7120a472016-06-06 20:37:05 +000057namespace yaml {
Zachary Turner25e8b052016-06-06 20:37:17 +000058template <> struct MappingTraits<pdb::yaml::StreamSizeEntry> {
59 static void mapping(IO &IO, pdb::yaml::StreamSizeEntry &Obj);
60};
61
62template <> struct MappingTraits<pdb::yaml::StreamMapEntry> {
63 static void mapping(IO &IO, pdb::yaml::StreamMapEntry &Obj);
64};
65
Zachary Turner7120a472016-06-06 20:37:05 +000066template <> struct MappingTraits<pdb::yaml::MsfHeaders> {
67 static void mapping(IO &IO, pdb::yaml::MsfHeaders &Obj);
68};
69template <> struct MappingTraits<pdb::yaml::PdbObject> {
70 static void mapping(IO &IO, pdb::yaml::PdbObject &Obj);
71};
72}
73}
74
75LLVM_YAML_IS_SEQUENCE_VECTOR(uint32_t)
Zachary Turner25e8b052016-06-06 20:37:17 +000076LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamSizeEntry)
77LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamMapEntry)
Zachary Turner7120a472016-06-06 20:37:05 +000078
79#endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H