[ELF] --gdb-index: fix odd variable name cUs after r365730 and replace lower_bound with partition_point. NFC

llvm-svn: 368845
This commit is contained in:
Fangrui Song 2019-08-14 12:56:30 +00:00
parent 38fa1a9168
commit e220c67b7a
1 changed files with 6 additions and 7 deletions

View File

@ -2508,7 +2508,7 @@ readAddressAreas(DWARFContext &dwarf, InputSection *sec) {
template <class ELFT>
static std::vector<GdbIndexSection::NameAttrEntry>
readPubNamesAndTypes(const LLDDwarfObj<ELFT> &obj,
const std::vector<GdbIndexSection::CuEntry> &cUs) {
const std::vector<GdbIndexSection::CuEntry> &cus) {
const DWARFSection &pubNames = obj.getGnuPubnamesSection();
const DWARFSection &pubTypes = obj.getGnuPubtypesSection();
@ -2520,12 +2520,11 @@ readPubNamesAndTypes(const LLDDwarfObj<ELFT> &obj,
// don't know how many compilation units precede this object to compute
// cuIndex, we compute (kind << 24 | cuIndexInThisObject) instead, and add
// the number of preceding compilation units later.
uint32_t i =
lower_bound(cUs, set.Offset,
[](GdbIndexSection::CuEntry cu, uint32_t offset) {
return cu.cuOffset < offset;
}) -
cUs.begin();
uint32_t i = llvm::partition_point(cus,
[&](GdbIndexSection::CuEntry cu) {
return cu.cuOffset < set.Offset;
}) -
cus.begin();
for (const DWARFDebugPubTable::Entry &ent : set.Entries)
ret.push_back({{ent.Name, computeGdbHash(ent.Name)},
(ent.Descriptor.toBits() << 24) | i});