History log of /llvm-project/llvm/unittests/ADT/SmallVectorTest.cpp (Results 51 – 75 of 77)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 10467cac 10-Jun-2014 NAKAMURA Takumi <geek4civic@gmail.com>

SmallVectorTest.cpp: Use LLVM_DELETED_FUNCTION.

llvm-svn: 210507


# 669fc86e 09-Jun-2014 David Blaikie <dblaikie@gmail.com>

SmallVector: support resize(N) with move-only types

Unfortunately there's no way to elegantly do this with pre-canned
algorithms. Using a generating iterator doesn't work because you default
constru

SmallVector: support resize(N) with move-only types

Unfortunately there's no way to elegantly do this with pre-canned
algorithms. Using a generating iterator doesn't work because you default
construct for each element, then move construct into the actual slot
(bad for copy but non-movable types, and a little unneeded overhead even
in the move-only case), so just write it out manually.

This solution isn't exception safe (if one of the element's ctors calls
we don't fall back, destroy the constructed elements, and throw on -
which std::uninitialized_fill does do) but SmallVector (and LLVM) isn't
exception safe anyway.

llvm-svn: 210495

show more ...


# 1848660d 08-Jun-2014 David Blaikie <dblaikie@gmail.com>

SmallVector: Improve test coverage for insert with repetition

To test cases that involve actual repetition (> 1 elements), at least
one element before the insertion point, and some elements of the
o

SmallVector: Improve test coverage for insert with repetition

To test cases that involve actual repetition (> 1 elements), at least
one element before the insertion point, and some elements of the
original range that still fit in that range space after insertion.

Actually we need coverage for the inverse case too (where no elements
after the insertion point fit into the previously allocated space), but
this'll do for now, and I might end up rewriting bits of SmallVector to
avoid that special case anyway.

llvm-svn: 210436

show more ...


# 402cb2c9 08-Jun-2014 David Blaikie <dblaikie@gmail.com>

SmallVector: More movable improvements - don't copy elements to make space when inserting repeated elements.

Also split and improve tests a bit.

llvm-svn: 210433


# ae8a932e 08-Jun-2014 David Blaikie <dblaikie@gmail.com>

SmallVector: Move, don't copy, elements to make space for an insertion.

llvm-svn: 210432


# 8ef8b737 08-Jun-2014 David Blaikie <dblaikie@gmail.com>

SmallVectorTest: Remove some more robust checks added in r210429 since they caught some bugs I haven't fixed yet.

Specifically this caused inserting an element from a SmallVector into
itself when su

SmallVectorTest: Remove some more robust checks added in r210429 since they caught some bugs I haven't fixed yet.

Specifically this caused inserting an element from a SmallVector into
itself when such an insertion would cause a reallocation. We have code
to handle this for non-reallocating cases, but it's not robust against
reallocation.

llvm-svn: 210430

show more ...


# 40d4e34a 08-Jun-2014 David Blaikie <dblaikie@gmail.com>

Fix some more moving-from-moved-from objects issues in SmallVector

