Use llvm::upper_bound (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 3 Sep 2022 18:17:38 +0000 (11:17 -0700)
committerKazu Hirata <kazu@google.com>
Sat, 3 Sep 2022 18:17:39 +0000 (11:17 -0700)
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Symbol/ArmUnwindInfo.cpp
lldb/source/Target/ThreadCollection.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

index 82b1e8e..e50c7d8 100644 (file)
@@ -2013,8 +2013,7 @@ uint32_t SymbolFilePDB::GetCompilandId(const llvm::pdb::PDBSymbolData &data) {
         auto &sec_cs = m_sec_contribs[sec];
 
         auto offset = SectionContrib->getAddressOffset();
-        auto it =
-            std::upper_bound(sec_cs.begin(), sec_cs.end(), offset, pred_upper);
+        auto it = llvm::upper_bound(sec_cs, offset, pred_upper);
 
         auto size = SectionContrib->getLength();
         sec_cs.insert(it, {offset, size, comp_id});
@@ -2039,8 +2038,7 @@ uint32_t SymbolFilePDB::GetCompilandId(const llvm::pdb::PDBSymbolData &data) {
   if (DataSection) {
     // Search by section contributions
     auto &sec_cs = m_sec_contribs[DataSection];
-    auto it =
-        std::upper_bound(sec_cs.begin(), sec_cs.end(), DataOffset, pred_upper);
+    auto it = llvm::upper_bound(sec_cs, DataOffset, pred_upper);
     if (it != sec_cs.begin()) {
       --it;
       if (DataOffset < it->Offset + it->Size)
index ae6cddf..60935a3 100644 (file)
@@ -352,8 +352,8 @@ bool ArmUnwindInfo::GetUnwindPlan(Target &target, const Address &addr,
 
 const uint8_t *
 ArmUnwindInfo::GetExceptionHandlingTableEntry(const Address &addr) {
-  auto it = std::upper_bound(m_exidx_entries.begin(), m_exidx_entries.end(),
-                             ArmExidxEntry{0, addr.GetFileAddress(), 0});
+  auto it = llvm::upper_bound(m_exidx_entries,
+                              ArmExidxEntry{0, addr.GetFileAddress(), 0});
   if (it == m_exidx_entries.begin())
     return nullptr;
   --it;
index 8c23097..45ce2fd 100644 (file)
@@ -34,10 +34,10 @@ void ThreadCollection::AddThreadSortedByIndexID(const ThreadSP &thread_sp) {
     m_threads.push_back(thread_sp);
   else {
     m_threads.insert(
-        std::upper_bound(m_threads.begin(), m_threads.end(), thread_sp,
-                         [](const ThreadSP &lhs, const ThreadSP &rhs) -> bool {
-                           return lhs->GetIndexID() < rhs->GetIndexID();
-                         }),
+        llvm::upper_bound(m_threads, thread_sp,
+                          [](const ThreadSP &lhs, const ThreadSP &rhs) -> bool {
+                            return lhs->GetIndexID() < rhs->GetIndexID();
+                          }),
         thread_sp);
   }
 }
index d80008c..7f7581a 100644 (file)
@@ -134,11 +134,11 @@ void DWARFUnitVector::addUnitsImpl(
 }
 
 DWARFUnit *DWARFUnitVector::addUnit(std::unique_ptr<DWARFUnit> Unit) {
-  auto I = std::upper_bound(begin(), end(), Unit,
-                            [](const std::unique_ptr<DWARFUnit> &LHS,
-                               const std::unique_ptr<DWARFUnit> &RHS) {
-                              return LHS->getOffset() < RHS->getOffset();
-                            });
+  auto I = llvm::upper_bound(*this, Unit,
+                             [](const std::unique_ptr<DWARFUnit> &LHS,
+                                const std::unique_ptr<DWARFUnit> &RHS) {
+                               return LHS->getOffset() < RHS->getOffset();
+                             });
   return this->insert(I, std::move(Unit))->get();
 }