LLVM: lib/Remarks/BitstreamRemarkParser.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_LIB_REMARKS_BITSTREAM_REMARK_PARSER_H
14#define LLVM_LIB_REMARKS_BITSTREAM_REMARK_PARSER_H
15
25#include
26#include
27#include
28
29namespace llvm {
31
33protected:
35
38
39public:
43
44 template <typename... Ts> Error error(char const *Fmt, const Ts &...Vals) {
45 std::string Buffer;
47 OS << "Error while parsing " << BlockName << " block: ";
48 OS << formatv(Fmt, Vals...);
50 std::move(Buffer),
51 std::make_error_code(std::errc::illegal_byte_sequence));
52 }
53
55
56protected:
58
63};
64
65template
67protected:
69 Derived &derived() { return *static_cast<Derived *>(this); }
70
71
72
74
75
76
78
79public:
80
81
82
85 return E;
86
87
88
89 while (true) {
92 return Next.takeError();
93 switch (Next->Kind) {
96 return E;
97 continue;
102 return E;
103 continue;
105 return error("Unexpected end of bitstream.");
106 }
108 }
109 }
110};
111
112
116
117public:
122
123
124
129
132
133protected:
135};
136
137
141
142protected:
146
147public:
153
158
161 };
162
163
164 std::optional<uint8_t> Type;
170
172
175
176
178
179protected:
182};
183
184
186
188
190
191
193
194
196
197
199
200
203
204
206
207
209
210
212
214};
215
216
218
220
222
224
225
227
228
233
234
235
237
239
243
244
246
247private:
248 Error processCommonMeta();
249 Error processFileContainerMeta();
250 Error processExternalFilePath();
251
253
254 Error processStrTab();
255 Error processRemarkVersion();
256};
257
260 std::optional ExternalFilePrependPath = std::nullopt);
261
262}
263}
264
265#endif
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This class maintains the abbreviations read from a block info block.
This represents a position within a bitcode file, implemented on top of a SimpleBitstreamCursor.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
FunctionAddr VTableAddr Next