1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/include/llvm/ADT
Ahmed Bougacha 272872c802 [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).

llvm-svn: 225338
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 Use range based for loops to avoid needing to re-mention SmallPtrSet size. 2014-08-24 23:23:06 +00:00
edit_distance.h [C++11] Replace OwningPtr with std::unique_ptr in places where it doesn't break the API. 2014-04-21 09:34:48 +00:00
EquivalenceClasses.h [C++] Use 'nullptr'. 2014-04-28 04:05:08 +00:00
FoldingSet.h Add specialization of FoldingSetTrait for std::pair. 2014-06-15 14:42:25 +00:00
GraphTraits.h
Hashing.h Using llvm::sys::swapByteOrder() for the common case of byte-swapping a value in place 2014-06-14 13:18:07 +00:00
ilist_node.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
ilist.h Delete dead code. 2014-07-29 00:38:55 +00:00
ImmutableList.h
ImmutableMap.h [C++] Use 'nullptr'. 2014-04-24 06:44:33 +00:00
ImmutableSet.h [C++] Use 'nullptr'. 2014-04-24 06:44:33 +00:00
IndexedMap.h
IntEqClasses.h
IntervalMap.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00
IntrusiveRefCntPtr.h [ADT/IntrusiveRefCntPtr] Give friend access to IntrusiveRefCntPtr<X> so the relevant move constructor can access 'Obj'. 2014-09-23 06:06:43 +00:00
iterator_range.h Reformat some stuff I missed in recent previous commits 2014-10-08 23:09:42 +00:00
iterator.h [ADT] Provide some helpful static_asserts for using operations of the 2014-04-30 00:49:32 +00:00
MapVector.h Convert SmallMapVector from a class to a struct. 2015-01-05 08:55:19 +00:00
None.h
Optional.h Add an emplace(...) method to llvm::Optional<T>. 2014-10-01 02:12:35 +00:00
PackedVector.h
PointerIntPair.h
PointerUnion.h [ADT] Teach PointerUnion to support assignment directly from nullptr to 2014-04-29 00:14:27 +00:00
PostOrderIterator.h Update template specialization to reflect API changes. 2014-11-20 19:33:30 +00:00
PriorityQueue.h
SCCIterator.h SCC: Use the reference typedef 2014-04-25 20:52:08 +00:00
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 Use 'false' for a bool instead of '0' 2014-04-07 06:59:39 +00:00
STLExtras.h Fix non-variadic function_ref cases to match r221753 2014-11-12 03:28:57 +00:00
StringExtras.h ADT: Surface LowerCase argument for utohexstr 2014-07-14 21:56:54 +00:00
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 [C++11] Make use of 'nullptr' in the Support library. 2014-04-07 04:17:22 +00:00
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 IR: Add COMDATs to the IR 2014-06-27 18:19:56 +00:00
VariadicFunction.h Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created. 2014-08-27 05:25:25 +00:00