Go to the documentation of this file.
27 uint64_t value = de.getULEB128(cursor);
28 if (value >= strings.
size()) {
29 printAttribute(tag, value,
"");
32 " value: " +
Twine(value));
34 printAttribute(tag, value, strings[value]);
41 uint64_t value = de.getULEB128(cursor);
46 sw->printNumber(
"Tag", tag);
48 sw->printString(
"TagName", tagName);
49 sw->printNumber(
"Value", value);
58 attributesStr.insert(std::make_pair(tag, desc));
62 sw->printNumber(
"Tag", tag);
64 sw->printString(
"TagName", tagName);
65 sw->printString(
"Value", desc);
78 sw->printNumber(
"Tag", tag);
79 sw->printNumber(
"Value", value);
81 sw->printString(
"TagName", tagName);
82 if (!valueDesc.
empty())
83 sw->printString(
"Description", valueDesc);
89 uint64_t value = de.getULEB128(cursor);
90 if (!cursor || !value)
92 indexList.push_back(value);
98 uint64_t
end = cursor.tell() + length;
99 while ((pos = cursor.tell()) <
end) {
100 uint64_t tag = de.getULEB128(cursor);
102 if (
Error e = handler(tag, handled))
113 if (
Error e = integerAttribute(tag))
116 if (
Error e = stringAttribute(tag))
125 uint64_t
end = cursor.tell() -
sizeof(length) + length;
126 StringRef vendorName = de.getCStrRef(cursor);
128 sw->printNumber(
"SectionLength", length);
129 sw->printString(
"Vendor", vendorName);
133 if (vendorName.
lower() != vendor)
135 "unrecognized vendor-name: " + vendorName);
137 while (cursor.tell() <
end) {
139 uint8_t tag = de.getU8(cursor);
142 return cursor.takeError();
146 sw->printNumber(
"Size",
size);
150 "invalid attribute size " +
Twine(
size) +
158 scopeName =
"FileAttributes";
161 scopeName =
"SectionAttributes";
162 indexName =
"Sections";
163 parseIndexList(indicies);
166 scopeName =
"SymbolAttributes";
167 indexName =
"Symbols";
168 parseIndexList(indicies);
179 if (!indicies.empty())
180 sw->printList(indexName, indicies);
183 }
else if (
Error e = parseAttributeList(
size - 5))
191 unsigned sectionNumber = 0;
196 struct ClearCursorError {
202 uint8_t formatVersion = de.getU8(cursor);
205 "unrecognized format-version: 0x" +
206 utohexstr(formatVersion));
208 while (!de.eof(cursor)) {
209 uint32_t sectionLength = de.getU32(cursor);
211 return cursor.takeError();
214 sw->startLine() <<
"Section " << ++sectionNumber <<
" {\n";
218 if (sectionLength < 4 || cursor.tell() - 4 + sectionLength > section.
size())
220 "invalid section length " +
221 Twine(sectionLength) +
" at offset 0x" +
222 utohexstr(cursor.tell() - 4));
224 if (
Error e = parseSubsection(sectionLength))
228 sw->startLine() <<
"}\n";
232 return cursor.takeError();
compiles conv shl5 shl ret i32 or10 it would be better as
This class represents lattice values for constants.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Error parseStringAttribute(const char *name, unsigned tag, ArrayRef< const char * > strings)
void printAttribute(unsigned tag, unsigned value, StringRef valueDesc)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static ErrorSuccess success()
Create a success value.
const_iterator end(StringRef path)
Get end iterator over path.
Deduce and propagate attributes
void consumeError(Error Err)
Consume a Error without doing anything.
static void clear(coro::Shape &Shape)
static const EnumEntry< unsigned > tagNames[]
Error parseAttributeList(uint32_t length)
static Twine utohexstr(const uint64_t &Val)
LLVM_NODISCARD std::string lower() const
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.
Error parse(ArrayRef< uint8_t > section, support::endianness endian)
StringRef - Represent a constant reference to a string, i.e.
Error integerAttribute(unsigned tag)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Lightweight error class with error context and mandatory checking.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Error parseSubsection(uint32_t length)
size_t size() const
size - Get the array size.
Error stringAttribute(unsigned tag)
void parseIndexList(SmallVectorImpl< uint8_t > &indexList)
StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap, bool hasTagPrefix=true)