]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/llvm-pdbdump/PdbYaml.h
Copy ^/vendor/NetBSD/tests/dist/lib/libc/hash/t_hmac.c to
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / llvm-pdbdump / PdbYaml.h
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/DebugInfo/PDB/PDBTypes.h"
17 #include "llvm/DebugInfo/PDB/Raw/MsfCommon.h"
18 #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
19 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
20 #include "llvm/Support/Endian.h"
21 #include "llvm/Support/YAMLTraits.h"
22
23 #include <vector>
24
25 namespace llvm {
26 namespace pdb {
27
28 namespace yaml {
29 struct MsfHeaders {
30   msf::SuperBlock SuperBlock;
31   uint32_t NumDirectoryBlocks;
32   std::vector<uint32_t> DirectoryBlocks;
33   uint32_t NumStreams;
34   uint32_t FileSize;
35 };
36
37 struct StreamBlockList {
38   std::vector<uint32_t> Blocks;
39 };
40
41 struct NamedStreamMapping {
42   StringRef StreamName;
43   uint32_t StreamNumber;
44 };
45
46 struct PdbInfoStream {
47   PdbRaw_ImplVer Version;
48   uint32_t Signature;
49   uint32_t Age;
50   PDB_UniqueId Guid;
51   std::vector<NamedStreamMapping> NamedStreams;
52 };
53
54 struct PdbDbiStream {
55   PdbRaw_DbiVer VerHeader;
56   uint32_t Age;
57   uint16_t BuildNumber;
58   uint32_t PdbDllVersion;
59   uint16_t PdbDllRbld;
60   uint16_t Flags;
61   PDB_Machine MachineType;
62 };
63
64 struct PdbObject {
65   Optional<MsfHeaders> Headers;
66   Optional<std::vector<uint32_t>> StreamSizes;
67   Optional<std::vector<StreamBlockList>> StreamMap;
68   Optional<PdbInfoStream> PdbStream;
69   Optional<PdbDbiStream> DbiStream;
70 };
71 }
72 }
73 }
74
75 namespace llvm {
76 namespace yaml {
77
78 template <> struct MappingTraits<pdb::yaml::PdbObject> {
79   static void mapping(IO &IO, pdb::yaml::PdbObject &Obj);
80 };
81
82 template <> struct MappingTraits<pdb::yaml::MsfHeaders> {
83   static void mapping(IO &IO, pdb::yaml::MsfHeaders &Obj);
84 };
85
86 template <> struct MappingTraits<pdb::msf::SuperBlock> {
87   static void mapping(IO &IO, pdb::msf::SuperBlock &SB);
88 };
89
90 template <> struct MappingTraits<pdb::yaml::StreamBlockList> {
91   static void mapping(IO &IO, pdb::yaml::StreamBlockList &SB);
92 };
93
94 template <> struct MappingTraits<pdb::yaml::PdbInfoStream> {
95   static void mapping(IO &IO, pdb::yaml::PdbInfoStream &Obj);
96 };
97
98 template <> struct MappingTraits<pdb::yaml::PdbDbiStream> {
99   static void mapping(IO &IO, pdb::yaml::PdbDbiStream &Obj);
100 };
101
102 template <> struct MappingTraits<pdb::yaml::NamedStreamMapping> {
103   static void mapping(IO &IO, pdb::yaml::NamedStreamMapping &Obj);
104 };
105 }
106 }
107
108 LLVM_YAML_IS_SEQUENCE_VECTOR(uint32_t)
109 LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::NamedStreamMapping)
110 LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamBlockList)
111
112 #endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H