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 {
106 return Cursor.takeError();
109 "unrecognized format-version: 0x" +
115 return Cursor.takeError();
120 if (ExtBASubsectionLength < 8 ||
121 ExtBASubsectionLength > (
Section.size() -
Cursor.tell() + 4))
124 "invalid Extended Build Attributes subsection size at offset: " +
129 return Cursor.takeError();
132 return Cursor.takeError();
133 if (!(0 == IsOptional || 1 == IsOptional))
137 ": " +
utohexstr(IsOptional) +
" (Options are 1|0)");
138 StringRef IsOptionalStr = IsOptional ?
"optional" :
"required";
141 return Cursor.takeError();
144 "\ninvalid Type at offset " +
150 BASubSection.
Name = VendorName;
155 Sw->startLine() <<
"Section " << ++SectionNumber <<
" {\n";
157 Sw->printNumber(
"SectionLength", ExtBASubsectionLength);
158 Sw->startLine() <<
"VendorName" <<
": " << VendorName
159 <<
" Optionality: " << IsOptionalStr
160 <<
" Type: " << TypeStr <<
"\n";
161 Sw->startLine() <<
"Attributes {\n";
169 uint32_t BytesAllButAttributes = 4 + (VendorName.
size() + 1) + 1 + 1;
171 (OffsetInSection + ExtBASubsectionLength - BytesAllButAttributes)) {
175 return Cursor.takeError();
180 std::string ValueStr =
"";
184 return Cursor.takeError();
186 Sw->printString(
"" != TagName ? TagName :
utostr(
Tag), ValueStr);
190 return Cursor.takeError();
192 Sw->printNumber(
"" != TagName ? TagName :
utostr(
Tag), ValueInt);
197 Tag, ValueInt, ValueStr);
198 BASubSection.
Content.push_back(BAItem);
203 Sw->startLine() <<
"}\n";
206 Sw->startLine() <<
"}\n";
213 return Cursor.takeError();
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.
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.
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
std::string utostr(uint64_t X, bool isNeg=false)
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