Skip to content

Commit 9ffe3e2

Browse files
author
Alex B
committed
Address Feedback Nr.2
1 parent 8f4b2cd commit 9ffe3e2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lld/MachO/MapFile.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,15 @@ void macho::writeMapFile() {
220220
// array.
221221
auto printIsecArrSyms = [&](ArrayRef<ConcatInputSection *> arr1,
222222
ArrayRef<ConcatInputSection *> arr2 = {}) {
223-
size_t i = 0, j = 0;
224-
size_t size1 = arr1.size();
225-
size_t size2 = arr2.size();
226-
while (i < size1 || j < size2) {
227-
if (i < size1 &&
228-
(j >= size2 || arr1[i]->outSecOff <= arr2[j]->outSecOff)) {
229-
printOne(arr1[i++]);
230-
} else if (j < size2) {
231-
printOne(arr2[j++]);
223+
// Print both arrays in sorted order, interleaving as necessary.
224+
while (!arr1.empty() || !arr2.empty()) {
225+
if (!arr1.empty() && (arr2.empty() || arr1.front()->outSecOff <=
226+
arr2.front()->outSecOff)) {
227+
printOne(arr1.front());
228+
arr1 = arr1.drop_front();
229+
} else if (!arr2.empty()) {
230+
printOne(arr2.front());
231+
arr2 = arr2.drop_front();
232232
}
233233
}
234234
};

0 commit comments

Comments
 (0)