[lldb][NFC] Remove code duplication in InitOSO
authorFelipe de Azevedo Piovezan <fpiovezan@apple.com>
Wed, 5 Jul 2023 12:44:52 +0000 (08:44 -0400)
committerFelipe de Azevedo Piovezan <fpiovezan@apple.com>
Thu, 6 Jul 2023 12:20:31 +0000 (08:20 -0400)
commit7cea22c0be95834317c920c21839cdd4c80fbdd8
tree6271ce0172e420064915d6c4919298f40d14e2f9
parent626c789d92bc917e7db30478e9b6d4c9b567ee17
[lldb][NFC] Remove code duplication in InitOSO

Two identical loops were iterating over different ranges, leading to code
duplication. We replace this by a loop over the concatenation of the ranges.

We also use early returns to avoid deeply nested code and explicitly check for a
condition mentioned in comments.

Differential Revision: https://reviews.llvm.org/D154505
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp