LLVM: include/llvm/Support/ELFAttrParserCompact.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_SUPPORT_ELFCOMPACTATTRPARSER_H

10#define LLVM_SUPPORT_ELFCOMPACTATTRPARSER_H

11

18

19#include

20#include <unordered_map>

21

22namespace llvm {

25

28 std::unordered_map<unsigned, unsigned> attributes;

29 std::unordered_map<unsigned, StringRef> attributesStr;

30

31 virtual Error handler(uint64_t tag, bool &handled) = 0;

32

33protected:

38

39 void printAttribute(unsigned tag, unsigned value, StringRef valueDesc);

40

41 Error parseStringAttribute(const char *name, unsigned tag,

46

48 attributesStr.emplace(tag, value);

49 }

50

51public:

53 Error integerAttribute(unsigned tag);

54 Error stringAttribute(unsigned tag);

55

61

63

65 auto I = attributes.find(tag);

66 if (I == attributes.end())

67 return std::nullopt;

68 return I->second;

69 }

70 std::optional

72 unsigned tag) const override {

73 assert("" == buildAttributeSubsectionName &&

74 "buildAttributeSubsectionName must be an empty string");

76 }

78 auto I = attributesStr.find(tag);

79 if (I == attributesStr.end())

80 return std::nullopt;

81 return I->second;

82 }

83 std::optional

85 unsigned tag) const override {

86 assert("" == buildAttributeSubsectionName &&

87 "buildAttributeSubsectionName must be an empty string");

89 }

90};

91

92}

93#endif

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

static llvm::Error parse(DataExtractor &Data, uint64_t BaseAddr, LineEntryCallback const &Callback)

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

~ELFCompactAttrParser() override

Definition ELFAttrParserCompact.h:52

DataExtractor de

Definition ELFAttrParserCompact.h:36

std::optional< StringRef > getAttributeString(unsigned tag) const override

Definition ELFAttrParserCompact.h:77

ELFCompactAttrParser(ScopedPrinter *sw, TagNameMap tagNameMap, StringRef vendor)

Definition ELFAttrParserCompact.h:56

ELFCompactAttrParser(TagNameMap tagNameMap, StringRef vendor)

Definition ELFAttrParserCompact.h:59

void setAttributeString(unsigned tag, StringRef value)

Definition ELFAttrParserCompact.h:47

std::optional< StringRef > getAttributeString(StringRef buildAttributeSubsectionName, unsigned tag) const override

Definition ELFAttrParserCompact.h:84

std::optional< unsigned > getAttributeValue(StringRef buildAttributeSubsectionName, unsigned tag) const override

Definition ELFAttrParserCompact.h:71

TagNameMap tagToStringMap

Definition ELFAttrParserCompact.h:35

std::optional< unsigned > getAttributeValue(unsigned tag) const override

Definition ELFAttrParserCompact.h:64

DataExtractor::Cursor cursor

Definition ELFAttrParserCompact.h:37

ScopedPrinter * sw

Definition ELFAttrParserCompact.h:34

Lightweight error class with error context and mandatory checking.

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

StringRef - Represent a constant reference to a string, i.e.

This is an optimization pass for GlobalISel generic memory operations.

ArrayRef< TagNameItem > TagNameMap