mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[DWARF] Fix DWARFVerifier::DieRangeInfo::intersects
It was incorrect if RHS had more than 1 ranges and one of the ranges interacted with *this llvm-svn: 358376
This commit is contained in:
parent
fcb8e51b60
commit
97fd701ef4
@ -85,23 +85,16 @@ bool DWARFVerifier::DieRangeInfo::contains(const DieRangeInfo &RHS) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DWARFVerifier::DieRangeInfo::intersects(const DieRangeInfo &RHS) const {
|
bool DWARFVerifier::DieRangeInfo::intersects(const DieRangeInfo &RHS) const {
|
||||||
if (Ranges.empty() || RHS.Ranges.empty())
|
auto I1 = Ranges.begin(), E1 = Ranges.end();
|
||||||
return false;
|
auto I2 = RHS.Ranges.begin(), E2 = RHS.Ranges.end();
|
||||||
|
while (I1 != E1 && I2 != E2) {
|
||||||
auto End = Ranges.end();
|
if (I1->intersects(*I2))
|
||||||
auto Iter = findRange(RHS.Ranges.front());
|
return true;
|
||||||
for (const auto &R : RHS.Ranges) {
|
if (I1->LowPC < I2->LowPC)
|
||||||
if (Iter == End)
|
++I1;
|
||||||
return false;
|
else
|
||||||
if (R.HighPC <= Iter->LowPC)
|
++I2;
|
||||||
continue;
|
|
||||||
while (Iter != End) {
|
|
||||||
if (Iter->intersects(R))
|
|
||||||
return true;
|
|
||||||
++Iter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3188,6 +3188,9 @@ TEST(DWARFDebugInfo, TestDWARFDieRangeInfoIntersects) {
|
|||||||
AssertRangesIntersect(Ranges, {{0x3f, 0x40}});
|
AssertRangesIntersect(Ranges, {{0x3f, 0x40}});
|
||||||
// Test range that starts at end of second range
|
// Test range that starts at end of second range
|
||||||
AssertRangesDontIntersect(Ranges, {{0x40, 0x41}});
|
AssertRangesDontIntersect(Ranges, {{0x40, 0x41}});
|
||||||
|
|
||||||
|
AssertRangesDontIntersect(Ranges, {{0x20, 0x21}, {0x2f, 0x30}});
|
||||||
|
AssertRangesIntersect(Ranges, {{0x20, 0x21}, {0x2f, 0x31}});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
Loading…
x
Reference in New Issue
Block a user