summaryrefslogtreecommitdiffstats
path: root/libcxx/include/forward_list
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Rework compressed pair constructors.Eric Fiselier2019-12-161-1/+1
| | | | | | | | | | | | This patch de-duplicates most compressed pair constructors to use the same code in C++11 and C++03. Part of doing that is deleting the "__second_tag()" and replacing it with a "__value_init_tag()" which has the same effect, but allows for the removal of the special "one-arg" first element constructor. This patch is intended to have no semantic change.
* Rename __is_foo_iterator traits to reflect their Cpp17 nature.Eric Fiselier2019-11-181-8/+8
| | | | | | | | | With the upcoming introduction of iterator concepts in ranges, the meaning of "__is_contiguous_iterator" changes drastically. Currently we intend it to mean "does it have this iterator category", but it could now also mean "does it meet the requirements of this concept", and these can be different.
* [NFC] Strip trailing whitespace from libc++Louis Dionne2019-10-231-3/+3
|
* Make forward_list::remove/remove_if/unique all return void before C++20; ↵Marshall Clow2019-07-081-14/+21
| | | | | | undoes that bit of D58332. Thanks to Mikhail Maltsev for pointing this out llvm-svn: 365290
* Implement P0646R1: Erase-Like Algorithms Should Return size_type. Reviewed ↵Marshall Clow2019-07-011-16/+27
| | | | | | as https://reviews.llvm.org/D58332, and then updated because I rewrote a couple of those routines to eliminate some UB. Thanks to Zoe for tghe patch. llvm-svn: 364840
* Make move and forward work in C++03.Eric Fiselier2019-06-211-6/+0
| | | | | | | | | | | | | | | | | | | | | These functions are key to allowing the use of rvalues and variadics in C++03 mode. Everything works the same as in C++11, except for one tangentially related case: struct T { T(T &&) = default; }; In C++11, T has a deleted copy constructor. But in C++03 Clang gives it both a move and a copy constructor. This seems reasonable enough given the extensions it's using. The other changes in this patch were the minimal set required to keep the tests passing after the move/forward change. Most notably the removal of the `__rv<unique_ptr>` hack that was present in an attempt to make unique_ptr move only without language support. llvm-svn: 364063
* [NFC][libcxx] Remove trailing whitespaceLouis Dionne2019-05-291-3/+3
| | | | | | It's incredibly annoying when trying to create diffs llvm-svn: 361981
* Fix list/forward_list implementations of remove_if and unique to deal with ↵Marshall Clow2019-04-161-3/+5
| | | | | | predicates that are part of the sequence passed in. We already do this for remove. llvm-svn: 358534
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. 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: 351648
* Implement P1209 - Adopt Consistent Container Erasure from Library ↵Marshall Clow2018-12-141-0/+17
| | | | | | Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532 llvm-svn: 349178
* Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow2018-09-121-0/+1
| | | | | | feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
* Fix PR37694 - std::vector doesn't correctly move construct allocators.Eric Fiselier2018-06-051-8/+11
| | | | | | | | | | | | | | | | | | | C++2a[container.requirements.general]p8 states that when move constructing a container, the allocator is move constructed. Vector previously copy constructed these allocators. This patch fixes that bug. Additionally it cleans up some unnecessary allocator conversions when copy constructing containers. Libc++ uses __internal_allocator_traits::select_on_copy_construction to select the correct allocator during copy construction, but it unnecessarily converted the resulting allocator to the user specified allocator type and back. After this patch list and forward_list no longer do that. Technically we're supposed to be using allocator_traits<allocator_type>::select_on_copy_construction, but that should seemingly be addressed as a separate patch, if at all. llvm-svn: 334053
* Implement deduction guides for forward_listMarshall Clow2018-05-191-0/+22
| | | | llvm-svn: 332811
* First part of P0600 - '[[nodiscard] in the standard library'. Mark the ↵Marshall Clow2017-11-151-1/+1
| | | | | | 'empty()' methods of all the containers as nodiscard. If you're calling empty() w/o looking at the result, you probably meanto to call 'clear()'. c++2a only llvm-svn: 318269
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-3/+6
| | | | | | | | | | | | | | | | Summary: This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning. This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header. Reviewers: mclow.lists, bcraig, compnerd, EricWF Reviewed By: EricWF Subscribers: cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D33080 llvm-svn: 304357
* Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in <forward_list>Eric Fiselier2017-04-161-79/+48
| | | | llvm-svn: 300415
* Change the return type of emplace_[front|back] back to void when building ↵Marshall Clow2017-01-241-1/+11
| | | | | | with C++14 or before. Resolves PR31680. llvm-svn: 292990
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-7/+7
| | | | | | | | | | | | | The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both _LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to __attribute__((__type_visibility__)) with Clang. The only remaining difference is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas _LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on templates). This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS. llvm-svn: 291035
* Fix unused parameters and variablesEric Fiselier2016-12-231-3/+3
| | | | llvm-svn: 290459
* Fix -Wshadow warnings and enable warnings by default for C++ >= 11Eric Fiselier2016-12-031-2/+3
| | | | llvm-svn: 288564
* [libcxx] Fix max_size() across all containersEric Fiselier2016-11-231-2/+5
| | | | | | | | | | | | Summary: The `max_size()` method of containers should respect both the allocator's reported `max_size` and the range of the `difference_type`. This patch makes all containers choose the smallest of those two values. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26885 llvm-svn: 287729
* Implement P0084r2. Changing emplace return types.Eric Fiselier2016-07-211-3/+4
| | | | llvm-svn: 276230
* Cleanup: move visibility/linkage attributes to the first declaration.Evgeniy Stepanov2016-04-221-9/+16
| | | | | | http://reviews.llvm.org/D15404 llvm-svn: 267093
* Fix broken commit r258888. I missed adding two pointer conversionsEric Fiselier2016-01-271-2/+2
| | | | llvm-svn: 258893
* [libcxx] Fix undefined behavior in forward_listEric Fiselier2016-01-271-73/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is similar to the <list> fix but it has a few differences. This patch doesn't use a `__link_pointer` typedef because we don't need to change the linked list pointers because `forward_list` never stores a `__forward_begin_node` in the linked list itself. The issue with `forward_list` is that the iterators store pointers to `__forward_list_node` and not `__forward_begin_node`. This is incorrect because `before_begin()` and `cbefore_begin()` return iterators that point to a `__forward_begin_node`. This means we incorrectly downcast the `__forward_begin_node` pointer to a `__node_pointer`. This downcast itself is sometimes UB but it cannot be safely removed until ABI v2. The more common cause of UB is when we deference the downcast pointer. (for example `__ptr_->__next_`). This can be fixed without an ABI break by upcasting `__ptr_` before accessing it. The fix is as follows: 1. Introduce a `__iter_node_pointer` typedef that works similar to `__link_pointer` in the last patch. In ABI v2 it is always a typedef for `__begin_node_pointer`. 2. Change the `__before_begin()` method to return the correct pointer type (`__begin_node_pointer`), Previously it incorrectly downcasted the `__forward_begin_node` to a `__node_pointer` so it could be used to constructor the iterator types. 3. Change `__forward_list_iterator` and `__forward_list_const_iterator` in the following way: 1. Change `__node_pointer __ptr_;` member to have the `__iter_node_pointer` type instead. 2. Add additional private constructors that accept `__begin_node_pointer` in addition to `__node_pointer` and then correctly cast them to the stored `__iter_node_pointer` type. 3. Add `__get_begin()` and `__get_node_unchecked()` accessor methods that correctly cast `__ptr_` to the expected pointer type. `__get_begin()` is always safe to use and should be preferred. `__get_node_unchecked()` can only be used on a deferencible iterator. 4. Replace direct access to `__forward_list_iterator::__ptr_` with the safe accessor methods. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15836 llvm-svn: 258888
* Use __rebind_pointer to avoid #ifdef blockEric Fiselier2015-12-301-30/+6
| | | | llvm-svn: 256654
* Add static_assert to set/multiset/map/multimap/forward_list/deque that the ↵Marshall Clow2015-11-261-0/+3
| | | | | | allocator's value_type match the container's value_type. vector/unordered/list/string already do this. Add tests for all the containers to verify this. llvm-svn: 254119
* Implement the first part of N4258: 'Cleaning up noexcept in the Library'. ↵Marshall Clow2015-07-131-27/+19
| | | | | | This patch deals with swapping containers, and implements a more strict noexcept specification (a conforming extension) than the standard mandates. llvm-svn: 242056
* In many places, there was an #ifdef/#else block that selected one of two ↵Marshall Clow2015-04-071-14/+2
| | | | | | implmentations of rebind_alloc based on whether or not we had template aliases. Create a helper struct to encapsulate that bit of logic, and replace all the ifdefs with uses of that struct. No functionality change intented. llvm-svn: 234296
* Move the default template arguments into the forward declarations for the ↵Marshall Clow2015-02-181-2/+2
| | | | | | containers: deque, forwardlist and list. References PR#22605. llvm-svn: 229705
* [libcxx] Fix use of operator comma where the types can be user definedEric Fiselier2014-10-271-2/+2
| | | | | | | | | | | | | | | | Summary: An evil user might overload operator comma. Use a void cast to make sure any user overload is not selected. Modify all the test iterators to define operator comma. Reviewers: danalbert, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5929 llvm-svn: 220706
* Whitespace maintenance. Remove a bunch of tabs that snuck in. No ↵Marshall Clow2014-10-181-1/+1
| | | | | | functionality change llvm-svn: 220142
* Apply a similar fix to <forward_list> as I did for <list> in r215210. Again, ↵Marshall Clow2014-08-081-1/+2
| | | | | | thanks to Ion Gaztañaga for noticing this problem w.r.t LWG#526 llvm-svn: 215213
* Support forward_list<Incomplete Type>. Patch by Zhihao Yuan!Peter Collingbourne2014-02-051-11/+16
| | | | llvm-svn: 200814
* Update synopsis for list/forward_list/deque to match the allocator style of ↵Marshall Clow2013-09-091-1/+1
| | | | | | existing comment. No code change llvm-svn: 190320
* LWG Issue 2210 (Part #2 & #3): list and forward_listMarshall Clow2013-09-081-0/+26
| | | | llvm-svn: 190279
* Nico Rieck: this patch series fixes visibility issues on Windows as ↵Howard Hinnant2013-08-121-7/+7
| | | | | | explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>. llvm-svn: 188192
* Implement full support for non-pointer pointers in custom allocators for ↵Howard Hinnant2013-06-241-35/+36
| | | | | | forward_list. llvm-svn: 184759
* No functionality change at this time. I've split _LIBCPP_VISIBLE up into ↵Howard Hinnant2013-03-061-7/+7
| | | | | | two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute. llvm-svn: 176593
* Dimitry Andric: many visibility fixes. Howard: Much appreciated. Can you ↵Howard Hinnant2012-09-141-4/+4
| | | | | | send me a patch to CREDITS.TXT? llvm-svn: 163862
* Further macro protection by replacing _[A-Z] with _[A-Z]pHoward Hinnant2011-11-291-32/+32
| | | | llvm-svn: 145410
* Add protection from min/max macrosHoward Hinnant2011-11-291-0/+2
| | | | llvm-svn: 145407
* Windows support by Ruben Van Boxem.Howard Hinnant2011-10-171-0/+2
| | | | llvm-svn: 142235
* Fixed PR10574: http://llvm.org/bugs/show_bug.cgi?id=10574Howard Hinnant2011-08-121-0/+20
| | | | llvm-svn: 137522
* _STD -> _VSTD to avoid macro clash on windowsHoward Hinnant2011-06-301-37/+37
| | | | llvm-svn: 134190
* Provide names for template and function parameters in forward declarations. ↵Howard Hinnant2011-06-141-3/+3
| | | | | | The purpose is to aid automated documentation tools. llvm-svn: 133008
* noexcept for <list>.Howard Hinnant2011-06-031-1/+1
| | | | llvm-svn: 132562
* noexcept for <forward_list>.Howard Hinnant2011-06-031-19/+65
| | | | llvm-svn: 132553
* noexcept for forward_list.Howard Hinnant2011-06-021-39/+52
| | | | llvm-svn: 132461
* Chris Jefferson noted many places where function calls needed to be ↵Howard Hinnant2011-02-141-7/+7
| | | | | | qualified (thanks Chris). llvm-svn: 125510
OpenPOWER on IntegriCloud