summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
Commit message (Collapse)AuthorAgeFilesLines
...
* [ADT] Add basic operator overloads for arithmetic to APFloat to makeChandler Carruth2014-10-091-0/+20
| | | | | | | | | | | | code using it more readable. Also add a copySign static function that works more like the standard function by accepting the value and sign-carying value as arguments. No interesting logic here, but tests added to cover the basic API additions and make sure they do something plausible. llvm-svn: 219453
* Add return value and negative checks to MapVector::erase from r219240.Kaelyn Takata2014-10-071-1/+4
| | | | llvm-svn: 219250
* Add size_t MapVector::erase(KeyT) similar to the one in std::map.Kaelyn Takata2014-10-071-0/+5
| | | | llvm-svn: 219240
* Update test name to match changes made in r218783David Blaikie2014-10-011-1/+1
| | | | | | Addressing post commit review feedback from Justin Bogner. llvm-svn: 218821
* Add an immovable type to test Optional<T>::emplace more rigorously after ↵David Blaikie2014-10-011-5/+26
| | | | | | r218732. llvm-svn: 218783
* ADTTests/OptionalTest.cpp: Use LLVM_DELETED_FUNCTION.NAKAMURA Takumi2014-10-011-4/+4
| | | | llvm-svn: 218750
* Add an emplace(...) method to llvm::Optional<T>.Jordan Rose2014-10-011-0/+49
| | | | | | | | | | | | | This can be used for in-place initialization of non-moveable types. For compilers that don't support variadic templates, only up to four arguments are supported. We can always add more, of course, but this should be good enough until we move to a later MSVC that has full support for variadic templates. Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS. Reviewed by David Blaikie. llvm-svn: 218732
* Add getValueOr to llvm::Optional<T>.Jordan Rose2014-09-291-0/+29
| | | | | | | | | | This takes a single argument convertible to T, and - if the Optional has a value, returns the existing value, - otherwise, constructs a T from the argument and returns that. Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS. llvm-svn: 218618
* Add hsail and amdil64 to TripleMatt Arsenault2014-09-191-0/+84
| | | | llvm-svn: 218142
* Add unit test for r217454Ed Maste2014-09-151-0/+4
| | | | llvm-svn: 217786
* Add some negative (and positive) static_assert checks for ↵David Blaikie2014-08-311-0/+17
| | | | | | ArrayRef-of-pointer conversions introduced in r216709 llvm-svn: 216830
* Add a test for converting ArrayRef<T *> to ArrayRef<const T *>.Craig Topper2014-08-301-0/+10
| | | | llvm-svn: 216821
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-4/+4
| | | | | | just letting them be implicitly created. llvm-svn: 216525
* ADT: Unit test for ArrayRef::equals change in r215986Duncan P. N. Exon Smith2014-08-191-0/+4
| | | | llvm-svn: 216008
* Fix -Wsign-compare warningsDavid Blaikie2014-08-121-3/+3
| | | | llvm-svn: 215483
* APInt: Make self-move-assignment a no-op to fix stage3 clang-clReid Kleckner2014-08-121-0/+17
| | | | | | | | | | | | | | | | | | | | | | It's not clear what the semantics of a self-move should be. The consensus appears to be that a self-move should leave the object in a moved-from state, which is what our existing move assignment operator does. However, the MSVC 2013 STL will perform self-moves in some cases. In particular, when doing a std::stable_sort of an already sorted APSInt vector of an appropriate size, one of the merge steps will self-move half of the elements. We don't notice this when building with MSVC, because MSVC will not synthesize the move assignment operator for APSInt. Presumably MSVC does this because APInt, the base class, has user-declared special members that implicitly delete move special members. Instead, MSVC selects the copy-assign operator, which defends against self-assignment. Clang, on the other hand, selects the move-assign operator, and we get garbage APInts. llvm-svn: 215478
* ADT: remove MinGW32 and Cygwin OSType enumSaleem Abdulrasool2014-08-091-1/+1
| | | | | | | | | | | Remove the MinGW32 and Cygwin types from the OSType enumeration. These values are represented via environments of Windows. It is a source of confusion and needlessly clutters the code. The cost of doing this is that we must sink the check for them into the normalization code path along with the spelling. Addresses PR20592. llvm-svn: 215303
* Fix SmallDenseMap assignment operator.Andrew Trick2014-08-041-0/+5
| | | | | | Self assignment would lead to buckets of garbage, causing quadratic probing to hang. llvm-svn: 214790
* [ADT] Add a remarkbly useful little helper routine to ArrayRef forChandler Carruth2014-07-271-0/+22
| | | | | | | | | | | | | | | | checking whether the ArrayRef is equal to an explicit list of arguments. This is particularly easy to implement even without variadic templates because ArrayRef happens to be homogeneously typed. As a consequence we can use a "clever" wrapper type and default arguments to capture in a single method many arguments as well as *how many* arguments the user specified. Thanks to Dave Blaikie for helping me pull together this little helper. Suggestions for how to improve or generalize it are of course welcome. I'll be using it immediately in my follow-up patch. =D llvm-svn: 214041
* ADT: Add MapVector::remove_ifDuncan P. N. Exon Smith2014-07-151-0/+21
| | | | | | | Add a `MapVector::remove_if()` that erases items in bulk in linear time, as opposed to quadratic time for repeated calls to `MapVector::erase()`. llvm-svn: 213090
* ADT: Fix MapVector::erase()Duncan P. N. Exon Smith2014-07-151-0/+15
| | | | | | | | | | | | Actually update the changed indexes in the map portion of `MapVector` when erasing from the middle. Add a unit test that checks for this. Note that `MapVector::erase()` is a linear time operation (it was and still is). I'll commit a new method in a moment called `MapVector::remove_if()` that deletes multiple entries in linear time, which should be slightly less painful. llvm-svn: 213084
* Move the API and implementation of clang::driver::getARMCPUForMArch() to ↵Argyrios Kyrtzidis2014-07-111-0/+12
| | | | | | | | llvm::Triple::getARMCPUForArch(). Suggested by Eric Christopher. llvm-svn: 212846
* ADT: Add a drop_back() helper to ArrayRefDavid Majnemer2014-07-051-0/+7
| | | | | | | | The slice(N, M) interface is powerful but not concise when wanting to drop a few elements off of an ArrayRef, fix this by adding a drop_back method. llvm-svn: 212370
* Recommit 211309 (StringMap::insert), reverted in 211328 due to issues with ↵David Blaikie2014-06-231-2/+40
| | | | | | | | | | | | private, but non-deleted, move members. Certain versions of GCC (~4.7) couldn't handle the SFINAE on access control, but with "= delete" (hidden behind a macro for portability) this issue is worked around/addressed. Patch by Agustín Bergé llvm-svn: 211525
* Fix some -Wsign-compare fallout from changing container count member ↵David Blaikie2014-06-202-2/+2
| | | | | | functions to return unsigned instead of bool. llvm-svn: 211393
* Revert "Add StringMap::insert(pair) consistent with the standard associative ↵Rafael Espindola2014-06-201-38/+0
| | | | | | | | | | | | container concept." This reverts commit r211309. It looks like it broke some bots: http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/15563/steps/compile/logs/stdio llvm-svn: 211328
* Add StringMap::insert(pair) consistent with the standard associative ↵David Blaikie2014-06-191-0/+38
| | | | | | | | container concept. Patch by Agustín Bergé. llvm-svn: 211309
* Remove OwningPtr.h and associated testsAlp Toker2014-06-192-274/+0
| | | | | | llvm::OwningPtr is superseded by std::unique_ptr. llvm-svn: 211259
* SmallVectorTest: Make the deleted member functions private to help MSVC users.David Blaikie2014-06-111-0/+1
| | | | llvm-svn: 210665
* Convert StringMapEntry::Create to use StringRef instead of start/end ↵Craig Topper2014-06-111-3/+3
| | | | | | pointers. Simpliies all in tree call sites. No functional change. llvm-svn: 210638
* 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
* [C++11] Use 'nullptr'.Craig Topper2014-06-088-14/+14
| | | | llvm-svn: 210442
* 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
* APFloat: x - NaN needs to flip the signbit of NaN when x is a number.Stephen Canon2014-06-081-24/+24
| | | | | | Because we don't have a separate negate( ) function, 0 - NaN does double-duty as the IEEE-754 negate( ) operation, which (unlike most FP ops) *does* attach semantic meaning to the signbit of NaN. llvm-svn: 210428
* 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
* Remove use of = default/= delete as they're unsupported on MSVC2012David Blaikie2014-05-091-4/+9
| | | | llvm-svn: 208388
* Missed formattingDavid Blaikie2014-05-081-11/+11
| | | | llvm-svn: 208362
* StringMap: Move assignment and move construction.David Blaikie2014-05-081-0/+67
| | | | llvm-svn: 208361
* StringMap support for move-only values.David Blaikie2014-05-081-0/+16
| | | | llvm-svn: 208359
* 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
* [ADT] Teach PointerUnion to support assignment directly from nullptr toChandler Carruth2014-04-291-0/+6
| | | | | | clear it out. llvm-svn: 207471
* [cleanup] Add some actual positive tests for equality. This unittestChandler Carruth2014-04-281-2/+6
| | | | | | | never actually compared for equality two pointer unions that were equal. Fortunately, things seem to work. =] llvm-svn: 207468
* [cleanup] Make this test use a proper fixture rather than globals.Chandler Carruth2014-04-281-7/+6
| | | | llvm-svn: 207466
* [cleanup] Fix the whitespace in this test. Notably, correct spacingChandler Carruth2014-04-281-12/+11
| | | | | | around pointer types. llvm-svn: 207465
* SCC: Change clients to use const, NFCDuncan P. N. Exon Smith2014-04-251-1/+1
| | | | | | | | | | It's fishy to be changing the `std::vector<>` owned by the iterator, and no one actual does it, so I'm going to remove the ability in a subsequent commit. First, update the users. <rdar://problem/14292693> llvm-svn: 207252
OpenPOWER on IntegriCloud