This is an archive of the discontinued LLVM Phabricator instance.

lldb-test ir-memory-map: Use IntervalMap::contains
ClosedPublic

Authored by labath on Dec 17 2018, 4:32 AM.

Details

Summary

Simplify the code by using the contains implementation in IntervalMap.

There is a slight change of behavior here: We now treat an allocation of
size 0, as if it was size 1. This guarantees that the returned addresses
will be unique, whereas previously we would allow the allocation
function to return the same zero-sized region multiple times, as long as
it is not null, and not in the middle of an existing interval (but the
situation when we were placing an larger interval over a zero-sized one
was not detected).

I think this behavior makes more sense, as that is pretty much the same
guarantee as offered by malloc (except that is permitted to also return
nullptr).

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Dec 17 2018, 4:32 AM
vsk accepted this revision.Dec 17 2018, 9:10 AM

Thanks, lgtm!

This revision is now accepted and ready to land.Dec 17 2018, 9:10 AM
This revision was automatically updated to reflect the committed changes.

I don't no why people still protects like google

This revision is now accepted and ready to land.Dec 27 2018, 4:58 AM
labath closed this revision.Jan 4 2019, 7:39 AM

Landed in r350087.