blob: f6e070f8398d2331df472fedc48ae9754ca649e0 [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"
Zachary Turner1dc9fd32016-06-14 20:48:36 +000016#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
Zachary Turner7120a472016-06-06 20:37:05 +000017#include "llvm/Support/Endian.h"
18#include "llvm/Support/YAMLTraits.h"
19
20#include <vector>
21
22namespace llvm {
23namespace pdb {
Zachary Turner7120a472016-06-06 20:37:05 +000024
25namespace yaml {
26struct MsfHeaders {
Zachary Turner1dc9fd32016-06-14 20:48:36 +000027 PDBFile::SuperBlock SuperBlock;
Zachary Turner7120a472016-06-06 20:37:05 +000028 uint32_t NumDirectoryBlocks;
29 uint32_t BlockMapOffset;
Zachary Turner1dc9fd32016-06-14 20:48:36 +000030 std::vector<support::ulittle32_t> DirectoryBlocks;
Zachary Turner7120a472016-06-06 20:37:05 +000031 uint32_t NumStreams;
Zachary Turner1dc9fd32016-06-14 20:48:36 +000032 uint32_t FileSize;
Zachary Turner7120a472016-06-06 20:37:05 +000033};
34
Zachary Turner1dc9fd32016-06-14 20:48:36 +000035struct StreamBlockList {
36 std::vector<support::ulittle32_t> Blocks;
Zachary Turner25e8b052016-06-06 20:37:17 +000037};
38
Zachary Turner7120a472016-06-06 20:37:05 +000039struct PdbObject {
Zachary Turner1dc9fd32016-06-14 20:48:36 +000040 MsfHeaders Headers;
41 Optional<std::vector<support::ulittle32_t>> StreamSizes;
42 Optional<std::vector<StreamBlockList>> StreamMap;
Zachary Turner7120a472016-06-06 20:37:05 +000043};
44}
45}
Zachary Turner25e8b052016-06-06 20:37:17 +000046}
Zachary Turner7120a472016-06-06 20:37:05 +000047
Zachary Turner25e8b052016-06-06 20:37:17 +000048namespace llvm {
Zachary Turner7120a472016-06-06 20:37:05 +000049namespace yaml {
Zachary Turner1dc9fd32016-06-14 20:48:36 +000050
51template <> struct MappingTraits<pdb::PDBFile::SuperBlock> {
52 static void mapping(IO &IO, pdb::PDBFile::SuperBlock &SB);
Zachary Turner25e8b052016-06-06 20:37:17 +000053};
54
Zachary Turner1dc9fd32016-06-14 20:48:36 +000055template <> struct MappingTraits<pdb::yaml::StreamBlockList> {
56 static void mapping(IO &IO, pdb::yaml::StreamBlockList &SB);
Zachary Turner25e8b052016-06-06 20:37:17 +000057};
58
Zachary Turner7120a472016-06-06 20:37:05 +000059template <> struct MappingTraits<pdb::yaml::MsfHeaders> {
60 static void mapping(IO &IO, pdb::yaml::MsfHeaders &Obj);
61};
Zachary Turner1dc9fd32016-06-14 20:48:36 +000062
Zachary Turner7120a472016-06-06 20:37:05 +000063template <> struct MappingTraits<pdb::yaml::PdbObject> {
64 static void mapping(IO &IO, pdb::yaml::PdbObject &Obj);
65};
66}
67}
68
Zachary Turner1dc9fd32016-06-14 20:48:36 +000069LLVM_YAML_IS_SEQUENCE_VECTOR(support::ulittle32_t)
70LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamBlockList)
Zachary Turner7120a472016-06-06 20:37:05 +000071
72#endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H