21using namespace ELFAttrs;
23std::optional<unsigned>
27 "use getAttributeValue overloaded version accepting Stringref, unsigned");
31std::optional<unsigned>
35 if (BuildAttrSubsectionName == SubSection.Name)
36 for (
const auto &BAItem : SubSection.Content) {
37 if (
Tag == BAItem.Tag)
38 return std::optional<unsigned>(BAItem.IntValue);
44std::optional<StringRef>
48 "use getAttributeValue overloaded version accepting Stringref, unsigned");
52std::optional<StringRef>
56 if (BuildAttrSubsectionName == SubSection.Name)
57 for (
const auto &BAItem : SubSection.Content) {
58 if (
Tag == BAItem.Tag)
59 return std::optional<StringRef>(BAItem.StringValue);
69 if (BuildAttrSubsectionName == Entry.SubsectionName)
79 unsigned SectionNumber = 0;
83 struct ClearCursorError {
109 "unrecognized format-version: 0x" +
110 utohexstr(FormatVersion));
120 if (ExtBASubsectionLength < 8 ||
124 "invalid Extended Build Attributes subsection size at offset: " +
133 if (!(0 == IsOptional || 1 == IsOptional))
136 "\ninvalid Optionality at offset " + utohexstr(
Cursor.
tell() - 4) +
137 ": " + utohexstr(IsOptional) +
" (Options are 1|0)");
138 StringRef IsOptionalStr = IsOptional ?
"optional" :
"required";
144 "\ninvalid Type at offset " +
146 utohexstr(
Type) +
" (Options are 1|0)");
150 BASubSection.
Name = VendorName;
155 Sw->
startLine() <<
"Section " << ++SectionNumber <<
" {\n";
158 Sw->
startLine() <<
"VendorName" <<
": " << VendorName
159 <<
" Optionality: " << IsOptionalStr
160 <<
" Type: " << TypeStr <<
"\n";
169 uint32_t BytesAllButAttributes = 4 + (VendorName.
size() + 1) + 1 + 1;
171 (OffsetInSection + ExtBASubsectionLength - BytesAllButAttributes)) {
180 std::string ValueStr =
"";
197 Tag, ValueInt, ValueStr);
198 BASubSection.
Content.push_back(BAItem);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
const std::vector< SubsectionAndTagToTagName > TagsNamesMap
Error parse(ArrayRef< uint8_t > Section, llvm::endianness Endian) override
std::optional< StringRef > getAttributeString(unsigned Tag) const override
DataExtractor::Cursor Cursor
StringRef getTagName(const StringRef &BuildAttrSubsectionName, const unsigned Tag)
SmallVector< BuildAttributeSubSection, 8 > SubSectionVec
std::optional< unsigned > getAttributeValue(unsigned Tag) const override
Lightweight error class with error context and mandatory checking.
virtual void printString(StringRef Value)
void indent(int Levels=1)
void unindent(int Levels=1)
virtual raw_ostream & startLine()
virtual void printNumber(StringRef Label, char Value)
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
The instances of the Type class are immutable: once they are created, they are never changed.
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
void consumeError(Error Err)
Consume a Error without doing anything.
SmallVector< BuildAttributeItem, 64 > Content