[Lldb-commits] [lldb] r305035 - [VMRange] Simplify a couple of member functions. NFCI.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 8 17:14:13 PDT 2017


Fair enough. I'll make this change and run the testsuite again.
I've been a little scared of pushing NFCI changes in lldb as the
testsuite doesn't seem to be consistently "green" (even without
modifications), but I'll try this one.

Thanks Zachary!

--
Davide

On Thu, Jun 8, 2017 at 4:55 PM, Zachary Turner <zturner at google.com> wrote:
> Note that even simpler would be
>
> ```
> return llvm::find_if(col, in_range_predicate) != col.end();
> ```
>
> On Thu, Jun 8, 2017 at 4:50 PM Davide Italiano via lldb-commits
> <lldb-commits at lists.llvm.org> wrote:
>>
>> Author: davide
>> Date: Thu Jun  8 18:49:56 2017
>> New Revision: 305035
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=305035&view=rev
>> Log:
>> [VMRange] Simplify a couple of member functions. NFCI.
>>
>> Modified:
>>     lldb/trunk/source/Utility/VMRange.cpp
>>
>> Modified: lldb/trunk/source/Utility/VMRange.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/VMRange.cpp?rev=305035&r1=305034&r2=305035&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Utility/VMRange.cpp (original)
>> +++ lldb/trunk/source/Utility/VMRange.cpp Thu Jun  8 18:49:56 2017
>> @@ -25,23 +25,15 @@ using namespace lldb_private;
>>  bool VMRange::ContainsValue(const VMRange::collection &coll,
>>                              lldb::addr_t value) {
>>    ValueInRangeUnaryPredicate in_range_predicate(value);
>> -  VMRange::const_iterator pos;
>>    VMRange::const_iterator end = coll.end();
>> -  pos = std::find_if(coll.begin(), end, in_range_predicate);
>> -  if (pos != end)
>> -    return true;
>> -  return false;
>> +  return std::find_if(coll.begin(), end, in_range_predicate) != end;
>>  }
>>
>>  bool VMRange::ContainsRange(const VMRange::collection &coll,
>>                              const VMRange &range) {
>>    RangeInRangeUnaryPredicate in_range_predicate(range);
>> -  VMRange::const_iterator pos;
>>    VMRange::const_iterator end = coll.end();
>> -  pos = std::find_if(coll.begin(), end, in_range_predicate);
>> -  if (pos != end)
>> -    return true;
>> -  return false;
>> +  return std::find_if(coll.begin(), end, in_range_predicate) != end;
>>  }
>>
>>  size_t VMRange::FindRangeIndexThatContainsValue(const VMRange::collection
>> &coll,
>>
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the lldb-commits mailing list