LLVM: include/llvm/DebugInfo/CodeView/SymbolDeserializer.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLDESERIALIZER_H

10#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLDESERIALIZER_H

11

20

21namespace llvm {

25 struct MappingInfo {

28 Mapping(Reader, Container) {}

29

33 };

34

35public:

37

38

41 return EC;

42 if (auto EC = S.visitKnownRecord(Symbol, Record))

43 return EC;

45 return EC;

47 }

51 return std::move(EC);

53 }

54

57 : Delegate(Delegate), Container(Container) {}

58

62

64 assert(!Mapping && "Already in a symbol mapping!");

65 Mapping = std::make_unique(Record.content(), Container);

66 return Mapping->Mapping.visitSymbolBegin(Record);

67 }

69 assert(Mapping && "Not in a symbol mapping!");

70 auto EC = Mapping->Mapping.visitSymbolEnd(Record);

71 Mapping.reset();

72 return EC;

73 }

74

75#define SYMBOL_RECORD(EnumName, EnumVal, Name) \

76 Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \

77 return visitKnownRecordImpl(CVR, Record); \

78 }

79#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)

80#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"

81

82private:

83 template Error visitKnownRecordImpl(CVSymbol &CVR, T &Record) {

84

85 Record.RecordOffset =

86 Delegate ? Delegate->getRecordOffset(Mapping->Reader) : 0;

87 if (auto EC = Mapping->Mapping.visitKnownRecord(CVR, Record))

88 return EC;

90 }

91

92 SymbolVisitorDelegate *Delegate;

94 std::unique_ptr Mapping;

95};

96}

97}

98

99#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

An implementation of BinaryStream which holds its entire data set in a single contiguous buffer.

Provides read only access to a subclass of BinaryStream.

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.

Error visitSymbolBegin(CVSymbol &Record) override

Definition SymbolDeserializer.h:63

static Error deserializeAs(CVSymbol Symbol, T &Record)

Definition SymbolDeserializer.h:36

SymbolDeserializer(SymbolVisitorDelegate *Delegate, CodeViewContainer Container)

Definition SymbolDeserializer.h:55

Error visitSymbolEnd(CVSymbol &Record) override

Definition SymbolDeserializer.h:68

Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override

Paired begin/end actions for all symbols.

Definition SymbolDeserializer.h:59

static Expected< T > deserializeAs(CVSymbol Symbol)

Definition SymbolDeserializer.h:48

virtual uint32_t getRecordOffset(BinaryStreamReader Reader)=0

CVRecord< SymbolKind > CVSymbol

SymbolRecordKind

Distinguishes individual records in the Symbols subsection of a .debug$S section.

This is an optimization pass for GlobalISel generic memory operations.