[llvm-objcopy] Use llvm::all_of and rename the variables "Segment" to avoid confusion with the type of the same name
llvm-svn: 347123
This commit is contained in:
parent
ddfb07567d
commit
5ec95dbd74
|
@ -1540,10 +1540,10 @@ void BinaryWriter::finalize() {
|
||||||
// loading and physical addresses are intended for ROM loading.
|
// loading and physical addresses are intended for ROM loading.
|
||||||
// However, if no segment has a physical address, we'll fallback to using
|
// However, if no segment has a physical address, we'll fallback to using
|
||||||
// virtual addresses for all.
|
// virtual addresses for all.
|
||||||
if (std::all_of(std::begin(OrderedSegments), std::end(OrderedSegments),
|
if (all_of(OrderedSegments,
|
||||||
[](const Segment *Segment) { return Segment->PAddr == 0; }))
|
[](const Segment *Seg) { return Seg->PAddr == 0; }))
|
||||||
for (const auto &Segment : OrderedSegments)
|
for (Segment *Seg : OrderedSegments)
|
||||||
Segment->PAddr = Segment->VAddr;
|
Seg->PAddr = Seg->VAddr;
|
||||||
|
|
||||||
std::stable_sort(std::begin(OrderedSegments), std::end(OrderedSegments),
|
std::stable_sort(std::begin(OrderedSegments), std::end(OrderedSegments),
|
||||||
compareSegmentsByPAddr);
|
compareSegmentsByPAddr);
|
||||||
|
@ -1558,8 +1558,8 @@ void BinaryWriter::finalize() {
|
||||||
uint64_t Offset = 0;
|
uint64_t Offset = 0;
|
||||||
|
|
||||||
// Modify the first segment so that there is no gap at the start. This allows
|
// Modify the first segment so that there is no gap at the start. This allows
|
||||||
// our layout algorithm to proceed as expected while not out writing out the
|
// our layout algorithm to proceed as expected while not writing out the gap
|
||||||
// gap at the start.
|
// at the start.
|
||||||
if (!OrderedSegments.empty()) {
|
if (!OrderedSegments.empty()) {
|
||||||
auto Seg = OrderedSegments[0];
|
auto Seg = OrderedSegments[0];
|
||||||
auto Sec = Seg->firstSection();
|
auto Sec = Seg->firstSection();
|
||||||
|
|
Loading…
Reference in New Issue