mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
Simplify std::lower_bound with llvm::{bsearch,lower_bound}. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364006 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user