mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-21 02:59:15 +00:00
SmallVector::erase: Assert that iterators are actually inside the vector.
The rationale here is that it's hard to write loops containing vector erases and it only shows up if the vector contains non-trivial objects leading to crashes when forming them out of garbage memory. llvm-svn: 160854
This commit is contained in:
parent
043e2ac679
commit
29c0b4a9f7
@ -463,6 +463,7 @@ public:
|
||||
}
|
||||
|
||||
iterator erase(iterator I) {
|
||||
assert(I >= this->begin() && I < this->end() && "Iterator out of bounds");
|
||||
iterator N = I;
|
||||
// Shift all elts down one.
|
||||
this->move(I+1, this->end(), I);
|
||||
@ -472,6 +473,8 @@ public:
|
||||
}
|
||||
|
||||
iterator erase(iterator S, iterator E) {
|
||||
assert(S >= this->begin() && S <= E && E <= this->end() &&
|
||||
"Iterator range out of bounds");
|
||||
iterator N = S;
|
||||
// Shift all elts down.
|
||||
iterator I = this->move(E, this->end(), S);
|
||||
|
Loading…
Reference in New Issue
Block a user