[DWARF] NFC: DWARFDataExtractor combines relocs with DataExtractor.
Requires callers to directly associate relocations with a DataExtractor
used to read data from a DWARF section, which helps a callee not make
assumptions about which section it is reading.
This is the next step in reducing DWARFFormValue's dependence on DWARFUnit.
Differential Revision: https://reviews.llvm.org/D34704
llvm-svn: 306699
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
index 0075ef1..83a7792 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -275,7 +275,7 @@
FC == FC_SectionOffset;
}
-bool DWARFFormValue::extractValue(const DataExtractor &Data,
+bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data,
uint32_t *OffsetPtr, const DWARFUnit *CU) {
U = CU;
bool Indirect = false;
@@ -290,10 +290,9 @@
case DW_FORM_ref_addr: {
if (!U)
return false;
- uint16_t AddrSize = (Form == DW_FORM_addr) ? U->getAddressByteSize()
- : U->getRefAddrByteSize();
- Value.uval = getRelocatedValue(Data, AddrSize, OffsetPtr,
- U->getRelocMap(), &Value.SectionIndex);
+ uint16_t Size = (Form == DW_FORM_addr) ? U->getAddressByteSize()
+ : U->getRefAddrByteSize();
+ Value.uval = Data.getRelocatedValue(Size, OffsetPtr, &Value.SectionIndex);
break;
}
case DW_FORM_exprloc:
@@ -333,11 +332,9 @@
case DW_FORM_ref4:
case DW_FORM_ref_sup4:
case DW_FORM_strx4:
- case DW_FORM_addrx4: {
- const RelocAddrMap *RelocMap = U ? U->getRelocMap() : nullptr;
- Value.uval = getRelocatedValue(Data, 4, OffsetPtr, RelocMap);
+ case DW_FORM_addrx4:
+ Value.uval = Data.getRelocatedValue(4, OffsetPtr);
break;
- }
case DW_FORM_data8:
case DW_FORM_ref8:
case DW_FORM_ref_sup8:
@@ -365,8 +362,8 @@
case DW_FORM_strp_sup: {
if (!U)
return false;
- Value.uval = getRelocatedValue(Data, U->getDwarfOffsetByteSize(),
- OffsetPtr, U->getRelocMap());
+ Value.uval =
+ Data.getRelocatedValue(U->getDwarfOffsetByteSize(), OffsetPtr);
break;
}
case DW_FORM_flag_present: