diff options
author | Fangrui Song <maskray@google.com> | 2019-04-22 15:53:43 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-04-22 15:53:43 +0000 |
commit | a5355a5ed16c51f3d582181105e31be508087467 (patch) | |
tree | b692540c69f8d077eac8b3bc011d2b953e3d9ca8 /llvm/tools/llvm-objcopy/ELF/Object.cpp | |
parent | 4256cf1b0401acec951e36a3f58a5ad318358ef7 (diff) | |
download | llvm-a5355a5ed16c51f3d582181105e31be508087467.zip llvm-a5355a5ed16c51f3d582181105e31be508087467.tar.gz llvm-a5355a5ed16c51f3d582181105e31be508087467.tar.bz2 |
Use llvm::stable_sort. NFC
llvm-svn: 358897
Diffstat (limited to 'llvm/tools/llvm-objcopy/ELF/Object.cpp')
-rw-r--r-- | llvm/tools/llvm-objcopy/ELF/Object.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp index f5452ce..3830f92 100644 --- a/llvm/tools/llvm-objcopy/ELF/Object.cpp +++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp @@ -1468,11 +1468,9 @@ Error Object::removeSymbols(function_ref<bool(const Symbol &)> ToRemove) { void Object::sortSections() { // Put all sections in offset order. Maintain the ordering as closely as // possible while meeting that demand however. - auto CompareSections = [](const SecPtr &A, const SecPtr &B) { + llvm::stable_sort(Sections, [](const SecPtr &A, const SecPtr &B) { return A->OriginalOffset < B->OriginalOffset; - }; - std::stable_sort(std::begin(this->Sections), std::end(this->Sections), - CompareSections); + }); } static uint64_t alignToAddr(uint64_t Offset, uint64_t Addr, uint64_t Align) { @@ -1490,8 +1488,7 @@ static uint64_t alignToAddr(uint64_t Offset, uint64_t Addr, uint64_t Align) { // Orders segments such that if x = y->ParentSegment then y comes before x. static void orderSegments(std::vector<Segment *> &Segments) { - std::stable_sort(std::begin(Segments), std::end(Segments), - compareSegmentsByOffset); + llvm::stable_sort(Segments, compareSegmentsByOffset); } // This function finds a consistent layout for a list of segments starting from @@ -1746,8 +1743,7 @@ Error BinaryWriter::finalize() { for (Segment *Seg : OrderedSegments) Seg->PAddr = Seg->VAddr; - std::stable_sort(std::begin(OrderedSegments), std::end(OrderedSegments), - compareSegmentsByPAddr); + llvm::stable_sort(OrderedSegments, compareSegmentsByPAddr); // Because we add a ParentSegment for each section we might have duplicate // segments in OrderedSegments. If there were duplicates then LayoutSegments |