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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 05:56:30 PDT 2019


Author: maskray
Date: Wed Aug 14 05:56:30 2019
New Revision: 368845

URL: http://llvm.org/viewvc/llvm-project?rev=368845&view=rev
Log:
[ELF] --gdb-index: fix odd variable name cUs after r365730 and replace lower_bound with partition_point. NFC

Modified:
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=368845&r1=368844&r2=368845&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Wed Aug 14 05:56:30 2019
@@ -2508,7 +2508,7 @@ readAddressAreas(DWARFContext &dwarf, In
 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<E
       // 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});




More information about the llvm-commits mailing list