Demote a single-use named function object to a lambda
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 16 Nov 2015 22:56:30 +0000 (22:56 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 16 Nov 2015 22:56:30 +0000 (22:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253267 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/DebugInfo/DWARF/DWARFUnit.h

index 5604b93..2d05a52 100644 (file)
@@ -53,14 +53,6 @@ protected:
 template<typename UnitType>
 class DWARFUnitSection final : public SmallVector<std::unique_ptr<UnitType>, 1>,
                                public DWARFUnitSectionBase {
 template<typename UnitType>
 class DWARFUnitSection final : public SmallVector<std::unique_ptr<UnitType>, 1>,
                                public DWARFUnitSectionBase {
-
-  struct UnitOffsetComparator {
-    bool operator()(uint32_t LHS,
-                    const std::unique_ptr<UnitType> &RHS) const {
-      return LHS < RHS->getNextUnitOffset();
-    }
-  };
-
   bool Parsed;
 
 public:
   bool Parsed;
 
 public:
@@ -73,8 +65,11 @@ public:
   typedef llvm::iterator_range<typename UnitVector::iterator> iterator_range;
 
   UnitType *getUnitForOffset(uint32_t Offset) const override {
   typedef llvm::iterator_range<typename UnitVector::iterator> iterator_range;
 
   UnitType *getUnitForOffset(uint32_t Offset) const override {
-    auto *CU = std::upper_bound(this->begin(), this->end(), Offset,
-                                UnitOffsetComparator());
+    auto *CU = std::upper_bound(
+        this->begin(), this->end(), Offset,
+        [](uint32_t LHS, const std::unique_ptr<UnitType> &RHS) {
+          return LHS < RHS->getNextUnitOffset();
+        });
     if (CU != this->end())
       return CU->get();
     return nullptr;
     if (CU != this->end())
       return CU->get();
     return nullptr;