[DWARF parser] Refactor fetching DIE address ranges.

Add a helper method to get address ranges specified in a DIE
(either by DW_AT_low_pc/DW_AT_high_pc, or by DW_AT_ranges). Use it
to untangle and simplify the code.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206624 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov
2014-04-18 17:25:46 +00:00
parent 54850bedf2
commit fe030f3dcd
7 changed files with 72 additions and 64 deletions

View File

@ -58,8 +58,13 @@ void DWARFDebugAranges::generate(DWARFContext *CTX) {
// manually build aranges for the rest of them.
for (const auto &CU : CTX->compile_units()) {
uint32_t CUOffset = CU->getOffset();
if (ParsedCUOffsets.insert(CUOffset).second)
CU->buildAddressRangeTable(this, true, CUOffset);
if (ParsedCUOffsets.insert(CUOffset).second) {
DWARFAddressRangesVector CURanges;
CU->collectAddressRanges(CURanges);
for (const auto &R : CURanges) {
appendRange(CUOffset, R.first, R.second);
}
}
}
sortAndMinimize();