Fix test failures introduced by PR #113697 (#116941)
[llvm-project.git] / llvm / tools / llvm-pdbutil / PdbYaml.h
blob21658e9d0e75e457f838b2d92509c609ba22cf1c
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/DebugInfo/CodeView/SymbolRecord.h"
15 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
16 #include "llvm/DebugInfo/MSF/MSFCommon.h"
17 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
18 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
19 #include "llvm/DebugInfo/PDB/PDBTypes.h"
20 #include "llvm/ObjectYAML/CodeViewYAMLDebugSections.h"
21 #include "llvm/ObjectYAML/CodeViewYAMLSymbols.h"
22 #include "llvm/ObjectYAML/CodeViewYAMLTypes.h"
23 #include "llvm/Support/Endian.h"
24 #include "llvm/Support/YAMLTraits.h"
26 #include <optional>
27 #include <vector>
29 namespace llvm {
30 namespace pdb {
32 namespace yaml {
34 struct MSFHeaders {
35 msf::SuperBlock SuperBlock;
36 uint32_t NumDirectoryBlocks = 0;
37 std::vector<uint32_t> DirectoryBlocks;
38 uint32_t NumStreams = 0;
39 uint64_t FileSize = 0;
42 struct StreamBlockList {
43 std::vector<uint32_t> Blocks;
46 struct NamedStreamMapping {
47 StringRef StreamName;
48 uint32_t StreamNumber;
51 struct PdbInfoStream {
52 PdbRaw_ImplVer Version = PdbImplVC70;
53 uint32_t Signature = 0;
54 uint32_t Age = 1;
55 codeview::GUID Guid;
56 std::vector<PdbRaw_FeatureSig> Features;
57 std::vector<NamedStreamMapping> NamedStreams;
60 struct PdbModiStream {
61 uint32_t Signature;
62 std::vector<CodeViewYAML::SymbolRecord> Symbols;
65 struct PdbDbiModuleInfo {
66 StringRef Obj;
67 StringRef Mod;
68 std::vector<StringRef> SourceFiles;
69 std::vector<CodeViewYAML::YAMLDebugSubsection> Subsections;
70 std::optional<PdbModiStream> Modi;
73 struct PdbDbiStream {
74 PdbRaw_DbiVer VerHeader = PdbDbiV70;
75 uint32_t Age = 1;
76 uint16_t BuildNumber = 0;
77 uint32_t PdbDllVersion = 0;
78 uint16_t PdbDllRbld = 0;
79 uint16_t Flags = 1;
80 PDB_Machine MachineType = PDB_Machine::x86;
82 std::vector<PdbDbiModuleInfo> ModInfos;
85 struct PdbTpiStream {
86 PdbRaw_TpiVer Version = PdbTpiV80;
87 std::vector<CodeViewYAML::LeafRecord> Records;
90 struct PdbPublicsStream {
91 std::vector<CodeViewYAML::SymbolRecord> PubSyms;
94 struct PdbObject {
95 explicit PdbObject(BumpPtrAllocator &Allocator) : Allocator(Allocator) {}
97 std::optional<MSFHeaders> Headers;
98 std::optional<std::vector<uint32_t>> StreamSizes;
99 std::optional<std::vector<StreamBlockList>> StreamMap;
100 std::optional<PdbInfoStream> PdbStream;
101 std::optional<PdbDbiStream> DbiStream;
102 std::optional<PdbTpiStream> TpiStream;
103 std::optional<PdbTpiStream> IpiStream;
104 std::optional<PdbPublicsStream> PublicsStream;
106 std::optional<std::vector<StringRef>> StringTable;
108 BumpPtrAllocator &Allocator;
114 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbObject)
115 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::MSFHeaders)
116 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(msf::SuperBlock)
117 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::StreamBlockList)
118 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbInfoStream)
119 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbDbiStream)
120 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbTpiStream)
121 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbPublicsStream)
122 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::NamedStreamMapping)
123 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbModiStream)
124 LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbDbiModuleInfo)
126 #endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H