[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);
|
void parseIndexList(SmallVectorImpl<uint8_t> &indexList);
|
||||||
Error parseSubsection(uint32_t length);
|
Error parseSubsection(uint32_t length);
|
||||||
|
|
||||||
|
void setAttributeString(unsigned tag, StringRef value) {
|
||||||
|
attributesStr.emplace(tag, value);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~ELFAttributeParser() { static_cast<void>(!cursor.takeError()); }
|
virtual ~ELFAttributeParser() { static_cast<void>(!cursor.takeError()); }
|
||||||
Error integerAttribute(unsigned tag);
|
Error integerAttribute(unsigned tag);
|
||||||
|
|
|
@ -448,14 +448,18 @@ Error ARMAttributeParser::also_compatible_with(AttrType tag) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DictScope scope(*sw, "Attribute");
|
setAttributeString(tag, RawStringValue);
|
||||||
sw->printNumber("Tag", tag);
|
if (sw) {
|
||||||
sw->printString("TagName",
|
DictScope scope(*sw, "Attribute");
|
||||||
ELFAttrs::attrTypeAsString(tag, tagToStringMap, false));
|
sw->printNumber("Tag", tag);
|
||||||
sw->printStringEscaped("Value", RawStringValue);
|
sw->printString("TagName",
|
||||||
if (!Description.empty()) {
|
ELFAttrs::attrTypeAsString(tag, tagToStringMap, false));
|
||||||
sw->printString("Description", Description);
|
sw->printStringEscaped("Value", RawStringValue);
|
||||||
|
if (!Description.empty()) {
|
||||||
|
sw->printString("Description", Description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor.seek(FinalOffset);
|
cursor.seek(FinalOffset);
|
||||||
|
|
||||||
return returnValue ? std::move(*returnValue) : Error::success();
|
return returnValue ? std::move(*returnValue) : Error::success();
|
||||||
|
|
|
@ -53,7 +53,7 @@ Error ELFAttributeParser::stringAttribute(unsigned tag) {
|
||||||
StringRef tagName =
|
StringRef tagName =
|
||||||
ELFAttrs::attrTypeAsString(tag, tagToStringMap, /*hasTagPrefix=*/false);
|
ELFAttrs::attrTypeAsString(tag, tagToStringMap, /*hasTagPrefix=*/false);
|
||||||
StringRef desc = de.getCStrRef(cursor);
|
StringRef desc = de.getCStrRef(cursor);
|
||||||
attributesStr.insert(std::make_pair(tag, desc));
|
setAttributeString(tag, desc);
|
||||||
|
|
||||||
if (sw) {
|
if (sw) {
|
||||||
DictScope scope(*sw, "Attribute");
|
DictScope scope(*sw, "Attribute");
|
||||||
|
|
Loading…
Reference in New Issue