summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/SmallVectorTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ADT] Update SmallVectorTest.EmplaceBack tests after rL356312Fangrui Song2019-03-261-36/+42
| | | | | | | | | | | | | | | | | rL356312 changed the return type of emplace_back from void to reference. Update the tests to check the behavior. Reviewers: dblaikie Reviewed By: dblaikie Subscribers: dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59809 llvm-svn: 356980
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [ADT] Don't use __used__ attribute on struct members in unit testFrancis Ricci2017-06-121-10/+10
| | | | | | | On some compilers, __used__ can only be applied to variables or functions. llvm-svn: 305188
* [ADT] Use LLVM_ATTRIBUTE_USED instead of __attribute__ for unit testFrancis Ricci2017-06-111-5/+5
| | | | llvm-svn: 305168
* [ADT] Suppress unused attribute warning in unit testFrancis Ricci2017-06-111-5/+5
| | | | llvm-svn: 305166
* [SmallVector] Reinstate the typedefs.Davide Italiano2017-06-101-0/+3
| | | | | | | | | They're unused with recent versions of libstdc++ but older ones (e.g. libstdc++ 4.9 still requires them). Maybe we should bump the requirements on the minimum version to make GCC 7 happy, but in the meanwhile we need to live with the warning. llvm-svn: 305158
* [SmallVector] Remove unused typedefs, spotted by GCC 7. NFCI.Davide Italiano2017-06-101-3/+0
| | | | llvm-svn: 305157
* [ADT] Make iterable SmallVector template overrides more specificFrancis Ricci2017-06-091-0/+61
| | | | | | | | | | | | | | | | Summary: This prevents the iterator overrides from being selected in the case where non-iterator types are used as arguments, which is of particular importance in cases where other overrides with identical types exist. Reviewers: dblaikie, bkramer, rafael Subscribers: llvm-commits, efriedma Differential Revision: https://reviews.llvm.org/D33919 llvm-svn: 305105
* Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
* Tidy up a bit of r304516, use SmallVector::assign rather than for loopDavid Blaikie2017-06-021-0/+10
| | | | | | | | | | | | | | | | This might give a few better opportunities to optimize these to memcpy rather than loops - also a few minor cleanups (StringRef-izing, templating (to avoid std::function indirection), etc). The SmallVector::assign(iter, iter) could be improved with the use of SFINAE, but the (iter, iter) ctor and append(iter, iter) need it to and don't have it - so, workaround it for now rather than bothering with the added complexity. (also, as noted in the added FIXME, these assign ops could potentially be optimized better at least for non-trivially-copyable types) llvm-svn: 304566
* Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining ↵Duncan P. N. Exon Smith2016-04-051-11/+7
| | | | | | | | | | files; other minor fixes." This reverts commit r265454 since it broke the build. E.g.: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/ llvm-svn: 265459
* Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; ↵Eugene Zelenko2016-04-051-7/+11
| | | | | | | | | | | | other minor fixes. Some Include What You Use suggestions were used too. Use anonymous namespaces in source files. Differential revision: http://reviews.llvm.org/D18778 llvm-svn: 265454
* [ADT] C++11ify SmallVector::erase's arguments from iterator to const_iteratorDavid Blaikie2016-03-241-2/+4
| | | | llvm-svn: 264330
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-4/+1
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* SmallVector: Allow initialization and assignment from initializer_list.Benjamin Kramer2015-03-021-0/+19
| | | | | | Modeled after std::vector. llvm-svn: 231015
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-151-6/+6
| | | | | | requiring the macro. NFC; LLVM edition. llvm-svn: 229340
* SmallVector: Move emplace_back to SmallVectorImpl.Benjamin Kramer2015-02-071-0/+8
| | | | | | | This resolves the strange effect that emplace_back is only available when the type contained in the vector is not trivially copyable. llvm-svn: 228496
* [ADT] Add move operations to SmallVector<T,N> from SmallVectorImpl<T>.Lang Hames2015-01-231-6/+75
| | | | | | | | This makes it possible to move between SmallVectors of different sizes. Thanks to Dave Blaikie and Duncan Smith for patch feedback. llvm-svn: 226899
* Silencing several "multiple copy constructors" warnings from MSVC; NFC.Aaron Ballman2014-12-031-1/+0
| | | | llvm-svn: 223238
* ADT: Add SmallVector<>::emplace_back()Duncan P. N. Exon Smith2014-12-031-0/+131
| | | | llvm-svn: 223201
* SmallVectorTest: Make the deleted member functions private to help MSVC users.David Blaikie2014-06-111-0/+1
| | | | llvm-svn: 210665
* SmallVectorTest.cpp: Use LLVM_DELETED_FUNCTION.NAKAMURA Takumi2014-06-101-2/+2
| | | | llvm-svn: 210507
* SmallVector: support resize(N) with move-only typesDavid Blaikie2014-06-091-4/+30
| | | | | | | | | | | | | | | 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
* SmallVector: Improve test coverage for insert with repetitionDavid Blaikie2014-06-081-22/+18
| | | | | | | | | | | | | 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
* SmallVector: More movable improvements - don't copy elements to make space ↵David Blaikie2014-06-081-13/+86
| | | | | | | | when inserting repeated elements. Also split and improve tests a bit. llvm-svn: 210433
* SmallVector: Move, don't copy, elements to make space for an insertion.David Blaikie2014-06-081-0/+38
| | | | llvm-svn: 210432
* SmallVectorTest: Remove some more robust checks added in r210429 since they ↵David Blaikie2014-06-081-6/+0
| | | | | | | | | | | 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
* Fix some more moving-from-moved-from objects issues in SmallVectorDavid Blaikie2014-06-081-0/+18
| | | | | | | | (& 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
* Ensure SmallVector::insert doesn't overwrite the last element in the range ↵David Blaikie2014-06-081-0/+22
| | | | | | | | | | | | | | 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
* Fix a use of uninitialized memory in SmallVector's move-assignment operator.Douglas Gregor2014-04-301-9/+54
| | | | | | | | 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
* Revert "Clean up SmallString a bit"David Blaikie2014-03-091-11/+0
| | | | | | | | | 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
* Clean up SmallString a bitDavid Blaikie2014-03-091-0/+11
| | | | | | | | | | | 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
* Sort the #include lines for unittest/...Chandler Carruth2012-12-041-2/+2
| | | | llvm-svn: 169250
* Move the SmallVector unit tests to be type-parameterized so that we canChandler Carruth2012-07-301-149/+176
| | | | | | | | | | | | | | | | | | | | 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
* Bring the return value of SmallVector::insert in line with std::vector::insert.Benjamin Kramer2012-06-171-4/+30
| | | | | | | | 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
* SmallVector: return a valid iterator for the rare case of inserting an empty ↵Benjamin Kramer2012-06-171-0/+7
| | | | | | | | range into a SmallVector. Patch by Johannes Schaub! llvm-svn: 158643
* SmallVector: Don't rely on having an assignment operator around in push_back ↵Benjamin Kramer2012-04-291-0/+13
| | | | | | for POD-like types. llvm-svn: 155791
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-1/+1
| | | | llvm-svn: 135375
* Fix a subtle issue in SmallVector. The following code did not work as expected:Owen Anderson2011-07-061-21/+27
| | | | | | | | | 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
* Switch attribute macros to use 'LLVM_' as a prefix. We retain the old namesChandler Carruth2010-10-231-1/+1
| | | | | | until other LLVM projects using these are cleaned up. llvm-svn: 117200
* Silence 'unused' warning.Bill Wendling2010-08-191-1/+3
| | | | llvm-svn: 111539
* Fix SmallVector's insert to handle non-random-access iterators.Dan Gohman2010-03-261-0/+6
| | | | llvm-svn: 99633
* Make this test more lenient; with SmallVector now using actuallyDan Gohman2010-03-181-1/+1
| | | | | | | aligned storage, the capacity may be more than what is explicitly requested. llvm-svn: 98846
* Add SmallVector::{capacity,set_size}.Daniel Dunbar2009-08-191-0/+18
| | | | | | | - 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
* Clarify a FIXME.Daniel Dunbar2009-07-121-4/+5
| | | | llvm-svn: 75422
* Use the testcase from PR2791.Owen Anderson2009-04-231-3/+3
| | | | llvm-svn: 69846
* Fix naming of file.Bill Wendling2009-01-111-1/+1
| | | | llvm-svn: 62035
* Adding unittests for SmallVector. Test by Talin.Bill Wendling2009-01-101-0/+383
llvm-svn: 62025
OpenPOWER on IntegriCloud