summaryrefslogtreecommitdiffstats
path: root/include/lldb/Core/RangeMap.h
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
committeremaste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
commit8037fa4ee916fa20b3c63cbf531f4ee7e1c76138 (patch)
tree3c2e41c3be19b7fc7666ed45a5f91ec3b6e35f2a /include/lldb/Core/RangeMap.h
parentd61b076ede88b56f3372a55e7d1eac6a9d717120 (diff)
downloadFreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.zip
FreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.tar.gz
Import LLDB as of upstream SVN 241361 (git 612c075f)
Diffstat (limited to 'include/lldb/Core/RangeMap.h')
-rw-r--r--include/lldb/Core/RangeMap.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/include/lldb/Core/RangeMap.h b/include/lldb/Core/RangeMap.h
index d78504c..d2c43a5 100644
--- a/include/lldb/Core/RangeMap.h
+++ b/include/lldb/Core/RangeMap.h
@@ -128,9 +128,10 @@ namespace lldb_private {
{
return Contains(range.GetRangeBase()) && ContainsEndInclusive(range.GetRangeEnd());
}
-
+
+ // Returns true if the two ranges adjoing or intersect
bool
- Overlap (const Range &rhs) const
+ DoesAdjoinOrIntersect (const Range &rhs) const
{
const BaseType lhs_base = this->GetRangeBase();
const BaseType rhs_base = rhs.GetRangeBase();
@@ -139,7 +140,19 @@ namespace lldb_private {
bool result = (lhs_base <= rhs_end) && (lhs_end >= rhs_base);
return result;
}
-
+
+ // Returns true if the two ranges intersect
+ bool
+ DoesIntersect (const Range &rhs) const
+ {
+ const BaseType lhs_base = this->GetRangeBase();
+ const BaseType rhs_base = rhs.GetRangeBase();
+ const BaseType lhs_end = this->GetRangeEnd();
+ const BaseType rhs_end = rhs.GetRangeEnd();
+ bool result = (lhs_base < rhs_end) && (lhs_end > rhs_base);
+ return result;
+ }
+
bool
operator < (const Range &rhs) const
{
@@ -241,7 +254,7 @@ namespace lldb_private {
// don't end up allocating and making a new collection for no reason
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
- if (prev != end && prev->Overlap(*pos))
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
{
can_combine = true;
break;
@@ -255,7 +268,7 @@ namespace lldb_private {
Collection minimal_ranges;
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
- if (prev != end && prev->Overlap(*pos))
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
minimal_ranges.back().SetRangeEnd (std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
else
minimal_ranges.push_back (*pos);
@@ -521,7 +534,7 @@ namespace lldb_private {
// don't end up allocating and making a new collection for no reason
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
- if (prev != end && prev->Overlap(*pos))
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
{
can_combine = true;
break;
@@ -535,7 +548,7 @@ namespace lldb_private {
Collection minimal_ranges;
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
- if (prev != end && prev->Overlap(*pos))
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
minimal_ranges.back().SetRangeEnd (std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
else
minimal_ranges.push_back (*pos);
OpenPOWER on IntegriCloud