@@ -973,14 +973,15 @@ static bool shouldAdjustVA(const SectionRef &Section) {
973
973
typedef std::pair<uint64_t , char > MappingSymbolPair;
974
974
static char getMappingSymbolKind (ArrayRef<MappingSymbolPair> MappingSymbols,
975
975
uint64_t Address) {
976
- auto Sym = bsearch (MappingSymbols, [Address](const MappingSymbolPair &Val) {
977
- return Val.first > Address;
978
- });
976
+ auto It =
977
+ partition_point (MappingSymbols, [Address](const MappingSymbolPair &Val) {
978
+ return Val.first <= Address;
979
+ });
979
980
// Return zero for any address before the first mapping symbol; this means
980
981
// we should use the default disassembly mode, depending on the target.
981
- if (Sym == MappingSymbols.begin ())
982
+ if (It == MappingSymbols.begin ())
982
983
return ' \x00 ' ;
983
- return (Sym - 1 )->second ;
984
+ return (It - 1 )->second ;
984
985
}
985
986
986
987
static uint64_t
@@ -1119,9 +1120,9 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
1119
1120
error (ExportEntry.getExportRVA (RVA));
1120
1121
1121
1122
uint64_t VA = COFFObj->getImageBase () + RVA;
1122
- auto Sec = llvm::bsearch (
1123
- SectionAddresses, [VA](const std::pair<uint64_t , SectionRef> &RHS ) {
1124
- return VA < RHS. first ;
1123
+ auto Sec = partition_point (
1124
+ SectionAddresses, [VA](const std::pair<uint64_t , SectionRef> &O ) {
1125
+ return O. first <= VA ;
1125
1126
});
1126
1127
if (Sec != SectionAddresses.begin ()) {
1127
1128
--Sec;
@@ -1378,10 +1379,10 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
1378
1379
// N.B. We don't walk the relocations in the relocatable case yet.
1379
1380
auto *TargetSectionSymbols = &Symbols;
1380
1381
if (!Obj->isRelocatableObject ()) {
1381
- auto It = llvm::bsearch (
1382
+ auto It = partition_point (
1382
1383
SectionAddresses,
1383
- [=](const std::pair<uint64_t , SectionRef> &RHS ) {
1384
- return Target < RHS. first ;
1384
+ [=](const std::pair<uint64_t , SectionRef> &O ) {
1385
+ return O. first <= Target ;
1385
1386
});
1386
1387
if (It != SectionAddresses.begin ()) {
1387
1388
--It;
@@ -1394,17 +1395,17 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
1394
1395
// Find the last symbol in the section whose offset is less than
1395
1396
// or equal to the target. If there isn't a section that contains
1396
1397
// the target, find the nearest preceding absolute symbol.
1397
- auto TargetSym = llvm::bsearch (
1398
+ auto TargetSym = partition_point (
1398
1399
*TargetSectionSymbols,
1399
- [=](const std::tuple<uint64_t , StringRef, uint8_t > &RHS ) {
1400
- return Target < std::get<0 >(RHS) ;
1400
+ [=](const std::tuple<uint64_t , StringRef, uint8_t > &O ) {
1401
+ return std::get<0 >(O) <= Target ;
1401
1402
});
1402
1403
if (TargetSym == TargetSectionSymbols->begin ()) {
1403
1404
TargetSectionSymbols = &AbsoluteSymbols;
1404
- TargetSym = llvm::bsearch (
1405
+ TargetSym = partition_point (
1405
1406
AbsoluteSymbols,
1406
- [=](const std::tuple<uint64_t , StringRef, uint8_t > &RHS ) {
1407
- return Target < std::get<0 >(RHS) ;
1407
+ [=](const std::tuple<uint64_t , StringRef, uint8_t > &O ) {
1408
+ return std::get<0 >(O) <= Target ;
1408
1409
});
1409
1410
}
1410
1411
if (TargetSym != TargetSectionSymbols->begin ()) {
0 commit comments