llvm-6502/include/llvm/ADT
Ahmed Bougacha 8a19eb2a85 [ADT][SmallVector] Flip an assert comparison to avoid overflows yielding false-negatives. NFC.
r221973 changed SmallVector::operator[] to use size_t instead of unsigned.

Before that, on 64bit platforms, when a large index (say -1) was passed,
truncating it to unsigned avoided an overflow when computing 'begin() + idx',
and failed the range checking assertion, as expected.
With r221973, idx isn't truncated, so the addition wraps to
'(char*)begin() - 1', and doesn't fire anymore when it should have done so.

This commit changes the comparison to instead compute 'end() - begin()'
(i.e., 'size()'), which avoids potentially overflowing additions, and
correctly triggers the assertion when values such as -1 are passed.
Note that the problem already existed before that revision, on platforms
where sizeof(size_t) == sizeof(unsigned).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225338 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 02:42:01 +00:00
..
APFloat.h [ADT] Add an (ADL-friendly) abs free function for APFloat that returns 2014-10-10 08:27:22 +00:00
APInt.h Reapply "LLVMContext: Store APInt/APFloat directly into the ConstantInt/FP DenseMaps." 2014-12-06 13:12:56 +00:00
APSInt.h APSInt: Simplify code to reduce the number of copies. No functionality change. 2014-10-12 15:36:31 +00:00
ArrayRef.h Revert r225053: Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ArrayRef<T*> where T is a base of U. 2015-01-01 13:01:25 +00:00
BitVector.h Silence more static analyzer warnings. 2014-12-15 18:48:43 +00:00
DAGDeltaAlgorithm.h
DeltaAlgorithm.h
DenseMap.h Make the DenseMap bucket type configurable and use a smaller bucket for DenseSet. 2014-12-06 19:22:44 +00:00
DenseMapInfo.h
DenseSet.h Make the DenseMap bucket type configurable and use a smaller bucket for DenseSet. 2014-12-06 19:22:44 +00:00
DepthFirstIterator.h
edit_distance.h
EquivalenceClasses.h
FoldingSet.h
GraphTraits.h
Hashing.h
ilist_node.h
ilist.h
ImmutableList.h
ImmutableMap.h
ImmutableSet.h
IndexedMap.h
IntEqClasses.h
IntervalMap.h
IntrusiveRefCntPtr.h
iterator_range.h Reformat some stuff I missed in recent previous commits 2014-10-08 23:09:42 +00:00
iterator.h
MapVector.h Convert SmallMapVector from a class to a struct. 2015-01-05 08:55:19 +00:00
None.h
Optional.h
PackedVector.h
PointerIntPair.h
PointerUnion.h
PostOrderIterator.h Update template specialization to reflect API changes. 2014-11-20 19:33:30 +00:00
PriorityQueue.h
SCCIterator.h
ScopedHashTable.h Prune CRLF. 2014-10-27 12:37:26 +00:00
SetOperations.h
SetVector.h Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
SmallBitVector.h Silencing a *lot* of -Wsign-compare warnings; NFC. 2014-12-13 16:53:15 +00:00
SmallPtrSet.h Update SmallPtrSet::insert's doc comment to match the new return type 2014-12-19 21:45:11 +00:00
SmallSet.h Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
SmallString.h
SmallVector.h [ADT][SmallVector] Flip an assert comparison to avoid overflows yielding false-negatives. NFC. 2015-01-07 02:42:01 +00:00
SparseBitVector.h Prune CRLF. 2014-10-27 12:37:26 +00:00
SparseMultiSet.h Prune CRLF. 2014-10-27 12:37:26 +00:00
SparseSet.h Prune CRLF. 2014-10-27 12:37:26 +00:00
Statistic.h
STLExtras.h Fix non-variadic function_ref cases to match r221753 2014-11-12 03:28:57 +00:00
StringExtras.h
StringMap.h ADT: Remove GetStringMapEntryFromValue() 2014-12-05 01:41:36 +00:00
StringRef.h Bitcode: Use unsigned char to record MDStrings 2014-12-11 23:34:30 +00:00
StringSet.h Make StringSet::insert return pair<iterator, bool> like other self-associative containers 2014-11-19 02:56:00 +00:00
StringSwitch.h
TinyPtrVector.h Add 2x constructors for TinyPtrVector, one that takes in one elemenet and the other that takes in an ArrayRef<EltTy> 2014-12-31 23:33:24 +00:00
Triple.h Triple: Add amdgcn triple 2015-01-06 18:00:00 +00:00
Twine.h Use a typed enum instead of 'unsigned char' for packed field. NFC. 2014-12-02 23:34:23 +00:00
UniqueVector.h
VariadicFunction.h