(& because it makes it easier to test, this also improves
correctness/performance slightly by moving the last element in an insert

Fix some more moving-from-moved-from objects issues in SmallVector

(& because it makes it easier to test, this also improves
correctness/performance slightly by moving the last element in an insert
operation, rather than copying it)

llvm-svn: 210429

show more ...


# 789df06f 08-Jun-2014 David Blaikie <dblaikie@gmail.com>

Ensure SmallVector::insert doesn't overwrite the last element in the range with the already-moved-from value

This would cause the last element in a range to be in a moved-from state
after an insert

Ensure SmallVector::insert doesn't overwrite the last element in the range with the already-moved-from value

This would cause the last element in a range to be in a moved-from state
after an insert at a non-end position, losing that value entirely in the
process.

Side note: move_backward is subtle. It copies [A, B) to C-1 and down.
(the fact that it decrements both the second and third iterators before
the first movement is the subtle part... kind of surprising, anyway)

llvm-svn: 210426

show more ...


Revision tags: llvmorg-3.4.2, llvmorg-3.4.2-rc1
# 8451cdff 30-Apr-2014 Douglas Gregor <dgregor@apple.com>

Fix a use of uninitialized memory in SmallVector's move-assignment operator.

When we were moving from a larger vector to a smaller one but didn't
need to re-allocate, we would move-assign over unini

Fix a use of uninitialized memory in SmallVector's move-assignment operator.

When we were moving from a larger vector to a smaller one but didn't
need to re-allocate, we would move-assign over uninitialized memory in
the target, then move-construct that same data again.

llvm-svn: 207663

show more ...


Revision tags: llvmorg-3.4.1, llvmorg-3.4.1-rc2, llvmorg-3.4.1-rc1
# 259a5a64 09-Mar-2014 David Blaikie <dblaikie@gmail.com>

Revert "Clean up SmallString a bit"

This reverts commit r203374.

Ambiguities in assign... oh well. I'm just going to revert this and
probably not try to recommit it as it's not terribly important.

Revert "Clean up SmallString a bit"

This reverts commit r203374.

Ambiguities in assign... oh well. I'm just going to revert this and
probably not try to recommit it as it's not terribly important.

llvm-svn: 203375

show more ...


# d028adf7 09-Mar-2014 David Blaikie <dblaikie@gmail.com>

Clean up SmallString a bit

Move a common utility (assign(iter, iter)) into SmallVector (some of the
others could be moved there too, but this one seemed particularly
generic) and replace repetitions

Clean up SmallString a bit

Move a common utility (assign(iter, iter)) into SmallVector (some of the
others could be moved there too, but this one seemed particularly
generic) and replace repetitions overrides with using directives.

And simplify SmallVector::assign(num, element) while I'm here rather
than thrashing these files (that cause everyone to rebuild) again.

llvm-svn: 203374

show more ...


Revision tags: llvmorg-3.4.0, llvmorg-3.4.0-rc3, llvmorg-3.4.0-rc2, llvmorg-3.4.0-rc1, llvmorg-3.3.1-rc1, llvmorg-3.3.0, llvmorg-3.3.0-rc3, llvmorg-3.3.0-rc2, llvmorg-3.3.0-rc1, llvmorg-3.2.0, llvmorg-3.2.0-rc3
# 130cec21 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com>

Sort the #include lines for unittest/...

llvm-svn: 169250


Revision tags: llvmorg-3.2.0-rc2, llvmorg-3.2.0-rc1
# 0b01261c 30-Jul-2012 Chandler Carruth <chandlerc@gmail.com>

Move the SmallVector unit tests to be type-parameterized so that we can
test more than a single instantiation of SmallVector.

Add testing for 0, 1, 2, and 4 element sized "small" buffers. These
appe

Move the SmallVector unit tests to be type-parameterized so that we can
test more than a single instantiation of SmallVector.

Add testing for 0, 1, 2, and 4 element sized "small" buffers. These
appear to be essentially untested in the unit tests until now.

Fix several tests to be robust in the face of a '0' small buffer. As
a consequence of this size buffer, the growth patterns are actually
observable in the test -- yes this means that many tests never caused
a grow to occur before. For some tests I've merely added a reserve call
to normalize behavior. For others, the growth is actually interesting,
and so I captured the fact that growth would occur and adjusted the
assertions to not assume how rapidly growth occured.

Also update the specialization for a '0' small buffer length to have all
the same interface points as the normal small vector.

llvm-svn: 161001

show more ...


# 23a9c3e0 17-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com>

Bring the return value of SmallVector::insert in line with std::vector::insert.

It always returns the iterator for the first inserted element, or the passed in
iterator if the inserted range was emp

Bring the return value of SmallVector::insert in line with std::vector::insert.

It always returns the iterator for the first inserted element, or the passed in
iterator if the inserted range was empty. Flesh out the unit test more and fix
all the cases it uncovered so far.

llvm-svn: 158645

show more ...


# 371b9b0e 17-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com>

SmallVector: return a valid iterator for the rare case of inserting an empty range into a SmallVector.

Patch by Johannes Schaub!

llvm-svn: 158643


Revision tags: llvmorg-3.1.0, llvmorg-3.1.0-rc3, llvmorg-3.1.0-rc2
# 74a12a46 29-Apr-2012 Benjamin Kramer <benny.kra@googlemail.com>

SmallVector: Don't rely on having an assignment operator around in push_back for POD-like types.

llvm-svn: 155791


Revision tags: llvmorg-3.1.0-rc1, llvmorg-3.0.0, llvmorg-3.0.0-rc4, llvmorg-3.0.0-rc3, llvmorg-3.0.0-rc2, llvmorg-3.0.0-rc1
# 229907cd 18-Jul-2011 Chris Lattner <sabre@nondot.org>

land David Blaikie's patch to de-constify Type, with a few tweaks.

llvm-svn: 135375


# 145a260f 06-Jul-2011 Owen Anderson <resistor@mac.com>

Fix a subtle issue in SmallVector. The following code did not work as expected:
vec.insert(vec.begin(), vec[3]);
The issue was that vec[3] returns a reference into the vector, which is invalidated

Fix a subtle issue in SmallVector. The following code did not work as expected:
vec.insert(vec.begin(), vec[3]);
The issue was that vec[3] returns a reference into the vector, which is invalidated when insert() memmove's the elements down to make space. The method needs to specifically detect and handle this case to correctly match std::vector's semantics.

Thanks to Howard Hinnant for clarifying the correct behavior, and explaining how std::vector solves this problem.

llvm-svn: 134554

show more ...


Revision tags: llvmorg-2.9.0, llvmorg-2.9.0-rc3, llvmorg-2.9.0-rc2, llvmorg-2.9.0-rc1
# 88c54b82 23-Oct-2010 Chandler Carruth <chandlerc@gmail.com>

Switch attribute macros to use 'LLVM_' as a prefix. We retain the old names
until other LLVM projects using these are cleaned up.

llvm-svn: 117200


Revision tags: llvmorg-2.8.0, llvmorg-2.8.0-rc3, llvmorg-2.8.0-rc2, llvmorg-2.8.0-rc1, llvmorg-2.8.0-rc0
# bfba2f17 19-Aug-2010 Bill Wendling <isanbard@gmail.com>

Silence 'unused' warning.

llvm-svn: 111539


Revision tags: llvmorg-2.7.0
# 42e77df7 26-Mar-2010 Dan Gohman <gohman@apple.com>

Fix SmallVector's insert to handle non-random-access iterators.

llvm-svn: 99633


# ed4c2eb7 18-Mar-2010 Dan Gohman <gohman@apple.com>

Make this test more lenient; with SmallVector now using actually
aligned storage, the capacity may be more than what is explicitly
requested.

llvm-svn: 98846


Revision tags: llvmorg-2.6.0
# 825e955e 19-Aug-2009 Daniel Dunbar <daniel@zuster.org>

Add SmallVector::{capacity,set_size}.
- These allow clients to make use of the extra elements in the vector which
have already been allocated, without requiring them to be value initialized.

llv

Add SmallVector::{capacity,set_size}.
- These allow clients to make use of the extra elements in the vector which
have already been allocated, without requiring them to be value initialized.

llvm-svn: 79433

show more ...


# 6d6023b5 12-Jul-2009 Daniel Dunbar <daniel@zuster.org>

Clarify a FIXME.

llvm-svn: 75422


# d4f5537c 23-Apr-2009 Owen Anderson <resistor@mac.com>

Use the testcase from PR2791.

llvm-svn: 69846


1234