[PATCH] D60813: [ELF] Use llvm::bsearch. NFC
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 17 01:00:13 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL358565: [ELF] Use llvm::bsearch. NFC (authored by MaskRay, committed by ).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60813/new/
https://reviews.llvm.org/D60813
Files:
lld/trunk/ELF/DWARF.cpp
lld/trunk/ELF/InputSection.cpp
Index: lld/trunk/ELF/DWARF.cpp
===================================================================
--- lld/trunk/ELF/DWARF.cpp
+++ lld/trunk/ELF/DWARF.cpp
@@ -81,9 +81,8 @@
Optional<RelocAddrEntry>
LLDDwarfObj<ELFT>::findAux(const InputSectionBase &Sec, uint64_t Pos,
ArrayRef<RelTy> Rels) const {
- auto It = std::lower_bound(
- Rels.begin(), Rels.end(), Pos,
- [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
+ auto It =
+ llvm::bsearch(Rels, [=](const RelTy &A) { return Pos <= A.r_offset; });
if (It == Rels.end() || It->r_offset != Pos)
return None;
const RelTy &Rel = *It;
Index: lld/trunk/ELF/InputSection.cpp
===================================================================
--- lld/trunk/ELF/InputSection.cpp
+++ lld/trunk/ELF/InputSection.cpp
@@ -1224,11 +1224,9 @@
// If Offset is not at beginning of a section piece, it is not in the map.
// In that case we need to do a binary search of the original section piece vector.
- auto It2 =
- llvm::upper_bound(Pieces, Offset, [](uint64_t Offset, SectionPiece P) {
- return Offset < P.InputOff;
- });
- return &It2[-1];
+ auto It = llvm::bsearch(Pieces,
+ [=](SectionPiece P) { return Offset < P.InputOff; });
+ return &It[-1];
}
// Returns the offset in an output section for a given input offset.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60813.195517.patch
Type: text/x-patch
Size: 1387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190417/0cf51fa7/attachment.bin>
More information about the llvm-commits
mailing list