summaryrefslogtreecommitdiffstats
path: root/libcxx/include/deque
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-38/+38
| | | | | | | | | 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.
* [libc++] Rename __to_raw_pointer to __to_address.Eric Fiselier2019-11-161-5/+5
| | | | | | | This function has the same behavior as the now-standand std::to_address. Re-using the name makes the behavior more clear, and in the future it will allow us to correctly get the raw pointer for user provided pointer types.
* Improve codegen for deque.Eric Fiselier2019-08-121-6/+91
| | | | | | | | | | | | | | | | | | | | | | | This patch rewrites a few loops in deque and split_buffer to better optimize the codegen. For constructors like `deque<unsigned char> d(500000, 0);` this patch results in a 2x speedup. The patch improves the codegen in roughly three ways: 1. Changes do { ... } while (...) loops into more typical for loops. The optimizer can reason about normal looking loops better. 2. Split the iteration over a range into (A) iteration over the blocks, then (B) iteration within the block. This nested structure helps LLVM lower the inner loop to `memset`. 3. Do fewer things each iteration. Some of these loops were incrementing or changing 4-5 variables every loop (in addition to the construction). Previously most loops would increment the end pointer, the size, and decrement the count of remaining items to construct. Now we only increment a single pointer for most iterations. llvm-svn: 368547
* Refactor deque to centralize handling of spare blocks.Eric Fiselier2019-08-011-48/+50
| | | | | | | | I have upcoming changes that modify how deque handles spare blocks. This cleanup is intended to make those changes easier to review and understand. This patch should have NFC. llvm-svn: 367631
* Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. ↵Marshall Clow2019-03-191-8/+8
| | | | | | These are just rebranded 'operator[]', and should be noexcept like it is. llvm-svn: 356435
* Add noexcept to operator[] for array and deque. This is an extension. We ↵Marshall Clow2019-03-141-4/+4
| | | | | | already do this for string and string_view. This should give better codegen inside of noexcept functions. llvm-svn: 356209
* 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/+18
| | | | | | Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532 llvm-svn: 349178
* [libcxx] Add assertion in deque::pop_back when popping from an empty dequeLouis Dionne2018-12-121-4/+5
| | | | | | | | Also, add tests making sure that vector and deque both catch the problem when assertions are enabled. Otherwise, deque would segfault and vector would never terminate. llvm-svn: 348994
* 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
* Implement deduction guides for <deque>Marshall Clow2018-05-181-3/+26
| | | | llvm-svn: 332785
* 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++] Fix PR34898 - vector iterator constructors and assign method ↵Eric Fiselier2017-10-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | | perform push_back instead of emplace_back. Summary: The constructors `vector(Iter, Iter, Alloc = Alloc{})` and `assign(Iter, Iter)` don't correctly perform EmplaceConstruction from the result of dereferencing the iterator. This results in them performing an additional and unneeded copy. This patch addresses the issue by correctly using `emplace_back` in C++11 and newer. There are also some bugs in our `insert` implementation, but those will be handled separately. @mclow.lists We should probably merge this into 5.1, agreed? Reviewers: mclow.lists, dlj, EricWF Reviewed By: mclow.lists, EricWF Subscribers: cfe-commits, mclow.lists Differential Revision: https://reviews.llvm.org/D38757 llvm-svn: 315994
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-5/+9
| | | | | | | | | | | | | | | | 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 dequeEric Fiselier2017-04-161-102/+78
| | | | llvm-svn: 300413
* Change the return type of emplace_[front|back] back to void when building ↵Marshall Clow2017-01-241-3/+20
| | | | | | with C++14 or before. Resolves PR31680. llvm-svn: 292990
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-6/+6
| | | | | | | | | | | | | 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 sign comparison warningsEric Fiselier2016-12-241-2/+2
| | | | llvm-svn: 290469
* [libcxx] Fix max_size() across all containersEric Fiselier2016-11-231-1/+3
| | | | | | | | | | | | 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
* Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception ↵Marshall Clow2016-08-251-8/+4
| | | | | | type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855. llvm-svn: 279744
* Implement P0084r2. Changing emplace return types.Eric Fiselier2016-07-211-7/+10
| | | | llvm-svn: 276230
* Always use the allocator to construct/destruct elements of a deque/vector. ↵Marshall Clow2016-07-111-4/+4
| | | | | | Fixes PR#28412. Thanks to Jonathan Wakely for the report. llvm-svn: 275105
* 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
* Cleanup: move visibility/linkage attributes to the first declaration.Evgeniy Stepanov2015-11-071-16/+32
| | | | | | | | | | | | This change moves visibility attributes from out-of-class method definitions to in-class declaration. This is needed for a switch to attribute((internal_linkage)) (see http://reviews.llvm.org/D13925) which can only appear on the first declaration. This change does not touch istream/ostream/streambuf. They are handled separately in http://reviews.llvm.org/D14409. llvm-svn: 252385
* Allow deque to handle incomplete types.Evgeniy Stepanov2015-11-061-12/+42
| | | | | | | | Allow deque and deque::iterator instantiation with incomplete element type. This is an ABI breaking change, and it is only enabled if LIBCXX_ABI_VERSION >= 2 or LIBCXX_ABI_UNSTABLE=ON. llvm-svn: 252350
* Fix warnings in deque testsEric Fiselier2015-07-191-5/+0
| | | | llvm-svn: 242632
* Implement the first part of N4258: 'Cleaning up noexcept in the Library'. ↵Marshall Clow2015-07-131-42/+37
| | | | | | This patch deals with swapping containers, and implements a more strict noexcept specification (a conforming extension) than the standard mandates. llvm-svn: 242056
* Fix PR#23767. Add tests for iterator invalidation for ↵Marshall Clow2015-06-051-2/+2
| | | | | | deque::erase/pop_front/pop_back llvm-svn: 239196
* 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
* Fix an exception-safety bug in <deque>. Reference: PR#22650. Not closing the ↵Marshall Clow2015-03-091-26/+16
| | | | | | bug because there's more work to do here llvm-svn: 231672
* Move the default template arguments into the forward declarations for the ↵Marshall Clow2015-02-181-1/+2
| | | | | | containers: deque, forwardlist and list. References PR#22605. llvm-svn: 229705
* Fix PR#22284. Add a new overload to deque::insert to handle forward ↵Marshall Clow2015-01-221-5/+23
| | | | | | iterators. Update tests to exercise this case. llvm-svn: 226847
* [libcxx] Fix use of operator comma where the types can be user definedEric Fiselier2014-10-271-3/+3
| | | | | | | | | | | | | | | | 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
* Implement LWG 2193. Default constructors for standard library containers are ↵Marshall Clow2014-03-051-1/+1
| | | | | | explicit. Note that libc++ already did this for string/deque/forward_list/list/vector and the unordered containers; implement it for set/multiset/map/multimap. Add tests for all the containers. Two drive-by fixes as well: add a missing explicit in <deque>, and remove a tab that snuck into a container test. This issue is also LLVM bug 15724, and resolves it. llvm-svn: 202994
* G M: Changes all references to "x inline" to "inline x" where x = ↵Howard Hinnant2013-10-041-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | _libcpp_always_inline or _libcpp_inline_visibility macros. The patch touches these files: locale array deque new string utility vector __bit_reference __split_buffer locale_win32.h There is no intended functionality change and it is expected that reversing the position of the inline keyword with regard to the other keywords does not change the meaning of anything, least not for apple/Linux etc. It is intended to make libcxx more consistent with itself and to prevent the 1000 or so "inline.cpp(3) : warning C4141: 'inline' : used more than once" warnings that MS's cl.exe compiler emits without this patch, i.e. if inline is not the first keyword before a function name etc. Prefer "inline [other inline related keyword]" over "[other related keyword] inline". After this patch, libcxx should be consistent to this pattern. llvm-svn: 191987
* 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 #1): dequeMarshall Clow2013-09-071-0/+14
| | | | llvm-svn: 190251
* Nico Rieck: this patch series fixes visibility issues on Windows as ↵Howard Hinnant2013-08-121-5/+5
| | | | | | explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>. llvm-svn: 188192
* Implement NULL iterators for <forward_list> and <deque> re: N3644Marshall Clow2013-08-061-1/+5
| | | | llvm-svn: 187805
* Implement full support for non-pointer pointers in custom allocators for deque.Howard Hinnant2013-06-231-13/+22
| | | | llvm-svn: 184673
* No functionality change at this time. I've split _LIBCPP_VISIBLE up into ↵Howard Hinnant2013-03-061-5/+5
| | | | | | 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
* Change emplace for vector and deque to create the temporary (when necessary) ↵Howard Hinnant2012-07-081-2/+4
| | | | | | before any changes to the container are made. Nikolay Ivchenkov deserves the credit for pushing this problem and the solution for it. llvm-svn: 159918
* Quash a whole bunch of warningsHoward Hinnant2011-12-011-3/+3
| | | | llvm-svn: 145624
* Further macro protection by replacing _[A-Z] with _[A-Z]pHoward Hinnant2011-11-291-10/+10
| | | | 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
* Fix const correctness bug in __move_assign. Found and fixed by Ion Gaztañaga.Howard Hinnant2011-09-021-2/+2
| | | | llvm-svn: 139032
* Fixed PR10574: http://llvm.org/bugs/show_bug.cgi?id=10574Howard Hinnant2011-08-121-0/+12
| | | | llvm-svn: 137522
* _STD -> _VSTD to avoid macro clash on windowsHoward Hinnant2011-06-301-123/+123
| | | | llvm-svn: 134190
OpenPOWER on IntegriCloud