mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-02 18:31:54 +00:00
Tighten up the asserts in SmallVector::operator[]().
If this causes any new assertion failures that I didn't catch in testing, the fix is usually to change "&v[0]" to "v.data()" for some SmallVector v. llvm-svn: 72221
This commit is contained in:
parent
316352b541
commit
c934b656f9
@ -121,14 +121,12 @@ public:
|
||||
const_reverse_iterator rend() const { return const_reverse_iterator(begin());}
|
||||
|
||||
|
||||
/* These asserts could be "Begin + idx < End", but there are lots of places
|
||||
in llvm where we use &v[v.size()] instead of v.end(). */
|
||||
reference operator[](unsigned idx) {
|
||||
assert (Begin + idx <= End);
|
||||
assert (Begin + idx < End);
|
||||
return Begin[idx];
|
||||
}
|
||||
const_reference operator[](unsigned idx) const {
|
||||
assert (Begin + idx <= End);
|
||||
assert (Begin + idx < End);
|
||||
return Begin[idx];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user