diff options
| author | Jay Foad <jay.foad@gmail.com> | 2009-05-21 19:48:58 +0000 |
|---|---|---|
| committer | Jay Foad <jay.foad@gmail.com> | 2009-05-21 19:48:58 +0000 |
| commit | acf199e4cdf0a0f3988cd4fe2a797d01ccca3412 (patch) | |
| tree | 942315ec80a020c162516c0fa6139d5337b47da4 | |
| parent | 31c7e9940192127e08b2e42c68b1edbf0031ee45 (diff) | |
| download | bcm5719-llvm-acf199e4cdf0a0f3988cd4fe2a797d01ccca3412.tar.gz bcm5719-llvm-acf199e4cdf0a0f3988cd4fe2a797d01ccca3412.zip | |
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
| -rw-r--r-- | llvm/include/llvm/ADT/SmallVector.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h index de5648fe852..f59a438d3eb 100644 --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -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]; } |

