]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305575, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / ObjectYAML / CodeViewYAMLDebugSections.h
1 //===- CodeViewYAMLDebugSections.h - CodeView YAMLIO debug sections -------===//
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 // This file defines classes for handling the YAML representation of CodeView
11 // Debug Info.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
16 #define LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
17
18 #include "llvm/DebugInfo/CodeView/CodeView.h"
19 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
20 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
21 #include "llvm/ObjectYAML/YAML.h"
22
23 namespace llvm {
24
25 namespace codeview {
26 class DebugStringTableSubsection;
27 class DebugStringTableSubsectionRef;
28 class DebugChecksumsSubsectionRef;
29 class DebugStringTableSubsection;
30 class DebugChecksumsSubsection;
31 class StringsAndChecksums;
32 class StringsAndChecksumsRef;
33 }
34 namespace CodeViewYAML {
35
36 namespace detail {
37 struct YAMLSubsectionBase;
38 }
39
40 struct YAMLFrameData {
41   uint32_t RvaStart;
42   uint32_t CodeSize;
43   uint32_t LocalSize;
44   uint32_t ParamsSize;
45   uint32_t MaxStackSize;
46   StringRef FrameFunc;
47   uint32_t PrologSize;
48   uint32_t SavedRegsSize;
49   uint32_t Flags;
50 };
51
52 struct YAMLCrossModuleImport {
53   StringRef ModuleName;
54   std::vector<uint32_t> ImportIds;
55 };
56
57 struct SourceLineEntry {
58   uint32_t Offset;
59   uint32_t LineStart;
60   uint32_t EndDelta;
61   bool IsStatement;
62 };
63
64 struct SourceColumnEntry {
65   uint16_t StartColumn;
66   uint16_t EndColumn;
67 };
68
69 struct SourceLineBlock {
70   StringRef FileName;
71   std::vector<SourceLineEntry> Lines;
72   std::vector<SourceColumnEntry> Columns;
73 };
74
75 struct HexFormattedString {
76   std::vector<uint8_t> Bytes;
77 };
78
79 struct SourceFileChecksumEntry {
80   StringRef FileName;
81   codeview::FileChecksumKind Kind;
82   HexFormattedString ChecksumBytes;
83 };
84
85 struct SourceLineInfo {
86   uint32_t RelocOffset;
87   uint32_t RelocSegment;
88   codeview::LineFlags Flags;
89   uint32_t CodeSize;
90
91   std::vector<SourceLineBlock> Blocks;
92 };
93
94 struct InlineeSite {
95   uint32_t Inlinee;
96   StringRef FileName;
97   uint32_t SourceLineNum;
98   std::vector<StringRef> ExtraFiles;
99 };
100
101 struct InlineeInfo {
102   bool HasExtraFiles;
103   std::vector<InlineeSite> Sites;
104 };
105
106 struct YAMLDebugSubsection {
107   static Expected<YAMLDebugSubsection>
108   fromCodeViewSubection(const codeview::StringsAndChecksumsRef &SC,
109                         const codeview::DebugSubsectionRecord &SS);
110
111   std::shared_ptr<detail::YAMLSubsectionBase> Subsection;
112 };
113
114 struct DebugSubsectionState {};
115
116 Expected<std::vector<std::shared_ptr<codeview::DebugSubsection>>>
117 toCodeViewSubsectionList(BumpPtrAllocator &Allocator,
118                          ArrayRef<YAMLDebugSubsection> Subsections,
119                          const codeview::StringsAndChecksums &SC);
120
121 std::vector<YAMLDebugSubsection>
122 fromDebugS(ArrayRef<uint8_t> Data, const codeview::StringsAndChecksumsRef &SC);
123
124 void initializeStringsAndChecksums(ArrayRef<YAMLDebugSubsection> Sections,
125                                    codeview::StringsAndChecksums &SC);
126
127 } // namespace CodeViewYAML
128 } // namespace llvm
129
130 LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::YAMLDebugSubsection)
131
132 LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::YAMLDebugSubsection)
133
134 #endif