[BOLT][DWARF] Deprecate usage of DWARFAbbreviationDeclaration::findAttribute()

Summary: Deprecate the usage of extension to LLVM API.

(cherry picked from FBD31360154)
This commit is contained in:
Maksim Panchenko 2021-10-01 21:01:05 -07:00
parent d4a0e8526a
commit 7b61cb7812
1 changed files with 7 additions and 2 deletions

View File

@ -1486,8 +1486,13 @@ void DWARFRewriter::convertToRanges(const DWARFUnit &Unit,
const DWARFAbbreviationDeclaration *Abbrev,
DebugAbbrevWriter &AbbrevWriter,
Optional<uint64_t> RangesBase) {
dwarf::Form HighPCForm = Abbrev->findAttribute(dwarf::DW_AT_high_pc)->Form;
dwarf::Form LowPCForm = Abbrev->findAttribute(dwarf::DW_AT_low_pc)->Form;
auto getAttributeForm = [&Abbrev](const dwarf::Attribute Attr) {
Optional<uint32_t> Index = Abbrev->findAttributeIndex(Attr);
assert(Index && "attribute not found");
return Abbrev->getFormByIndex(*Index);
};
dwarf::Form HighPCForm = getAttributeForm(dwarf::DW_AT_high_pc);
dwarf::Form LowPCForm = getAttributeForm(dwarf::DW_AT_low_pc);
// DW_FORM_GNU_addr_index is already variable encoding so nothing to do
// there. If HighForm is 8 bytes need to change low_pc to be variable