24 if (value >= strings.
size()) {
28 " value: " +
Twine(value));
38 attributes.insert(std::make_pair(tag, value));
42 sw->printNumber(
"Tag", tag);
44 sw->printString(
"TagName", tagName);
45 sw->printNumber(
"Value", value);
58 sw->printNumber(
"Tag", tag);
60 sw->printString(
"TagName", tagName);
61 sw->printString(
"Value", desc);
68 attributes.insert(std::make_pair(tag, value));
74 sw->printNumber(
"Tag", tag);
75 sw->printNumber(
"Value", value);
77 sw->printString(
"TagName", tagName);
78 if (!valueDesc.
empty())
79 sw->printString(
"Description", valueDesc);
95 while ((pos =
cursor.tell()) < end) {
98 if (
Error e = handler(tag, handled))
124 sw->printNumber(
"SectionLength", length);
125 sw->printString(
"Vendor", vendorName);
132 if (vendorName.
lower() != vendor) {
137 while (
cursor.tell() < end) {
142 return cursor.takeError();
153 sw->printNumber(
"Size",
size);
157 "invalid attribute size " +
Twine(
size) +
165 scopeName =
"FileAttributes";
168 scopeName =
"SectionAttributes";
169 indexName =
"Sections";
173 scopeName =
"SymbolAttributes";
174 indexName =
"Symbols";
186 if (!indices.
empty())
187 sw->printList(indexName, indices);
198 unsigned sectionNumber = 0;
203 struct ClearCursorError {
212 "unrecognized format-version: 0x" +
218 return cursor.takeError();
221 sw->startLine() <<
"Section " << ++sectionNumber <<
" {\n";
225 if (sectionLength < 4 ||
cursor.tell() - 4 + sectionLength > section.
size())
227 "invalid section length " +
228 Twine(sectionLength) +
" at offset 0x" +
235 sw->startLine() <<
"}\n";
239 return cursor.takeError();
#define BUILD_ENUM_STRINGS(Tab)
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
void setAttributeString(unsigned tag, StringRef value)
Error integerAttribute(unsigned tag)
TagNameMap tagToStringMap
void parseIndexList(SmallVectorImpl< uint8_t > &indexList)
Error stringAttribute(unsigned tag)
Error parseAttributeList(uint32_t length)
void printAttribute(unsigned tag, unsigned value, StringRef valueDesc)
DataExtractor::Cursor cursor
Error parseSubsection(uint32_t length)
Error parse(ArrayRef< uint8_t > section, llvm::endianness endian) override
Error parseStringAttribute(const char *name, unsigned tag, ArrayRef< const char * > strings)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
LLVM_ABI std::string lower() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static Twine utohexstr(uint64_t Val)
LLVM_ABI StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap, bool hasTagPrefix=true)
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
EnumStrings(const EnumStringsStorage< T, NumStrs, N, StrLen > &) -> EnumStrings< T, NumStrs >
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.
Compile-time data representation of enum entries.