summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/RangeAdapterTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* 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
* Reapply "ADT: Remove references in has_rbegin for reverse()"Duncan P. N. Exon Smith2016-08-181-9/+67
| | | | | | | | | | | | | | | | | | | | | | | This reverts commit r279086, reapplying r279084. I'm not sure what I ran before, because the compile failure for ADTTests reproduced locally. The problem is that TestRev is calling BidirectionalVector::rbegin() when the BidirectionalVector is const, but rbegin() is always non-const. I've updated BidirectionalVector::rbegin() to be callable from const. Original commit message follows. -- As a follow-up to r278991, add some tests that check that decltype(reverse(R).begin()) == decltype(R.rbegin()), and get them passing by adding std::remove_reference to has_rbegin. I'm using static_assert instead of EXPECT_TRUE (and updated the other has_rbegin check from r278991 in the same way) since I figure that's more helpful. llvm-svn: 279091
* Revert "ADT: Remove references in has_rbegin for reverse()"Duncan P. N. Exon Smith2016-08-181-62/+4
| | | | | | | This reverts commit r279084, since it failed on a bot: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/41733 llvm-svn: 279086
* ADT: Remove references in has_rbegin for reverse()Duncan P. N. Exon Smith2016-08-181-4/+62
| | | | | | | | | | | | As a follow-up to r278991, add some tests that check that decltype(reverse(R).begin()) == decltype(R.rbegin()), and get them passing by adding std::remove_reference to has_rbegin. I'm using static_assert instead of EXPECT_TRUE (and updated the other has_rbegin check from r278991 in the same way) since I figure that's more helpful. llvm-svn: 279084
* Actually enable new test for const RangeAdapter. Missing from r278991Pete Cooper2016-08-171-1/+2
| | | | llvm-svn: 279000
* Fix reverse to work on const rbegin()/rend().Pete Cooper2016-08-171-0/+30
| | | | | | | | | | | | Duncan found that reverse worked on mutable rbegin(), but the has_rbegin trait didn't work with a const method. See http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160815/382890.html for more details. Turns out this was already solved in clang with has_getDecl. Copied that and made it work for rbegin. This includes the tests Duncan attached to that thread, including the traits test. llvm-svn: 278991
* Reapply "Add reverse(ContainerTy) range adapter."Pete Cooper2015-07-291-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit r243567, which ultimately reapplies r243563. The fix here was to use std::enable_if for overload resolution. Thanks to David Blaikie for lots of help on this, and for the extra tests! Original commit message follows: For cases where we needed a foreach loop in reverse over a container, we had to do something like for (const GlobalValue *GV : make_range(TypeInfos.rbegin(), TypeInfos.rend())) { This provides a convenience method which shortens this to for (const GlobalValue *GV : reverse(TypeInfos)) { There are 2 versions of this, with a preference to the rbegin() version. The first uses rbegin() and rend() to construct an iterator_range. The second constructs an iterator_range from the begin() and end() methods wrapped in std::reverse_iterator's. Reviewed by David Blaikie. llvm-svn: 243581
* Revert "Add reverse(ContainerTy) range adapter."Pete Cooper2015-07-291-77/+0
| | | | | | | | | This reverts commit r243563. The GCC buildbots were extremely unhappy about this. Reverting while we discuss a better way of doing overload resolution. llvm-svn: 243567
* Add reverse(ContainerTy) range adapter.Pete Cooper2015-07-291-0/+77
For cases where we needed a foreach loop in reverse over a container, we had to do something like for (const GlobalValue *GV : make_range(TypeInfos.rbegin(), TypeInfos.rend())) { This provides a convenience method which shortens this to for (const GlobalValue *GV : reverse(TypeInfos)) { There are 2 versions of this, with a preference to the rbegin() version. The first uses rbegin() and rend() to construct an iterator_range. The second constructs an iterator_range from the begin() and end() methods wrapped in std::reverse_iterator's. Reviewed by David Blaikie. llvm-svn: 243563
OpenPOWER on IntegriCloud