[test/Object] - Move/rewrite 2 more test cases.
[llvm-complete.git] / tools / llvm-pdbutil / PdbYaml.h
blobed6346c2c4db0230dd2920b3b0295e2bb6155d41
1 //===- PdbYAML.h ---------------------------------------------- *- C++ --*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
10 #define LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
12 #include "OutputStyle.h"
14 #include "llvm/ADT/Optional.h"
15 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
16 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
17 #include "llvm/DebugInfo/MSF/MSFCommon.h"
18 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
19 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
20 #include "llvm/DebugInfo/PDB/PDBTypes.h"
21 #include "llvm/ObjectYAML/CodeViewYAMLDebugSections.h"
22 #include "llvm/ObjectYAML/CodeViewYAMLSymbols.h"
23 #include "llvm/ObjectYAML/CodeViewYAMLTypes.h"
24 #include "llvm/Support/Endian.h"
25 #include "llvm/Support/YAMLTraits.h"
27 #include <vector>
29 namespace llvm {
30 namespace codeview {
31 class DebugStringTableSubsection;
33 namespace pdb {
35 namespace yaml {
36 struct SerializationContext;
38 struct MSFHeaders {
39 msf::SuperBlock SuperBlock;
40 uint32_t NumDirectoryBlocks = 0;
41 std::vector<uint32_t> DirectoryBlocks;
42 uint32_t NumStreams = 0;
43 uint32_t FileSize = 0;
46 struct StreamBlockList {
47 std::vector<uint32_t> Blocks;
50 struct NamedStreamMapping {
51 StringRef StreamName;
52 uint32_t StreamNumber;
55 struct PdbInfoStream {
56 PdbRaw_ImplVer Version = PdbImplVC70;
57 uint32_t Signature = 0;
58 uint32_t Age = 1;
59 codeview::GUID Guid;
60 std::vector<PdbRaw_FeatureSig> Features;
61 std::vector<NamedStreamMapping> NamedStreams;
64 struct PdbModiStream {
65 uint32_t Signature;
66 std::vector<CodeViewYAML::SymbolRecord> Symbols;
69 struct PdbDbiModuleInfo {
70 StringRef Obj;
71 StringRef Mod;
72 std::vector<StringRef> SourceFiles;
73 std::vector<CodeViewYAML::YAMLDebugSubsection> Subsections;
74 Optional<PdbModiStream> Modi;
77 struct PdbDbiStream {
78 PdbRaw_DbiVer VerHeader = PdbDbiV70;
79 uint32_t Age = 1;
80 uint16_t BuildNumber = 0;
81 uint32_t PdbDllVersion = 0;
82 uint16_t PdbDllRbld = 0;
83 uint16_t Flags = 1;
84 PDB_Machine MachineType = PDB_Machine::x86;
86 std::vector<PdbDbiModuleInfo> ModInfos;
89 struct PdbTpiStream {
90 PdbRaw_TpiVer Version = PdbTpiV80;
91 std::vector<CodeViewYAML::LeafRecord> Records;
94 struct PdbPublicsStream {
95 std::vector<CodeViewYAML::SymbolRecord> PubSyms;
98 struct PdbObject {
99 explicit PdbObject(BumpPtrAllocator &Allocator) : Allocator(Allocator) {}
101 Optional<MSFHeaders> Headers;
102 Optional<std::vector<uint32_t>> StreamSizes;
103 Optional<std::vector<StreamBlockList>> StreamMap;
104 Optional<PdbInfoStream> PdbStream;
105 Optional<PdbDbiStream> DbiStream;
106 Optional<PdbTpiStream> TpiStream;
107 Optional<PdbTpiStream> IpiStream;
108 Optional<PdbPublicsStream> PublicsStream;
110 Optional<std::vector<StringRef>> StringTable;
112 BumpPtrAllocator &Allocator;
118 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbObject)
119 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::MSFHeaders)
120 LLVM_YAML_DECLARE_MAPPING_TRAITS(msf::SuperBlock)
121 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::StreamBlockList)
122 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbInfoStream)
123 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiStream)
124 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbTpiStream)
125 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbPublicsStream)
126 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::NamedStreamMapping)
127 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbModiStream)
128 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiModuleInfo)
130 #endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H