HomePhabricator

Fix a bug in VMRange

Description

Fix a bug in VMRange

I noticed a suspicious failure:

[ RUN ] VMRange.CollectionContains
llvm/src/tools/lldb/unittests/Utility/VMRangeTest.cpp:146: Failure
Value of: VMRange::ContainsRange(collection, VMRange(0x100, 0x104))

Actual: false
Expected: true

Looking at the code, it is a very real bug:

class RangeInRangeUnaryPredicate {
public:

RangeInRangeUnaryPredicate(VMRange range) : _range(range) {} // note that _range binds to a temporary!
bool operator()(const VMRange &range) const {
  return range.Contains(_range);
}
const VMRange &_range;

};

This change fixes the bug.

Differential Revision: https://reviews.llvm.org/D50290

Details

Committed
lemoAug 3 2018, 7:15 PM
Differential Revision
D50290: Fix a bug in VMRange
Branches
Unknown
Tags
Unknown