[Lldb-commits] [PATCH] D50290: Fix a bug in VMRange

Leonard Mosescu via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 3 19:16:12 PDT 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338949: Fix a bug in VMRange (authored by lemo, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D50290?vs=159147&id=159156#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50290

Files:
  lldb/trunk/include/lldb/Utility/VMRange.h
  lldb/trunk/source/Utility/VMRange.cpp


Index: lldb/trunk/source/Utility/VMRange.cpp
===================================================================
--- lldb/trunk/source/Utility/VMRange.cpp
+++ lldb/trunk/source/Utility/VMRange.cpp
@@ -24,14 +24,16 @@
 
 bool VMRange::ContainsValue(const VMRange::collection &coll,
                             lldb::addr_t value) {
-  ValueInRangeUnaryPredicate in_range_predicate(value);
-  return llvm::find_if(coll, in_range_predicate) != coll.end();
+  return llvm::find_if(coll, [&](const VMRange &r) {
+           return r.Contains(value);
+         }) != coll.end();
 }
 
 bool VMRange::ContainsRange(const VMRange::collection &coll,
                             const VMRange &range) {
-  RangeInRangeUnaryPredicate in_range_predicate(range);
-  return llvm::find_if(coll, in_range_predicate) != coll.end();
+  return llvm::find_if(coll, [&](const VMRange &r) {
+           return r.Contains(range);
+         }) != coll.end();
 }
 
 void VMRange::Dump(Stream *s, lldb::addr_t offset, uint32_t addr_width) const {
Index: lldb/trunk/include/lldb/Utility/VMRange.h
===================================================================
--- lldb/trunk/include/lldb/Utility/VMRange.h
+++ lldb/trunk/include/lldb/Utility/VMRange.h
@@ -87,24 +87,6 @@
   void Dump(Stream *s, lldb::addr_t base_addr = 0,
             uint32_t addr_width = 8) const;
 
-  class ValueInRangeUnaryPredicate {
-  public:
-    ValueInRangeUnaryPredicate(lldb::addr_t value) : _value(value) {}
-    bool operator()(const VMRange &range) const {
-      return range.Contains(_value);
-    }
-    lldb::addr_t _value;
-  };
-
-  class RangeInRangeUnaryPredicate {
-  public:
-    RangeInRangeUnaryPredicate(VMRange range) : _range(range) {}
-    bool operator()(const VMRange &range) const {
-      return range.Contains(_range);
-    }
-    const VMRange &_range;
-  };
-
   static bool ContainsValue(const VMRange::collection &coll,
                             lldb::addr_t value);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50290.159156.patch
Type: text/x-patch
Size: 1960 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180804/cffc2ff1/attachment.bin>


More information about the lldb-commits mailing list