LLVM: include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
10#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
11
16#include
17
18namespace llvm {
19
21
27
31
32
33 enum HeaderFlagMask {
34#define HANDLE_MACRO_FLAG(ID, NAME) MACRO_##NAME = ID,
35#include "llvm/BinaryFormat/Dwarf.def"
36 };
37 struct MacroHeader {
38
39 uint16_t Version = 0;
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 uint8_t Flags = 0;
56
57
58
59
60
61
62 uint64_t DebugLineOffset;
63
64
65 void dumpMacroHeader(raw_ostream &OS) const;
66
67
68 Error parseMacroHeader(DWARFDataExtractor Data, uint64_t *Offset);
69
70
72
73
74 uint8_t getOffsetByteSize() const;
75 };
76
77
78 struct Entry {
79
80 uint32_t Type;
81 union {
82
83 uint64_t Line;
84
85 uint64_t ExtConstant;
86
87 uint64_t ImportOffset;
88 };
89
90 union {
91
92 const char *MacroStr;
93
94 uint64_t File;
95
96 const char *ExtStr;
97 };
98 };
99
100 struct MacroList {
101
102
103
104 MacroHeader Header;
105 SmallVector<Entry, 4> Macros;
106 uint64_t Offset;
107
108
109 bool IsDebugMacro;
110 };
111
112
113 std::vector MacroLists;
114
115public:
117
118
120
124 return parseImpl(Units, StringExtractor, MacroData, true);
125 }
126
128 return parseImpl(std::nullopt, std::nullopt, MacroData, false);
129 }
130
131
132 bool empty() const { return MacroLists.empty(); }
133
135 for (const MacroList &List : MacroLists)
137 return true;
138
139 return false;
140 }
141
142private:
143
144
145 Error parseImpl(std::optionalDWARFUnitVector::compile\_unit\_range Units,
146 std::optional StringExtractor,
148};
149
150}
151
152#endif
This file defines the SmallVector class.
DWARFDebugMacro()=default
void dump(raw_ostream &OS) const
Print the macro list found within the debug_macinfo/debug_macro section.
Error parseMacinfo(DWARFDataExtractor MacroData)
Definition DWARFDebugMacro.h:127
bool empty() const
Return whether the section has any entries.
Definition DWARFDebugMacro.h:132
Error parseMacro(DWARFUnitVector::compile_unit_range Units, DataExtractor StringExtractor, DWARFDataExtractor MacroData)
Definition DWARFDebugMacro.h:121
bool hasEntryForOffset(uint64_t Offset) const
Definition DWARFDebugMacro.h:134
decltype(make_filter_range(std::declval< iterator_range >(), isCompileUnit)) compile_unit_range
Lightweight error class with error context and mandatory checking.
User of DwarfStreamer should call initialization code for AsmPrinter:
Stores all information related to a compile unit, be it in its original instance of the object file o...
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition DWARFDebugMacro.h:23
Definition DWARFDebugMacro.h:22
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr uintptr_t uintptr_t Data