diff options
author | Fangrui Song <maskray@google.com> | 2019-06-21 05:40:31 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-06-21 05:40:31 +0000 |
commit | dc8de6037c3aceb9663c7433bb09584fa8571032 (patch) | |
tree | acb49acaa3d1a0428951451a091fcb4d0c79a464 /llvm/lib/TextAPI/MachO/InterfaceFile.cpp | |
parent | d5e1ce3f44b0bef1eadbef9828b87a8918a82669 (diff) | |
download | bcm5719-llvm-dc8de6037c3aceb9663c7433bb09584fa8571032.tar.gz bcm5719-llvm-dc8de6037c3aceb9663c7433bb09584fa8571032.zip |
Simplify std::lower_bound with llvm::{bsearch,lower_bound}. NFC
llvm-svn: 364006
Diffstat (limited to 'llvm/lib/TextAPI/MachO/InterfaceFile.cpp')
-rw-r--r-- | llvm/lib/TextAPI/MachO/InterfaceFile.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/TextAPI/MachO/InterfaceFile.cpp b/llvm/lib/TextAPI/MachO/InterfaceFile.cpp index 323f1b61fcd..f1851014e70 100644 --- a/llvm/lib/TextAPI/MachO/InterfaceFile.cpp +++ b/llvm/lib/TextAPI/MachO/InterfaceFile.cpp @@ -21,11 +21,9 @@ namespace MachO { namespace detail { template <typename C> typename C::iterator addEntry(C &Container, StringRef InstallName) { - auto I = - std::lower_bound(std::begin(Container), std::end(Container), InstallName, - [](const InterfaceFileRef &LHS, const StringRef &RHS) { - return LHS.getInstallName() < RHS; - }); + auto I = llvm::bsearch(Container, [=](const InterfaceFileRef &O) { + return InstallName <= O.getInstallName(); + }); if ((I != std::end(Container)) && !(InstallName < I->getInstallName())) return I; @@ -46,11 +44,12 @@ void InterfaceFile::addReexportedLibrary(StringRef InstallName, } void InterfaceFile::addUUID(Architecture Arch, StringRef UUID) { - auto I = std::lower_bound(UUIDs.begin(), UUIDs.end(), Arch, - [](const std::pair<Architecture, std::string> &LHS, - Architecture RHS) { return LHS.first < RHS; }); + auto I = + llvm::bsearch(UUIDs, [=](const std::pair<Architecture, std::string> &O) { + return Arch <= O.first; + }); - if ((I != UUIDs.end()) && !(Arch < I->first)) { + if (I != UUIDs.end() && Arch == I->first) { I->second = UUID; return; } |