diff options
author | Alexey Samsonov <samsonov@google.com> | 2014-03-13 07:52:54 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2014-03-13 07:52:54 +0000 |
commit | 1eabf98b3277cc44e0263c05155791cfe6d2c221 (patch) | |
tree | d97ef3fcb847e9b97c5384e116b1a4af20eecdf3 /llvm/lib/DebugInfo/DWARFDebugAranges.cpp | |
parent | aae4dc21ea12d91a2687923755a6eb80dba5f2da (diff) | |
download | bcm5719-llvm-1eabf98b3277cc44e0263c05155791cfe6d2c221.tar.gz bcm5719-llvm-1eabf98b3277cc44e0263c05155791cfe6d2c221.zip |
[C++11] Convert DWARF parser to range-based for loops
llvm-svn: 203766
Diffstat (limited to 'llvm/lib/DebugInfo/DWARFDebugAranges.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugAranges.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/llvm/lib/DebugInfo/DWARFDebugAranges.cpp b/llvm/lib/DebugInfo/DWARFDebugAranges.cpp index 591d4bde712..dfab7886b57 100644 --- a/llvm/lib/DebugInfo/DWARFDebugAranges.cpp +++ b/llvm/lib/DebugInfo/DWARFDebugAranges.cpp @@ -33,15 +33,12 @@ void DWARFDebugAranges::extract(DataExtractor DebugArangesData) { return; Aranges.reserve(TotalRanges); - for (RangeSetColl::const_iterator I = Sets.begin(), E = Sets.end(); I != E; - ++I) { - uint32_t CUOffset = I->getCompileUnitDIEOffset(); - - for (uint32_t i = 0, n = I->getNumDescriptors(); i < n; ++i) { - const DWARFDebugArangeSet::Descriptor *ArangeDescPtr = - I->getDescriptor(i); - uint64_t LowPC = ArangeDescPtr->Address; - uint64_t HighPC = LowPC + ArangeDescPtr->Length; + for (const auto &I : Sets) { + uint32_t CUOffset = I.getCompileUnitDIEOffset(); + + for (const auto &Desc : I.descriptors()) { + uint64_t LowPC = Desc.Address; + uint64_t HighPC = Desc.getEndAddress(); appendRange(CUOffset, LowPC, HighPC); } } @@ -59,12 +56,10 @@ void DWARFDebugAranges::generate(DWARFContext *CTX) { // Generate aranges from DIEs: even if .debug_aranges section is present, // it may describe only a small subset of compilation units, so we need to // manually build aranges for the rest of them. - for (uint32_t i = 0, n = CTX->getNumCompileUnits(); i < n; ++i) { - if (DWARFCompileUnit *CU = CTX->getCompileUnitAtIndex(i)) { - uint32_t CUOffset = CU->getOffset(); - if (ParsedCUOffsets.insert(CUOffset).second) - CU->buildAddressRangeTable(this, true, CUOffset); - } + for (const auto &CU : CTX->compile_units()) { + uint32_t CUOffset = CU->getOffset(); + if (ParsedCUOffsets.insert(CUOffset).second) + CU->buildAddressRangeTable(this, true, CUOffset); } sortAndMinimize(); |