forked from OSchip/llvm-project
[ARM] Fix bug in also_compatible_with attribute parser
Check ScopedPrinter pointer before attempting to print the attribute's parsed information. Patch by Michael Platings and Victor Campos Reviewed By: pratlucas Differential Revision: https://reviews.llvm.org/D132214
This commit is contained in:
parent
93cf0e8a28
commit
1d66c5ebbc
|
@ -42,6 +42,10 @@ protected:
|
|||
void parseIndexList(SmallVectorImpl<uint8_t> &indexList);
|
||||
Error parseSubsection(uint32_t length);
|
||||
|
||||
void setAttributeString(unsigned tag, StringRef value) {
|
||||
attributesStr.emplace(tag, value);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~ELFAttributeParser() { static_cast<void>(!cursor.takeError()); }
|
||||
Error integerAttribute(unsigned tag);
|
||||
|
|
|
@ -448,14 +448,18 @@ Error ARMAttributeParser::also_compatible_with(AttrType tag) {
|
|||
}
|
||||
}
|
||||
|
||||
DictScope scope(*sw, "Attribute");
|
||||
sw->printNumber("Tag", tag);
|
||||
sw->printString("TagName",
|
||||
ELFAttrs::attrTypeAsString(tag, tagToStringMap, false));
|
||||
sw->printStringEscaped("Value", RawStringValue);
|
||||
if (!Description.empty()) {
|
||||
sw->printString("Description", Description);
|
||||
setAttributeString(tag, RawStringValue);
|
||||
if (sw) {
|
||||
DictScope scope(*sw, "Attribute");
|
||||
sw->printNumber("Tag", tag);
|
||||
sw->printString("TagName",
|
||||
ELFAttrs::attrTypeAsString(tag, tagToStringMap, false));
|
||||
sw->printStringEscaped("Value", RawStringValue);
|
||||
if (!Description.empty()) {
|
||||
sw->printString("Description", Description);
|
||||
}
|
||||
}
|
||||
|
||||
cursor.seek(FinalOffset);
|
||||
|
||||
return returnValue ? std::move(*returnValue) : Error::success();
|
||||
|
|
|
@ -53,7 +53,7 @@ Error ELFAttributeParser::stringAttribute(unsigned tag) {
|
|||
StringRef tagName =
|
||||
ELFAttrs::attrTypeAsString(tag, tagToStringMap, /*hasTagPrefix=*/false);
|
||||
StringRef desc = de.getCStrRef(cursor);
|
||||
attributesStr.insert(std::make_pair(tag, desc));
|
||||
setAttributeString(tag, desc);
|
||||
|
||||
if (sw) {
|
||||
DictScope scope(*sw, "Attribute");
|
||||
|
|
Loading…
Reference in New Issue