15 using namespace llvm::codeview;
61 return Sizes[N - LF_NUMERIC];
65 const char *S =
reinterpret_cast<const char *
>(Data.
data());
73 while (!Content.
empty()) {
213 while (!Content.
empty()) {
254 if (!Content.
empty()) {
255 uint8_t Pad = Content.
front();
256 if (Pad >= LF_PAD0) {
281 case TypeLeafKind::LF_FUNC_ID:
282 Refs.
push_back({TiRefKind::IndexRef, 0, 1});
283 Refs.
push_back({TiRefKind::TypeRef, 4, 1});
285 case TypeLeafKind::LF_MFUNC_ID:
286 Refs.
push_back({TiRefKind::TypeRef, 0, 2});
288 case TypeLeafKind::LF_STRING_ID:
289 Refs.
push_back({TiRefKind::IndexRef, 0, 1});
291 case TypeLeafKind::LF_SUBSTR_LIST:
294 Refs.
push_back({TiRefKind::IndexRef, 4, Count});
296 case TypeLeafKind::LF_BUILDINFO:
299 Refs.
push_back({TiRefKind::IndexRef, 2, Count});
301 case TypeLeafKind::LF_UDT_SRC_LINE:
302 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
303 Refs.
push_back({TiRefKind::IndexRef, 4, 1});
305 case TypeLeafKind::LF_UDT_MOD_SRC_LINE:
306 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
308 case TypeLeafKind::LF_MODIFIER:
309 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
311 case TypeLeafKind::LF_PROCEDURE:
312 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
313 Refs.
push_back({TiRefKind::TypeRef, 8, 1});
315 case TypeLeafKind::LF_MFUNCTION:
316 Refs.
push_back({TiRefKind::TypeRef, 0, 3});
317 Refs.
push_back({TiRefKind::TypeRef, 16, 1});
319 case TypeLeafKind::LF_ARGLIST:
322 Refs.
push_back({TiRefKind::TypeRef, 4, Count});
324 case TypeLeafKind::LF_ARRAY:
325 Refs.
push_back({TiRefKind::TypeRef, 0, 2});
327 case TypeLeafKind::LF_CLASS:
328 case TypeLeafKind::LF_STRUCTURE:
329 case TypeLeafKind::LF_INTERFACE:
330 Refs.
push_back({TiRefKind::TypeRef, 4, 3});
332 case TypeLeafKind::LF_UNION:
333 Refs.
push_back({TiRefKind::TypeRef, 4, 1});
335 case TypeLeafKind::LF_ENUM:
336 Refs.
push_back({TiRefKind::TypeRef, 4, 2});
338 case TypeLeafKind::LF_BITFIELD:
339 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
341 case TypeLeafKind::LF_VFTABLE:
342 Refs.
push_back({TiRefKind::TypeRef, 0, 2});
344 case TypeLeafKind::LF_VTSHAPE:
346 case TypeLeafKind::LF_METHODLIST:
349 case TypeLeafKind::LF_FIELDLIST:
352 case TypeLeafKind::LF_POINTER:
367 case SymbolKind::S_GPROC32:
368 case SymbolKind::S_LPROC32:
369 case SymbolKind::S_GPROC32_ID:
370 case SymbolKind::S_LPROC32_ID:
371 case SymbolKind::S_LPROC32_DPC:
372 case SymbolKind::S_LPROC32_DPC_ID:
373 Refs.
push_back({TiRefKind::IndexRef, 24, 1});
375 case SymbolKind::S_UDT:
376 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
378 case SymbolKind::S_GDATA32:
379 case SymbolKind::S_LDATA32:
380 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
382 case SymbolKind::S_BUILDINFO:
383 Refs.
push_back({TiRefKind::IndexRef, 0, 1});
385 case SymbolKind::S_LTHREAD32:
386 case SymbolKind::S_GTHREAD32:
387 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
389 case SymbolKind::S_FILESTATIC:
390 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
392 case SymbolKind::S_LOCAL:
393 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
395 case SymbolKind::S_CONSTANT:
396 Refs.
push_back({TiRefKind::TypeRef, 0, 1});
398 case SymbolKind::S_REGREL32:
399 Refs.
push_back({TiRefKind::TypeRef, 4, 1});
401 case SymbolKind::S_CALLSITEINFO:
402 Refs.
push_back({TiRefKind::TypeRef, 8, 1});
404 case SymbolKind::S_CALLERS:
405 case SymbolKind::S_CALLEES:
408 Refs.
push_back({TiRefKind::IndexRef, 4, Count});
410 case SymbolKind::S_INLINESITE:
411 Refs.
push_back({TiRefKind::IndexRef, 8, 1});
413 case SymbolKind::S_HEAPALLOCSITE:
415 Refs.
push_back({TiRefKind::IndexRef, 8, 1});
419 case SymbolKind::S_DEFRANGE_REGISTER:
420 case SymbolKind::S_DEFRANGE_REGISTER_REL:
421 case SymbolKind::S_DEFRANGE_FRAMEPOINTER_REL:
422 case SymbolKind::S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE:
423 case SymbolKind::S_DEFRANGE_SUBFIELD_REGISTER:
424 case SymbolKind::S_DEFRANGE_SUBFIELD:
428 case SymbolKind::S_LABEL32:
429 case SymbolKind::S_OBJNAME:
430 case SymbolKind::S_COMPILE:
431 case SymbolKind::S_COMPILE2:
432 case SymbolKind::S_COMPILE3:
433 case SymbolKind::S_ENVBLOCK:
434 case SymbolKind::S_BLOCK32:
435 case SymbolKind::S_FRAMEPROC:
438 case SymbolKind::S_END:
439 case SymbolKind::S_INLINESITE_END:
440 case SymbolKind::S_PROC_ID_END:
464 for (
const auto &Ref : Refs) {
467 cantFail(Reader.readArray(Run, Ref.Count));
void push_back(const T &Elt)
static uint32_t handleBaseClass(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
void discoverTypeIndices(ArrayRef< uint8_t > RecordData, SmallVectorImpl< TiReference > &Refs)
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
#define LLVM_UNLIKELY(EXPR)
const T & front() const
front - Get the first element.
void cantFail(Error Err)
Report a fatal error if Err is a failure value.
uint16_t read16le(const void *P)
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
static uint32_t handleOneMethod(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
FixedStreamArrayIterator< T > begin() const
static uint32_t handleVirtualBaseClass(ArrayRef< uint8_t > Data, uint32_t Offset, bool IsIndirect, SmallVectorImpl< TiReference > &Refs)
static void handleFieldList(ArrayRef< uint8_t > Content, SmallVectorImpl< TiReference > &Refs)
FixedStreamArrayIterator< T > end() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
LLVM_NODISCARD bool empty() const
static MethodKind getMethodKind(uint16_t Attrs)
static bool isIntroVirtual(uint16_t Attrs)
MethodKind
Part of member attribute flags. (CV_methodprop_e)
static uint32_t getCStringLength(ArrayRef< uint8_t > Data)
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
static uint32_t handleListContinuation(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
static uint32_t getEncodedIntegerLength(ArrayRef< uint8_t > Data)
The instances of the Type class are immutable: once they are created, they are never changed...
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
static uint32_t handleOverloadedMethod(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
bool empty() const
empty - Check if the array is empty.
static uint32_t handleStaticDataMember(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
static uint32_t handleEnumerator(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
static void handleMethodOverloadList(ArrayRef< uint8_t > Content, SmallVectorImpl< TiReference > &Refs)
static PointerMode getPointerMode(uint32_t Attrs)
void setOffset(uint32_t Off)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
ArrayRef< uint8_t > content() const
static uint32_t handleDataMember(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
PointerMode
Equivalent to CV_ptrmode_e.
static const uint32_t PointerModeMask
static void discoverTypeIndices(ArrayRef< uint8_t > Content, TypeLeafKind Kind, SmallVectorImpl< TiReference > &Refs)
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static const uint32_t PointerModeShift
static bool isMemberPointer(uint32_t Attrs)
uint32_t read32le(const void *P)
static void handlePointer(ArrayRef< uint8_t > Content, SmallVectorImpl< TiReference > &Refs)
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
static uint32_t handleVFPtr(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Provides read only access to a subclass of BinaryStream.
static uint32_t handleNestedType(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)