summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/STLExtrasTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [unittests] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-04-071-2/+2
| | | | | | | | | | | | | | | r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches. llvm-svn: 329475
* Add ADL support to range based <algorithm> extensionsDavid Blaikie2017-11-201-14/+52
| | | | | | | | | | | | | | | | | This adds support for ADL in the range based <algorithm> extensions (llvm::for_each etc.). Also adds the helper functions llvm::adl::begin and llvm::adl::end which wrap std::begin and std::end with ADL support. Saw this was missing from a recent llvm weekly post about adding llvm::for_each and thought I might add it. Patch by Stephen Dollberg! Differential Revision: https://reviews.llvm.org/D40006 llvm-svn: 318703
* Add llvm::for_each as a range-based extensions to <algorithm> and make use ↵Aaron Ballman2017-11-031-6/+14
| | | | | | of it in some cases where it is a more clear alternative to std::for_each. llvm-svn: 317356
* Fix sign compare warning in unit test by using an explicit unsigned literal ↵David Blaikie2017-03-131-1/+1
| | | | | | suffix llvm-svn: 297674
* [ADT] Improve the genericity of llvm::enumerate().Zachary Turner2017-03-131-7/+17
| | | | | | | | | | | | | | There were some issues in the implementation of enumerate() preventing it from being used in various contexts. These were all related to the fact that it did not supporter llvm's iterator_facade_base class. So this patch adds support for that and additionally exposes a new helper method to_vector() that will evaluate an entire range and store the results in a vector. Differential Revision: https://reviews.llvm.org/D30853 llvm-svn: 297633
* [Unittests] Fix a build failure with clang 3.8. NFCI.Davide Italiano2017-03-091-1/+1
| | | | llvm-svn: 297423
* [ADT] Add an llvm::erase_if utility to make the standard erase+remove_ifChandler Carruth2016-12-261-0/+11
| | | | | | | | pattern easier to write. Differential Revision: https://reviews.llvm.org/D28120 llvm-svn: 290555
* [ADT] Add a boring std::partition wrapper similar to our std::remove_ifChandler Carruth2016-12-261-0/+21
| | | | | | wrapper. llvm-svn: 290553
* [ADT] Add a generic concatenating iterator and range (take 2).Chandler Carruth2016-12-251-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | This recommits r290512 that was reverted when MSVC failed to compile it. Since then I've played with various approaches using rextester.com (where I was able to reproduce the failure) and think that I have a solution thanks in part to the help of Dave Blaikie! It seems MSVC just has a defective `decltype` in this version. Manually writing out the type seems to do the trick, even though it is .... quite complicated. Original commit message: This allows both defining convenience iterator/range accessors on types which walk across N different independent ranges within the object, and more direct and simple usages with range based for loops such as shown in the unittest. The same facilities are used for both. They end up quite small and simple as it happens. I've also switched an iterator on `Module` to use this. I would like to add another convenience iterator that includes even more sequences as part of it and seeing this one already present motivated me to actually abstract it away and introduce a general utility. Differential Revision: https://reviews.llvm.org/D28093 llvm-svn: 290528
* Revert r290512: [ADT] Add a generic concatenating iterator and range.Chandler Carruth2016-12-251-23/+0
| | | | | | | | This code doesn't work on MSVC for reasons that elude me and I've not yet covinced a workaround to compile cleanly so reverting for now while I play with it. llvm-svn: 290513
* [ADT] Add a generic concatenating iterator and range.Chandler Carruth2016-12-251-0/+23
| | | | | | | | | | | | | | | | | This allows both defining convenience iterator/range accessors on types which walk across N different independent ranges within the object, and more direct and simple usages with range based for loops such as shown in the unittest. The same facilities are used for both. They end up quite small and simple as it happens. I've also switched an iterator on `Module` to use this. I would like to add another convenience iterator that includes even more sequences as part of it and seeing this one already present motivated me to actually abstract it away and introduce a general utility. Differential Revision: https://reviews.llvm.org/D28093 llvm-svn: 290512
* [stl-extras] Provide an adaptor of std::count for ranges.Michael Gottesman2016-12-041-0/+17
| | | | llvm-svn: 288619
* [unittests] STLExtrasTest: Remove an MSVC 2013 workaround, NFCI.Vedant Kumar2016-10-251-2/+1
| | | | | | Let's see what the bots have to say about this... llvm-svn: 285091
* Rename llvm::apply -> llvm::apply_tuple.Zachary Turner2016-10-101-3/+3
| | | | | | | | | | | llvm::cl already has a function called llvm::apply() so this is causing an ODR violation. The STLExtras version should win the vote on which one gets to be called apply() since it is named after the equivalent STL function, but since renaiming the cl version is more difficult, let's do this for now to get the bots green. llvm-svn: 283800
* Add llvm::apply to STLExtras.Zachary Turner2016-10-101-0/+45
| | | | | | | | | This is equivalent to the C++14 std::apply(). Since we are not using C++14 yet, this allows us to still make use of apply anyway. Differential revision: https://reviews.llvm.org/D25100 llvm-svn: 283779
* Remove extra semicolonReid Kleckner2016-10-051-1/+1
| | | | llvm-svn: 283395
* Fix the build with MSVC 2013, still cannot default move ctors yetReid Kleckner2016-10-051-1/+2
| | | | | | Ten days. llvm-svn: 283394
* Fix build due to comparison of std::pairs.Zachary Turner2016-10-051-16/+20
| | | | llvm-svn: 283342
* Add llvm::enumerate() range adapter.Zachary Turner2016-10-051-27/+128
| | | | | | | | | This allows you to enumerate over a range using a range-based for while the return type contains the index of the enumeration. Differential revision: https://reviews.llvm.org/D25124 llvm-svn: 283337
* Resubmit "Add llvm::enumerate() to STLExtras."Zachary Turner2016-09-301-0/+49
| | | | | | | | The CL was originally failing due to the use of some C++14 specific features, so I've removed those. Hopefully this will satisfy the bots. llvm-svn: 282867
* Revert "Add llvm::enumerate() to STLExtras."Zachary Turner2016-09-291-49/+0
| | | | | | | This reverts commit r282804 as it seems to use some C++ features that not all compilers support. llvm-svn: 282809
* Add llvm::enumerate() to STLExtras.Zachary Turner2016-09-291-0/+49
| | | | | | | | | enumerate allows you to iterate over a range by pairing the iterator's value with its index in the enumeration. This gives you most of the benefits of using a for loop while still allowing the range syntax. llvm-svn: 282804
* [ADT] Add the worlds simplest STL extra. Or at least close to it.Chandler Carruth2016-08-191-0/+40
This is a little class template that just builds an inheritance chain of empty classes. Despite how simple this is, it can be used to really nicely create ranked overload sets. I've added a unittest as much to document this as test it. You can pass an object of this type as an argument to a function overload set an it will call the first viable and enabled candidate at or below the rank of the object. I'm planning to use this in a subsequent commit to more clearly rank overload candidates used for SFINAE. All credit for this technique and both lines of code here to Richard Smith who was helping me rewrite the SFINAE check in question to much more effectively capture the intended set of checks. llvm-svn: 279197
OpenPOWER on IntegriCloud