llvm.org GIT mirror llvm / 73c3a94
Add bound checks in SmallVector git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56432 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 11 years ago
1 changed file(s) with 5 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1818 #include
1919 #include
2020 #include
21 #include
2122
2223 #ifdef _MSC_VER
2324 namespace std {
115116 const_reverse_iterator rend() const { return const_reverse_iterator(begin());}
116117
117118
119 /* These asserts could be "Begin + idx < End", but there are lots of places
120 in llvm where we use &v[v.size()] instead of v.end(). */
118121 reference operator[](unsigned idx) {
122 assert (Begin + idx <= End);
119123 return Begin[idx];
120124 }
121125 const_reference operator[](unsigned idx) const {
126 assert (Begin + idx <= End);
122127 return Begin[idx];
123128 }
124129