summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/associative
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix copy/paste errors introduced in r289358Eric Fiselier2016-12-111-8/+8
| | | | llvm-svn: 289359
* Fix undefined behavior in container swap tests.Eric Fiselier2016-12-114-16/+16
| | | | | | | | | | | | These swap tests were swapping non-POCS non-equal allocators which is undefined behavior. This patch changes the tests to use allocators which compare equal. In order to test that the allocators were not swapped I added an "id" field to test_allocator which does not participate in equality but does propagate across copies/swaps. This patch is based off of D26623 which was submitted by STL. llvm-svn: 289358
* Fix missing const on set::count. Patch from Andrey KhalyavinEric Fiselier2016-12-091-9/+11
| | | | llvm-svn: 289204
* [libcxx] [test] D27021: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-066-52/+56
| | | | | | | | | | | | | | | | | | | | | part 8/12. Add static_cast<std::size_t> when comparing distance() to size(). These replacements were performed programmatically with regex_replace(): const vector<pair<regex, string>> reg_fmt = { { regex(R"(assert\((\w+)\.size\(\) == std::distance\((\w+, \w+)\)\))"), "assert($1.size() == static_cast<std::size_t>(std::distance($2)))" }, { regex(R"(assert\(distance\((\w+\.begin\(\), \w+\.end\(\))\) == (\w+)\.size\(\)\))"), "assert(static_cast<std::size_t>(distance($1)) == $2.size())" }, { regex(R"(assert\(std::distance\((\w+\.\w*begin\(\), \w+\.\w*end\(\))\) == (\w+)\.size\(\)\))"), "assert(static_cast<std::size_t>(std::distance($1)) == $2.size())" }, }; Also, include <cstddef> when it wasn't already being included. llvm-svn: 288745
* Protect std::{,unordered_}map tests under noexceptionsRoger Ferrer Ibanez2016-11-291-1/+9
| | | | | | | | Skip tests that use exceptions Differential Revision: https://reviews.llvm.org/D27093 llvm-svn: 288157
* [libcxx] [test] D27027: Strip trailing whitespace.Stephan T. Lavavej2016-11-235-10/+10
| | | | llvm-svn: 287829
* [libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-232-8/+10
| | | | | | | | | | part 2/12. Add static_cast<std::size_t> when comparing int to std::size_t. Also, include <cstddef> when it wasn't already being included. llvm-svn: 287822
* [libcxx] Fix max_size() across all containersEric Fiselier2016-11-234-42/+104
| | | | | | | | | | | | 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
* [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.Stephan T. Lavavej2016-11-0460-78/+138
| | | | | | | | | | | This replaces every occurrence of _LIBCPP_STD_VER in the tests with TEST_STD_VER. Additionally, for every affected file, #include "test_macros.h" is being added explicitly if it wasn't already there. https://reviews.llvm.org/D26294 llvm-svn: 286007
* [libc++] Remove various C++03 feature test macrosEric Fiselier2016-09-254-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`. This patch removes the __config macros: * _LIBCPP_HAS_NO_TRAILING_RETURN * _LIBCPP_HAS_NO_TEMPLATE_ALIASES * _LIBCPP_HAS_NO_ADVANCED_SFINAE * _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS * _LIBCPP_HAS_NO_STATIC_ASSERT As a drive I also changed our C++03 static_assert to use _Static_assert if available. I plan to commit this without review if nobody voices an objection. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24895 llvm-svn: 282347
* Add missing include that caused a test failure on Windows. Thanks to STL for ↵Marshall Clow2016-08-221-0/+1
| | | | | | the patch. No functional change. llvm-svn: 279453
* make the associative containers do the right thing for ↵Marshall Clow2016-08-171-0/+158
| | | | | | propogate_on_container_assignment. Fixes bug #29001. Tests are only for <map> right now - more complete tests will come when we revamp our allocator testing structure. llvm-svn: 279008
* Support allocators with explicit conversion constructors. Fixes bug #29000Marshall Clow2016-08-1716-2/+334
| | | | llvm-svn: 278904
* Make dtor_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.comEric Fiselier2016-07-254-4/+8
| | | | llvm-svn: 276595
* Make move_assign_noexcept.pass.cpp tests more portable. Patch from ↵Eric Fiselier2016-07-254-4/+8
| | | | | | STL@microsoft.com llvm-svn: 276591
* Make swap_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com.Eric Fiselier2016-07-254-73/+41
| | | | | | See D21820 for more information (https://reviews.llvm.org/D21820). llvm-svn: 276590
* Make move_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.comEric Fiselier2016-07-244-12/+16
| | | | llvm-svn: 276581
* Fix undefined behavior in __treeEric Fiselier2016-07-191-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch attempts to fix the undefined behavior in __tree by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible). The UB in `__tree` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 3 node types in __tree. * `__tree_end_node` which contains the `__left_` pointer. This node is embedded within the container. * `__tree_node_base` which contains `__right_`, `__parent_` and `__is_black`. This node is used throughout the tree rebalancing algorithms. * `__tree_node` which contains `__value_`. Currently `__tree` stores the start of the tree, `__begin_node_`, as a pointer to a `__tree_node`. Additionally the iterators store their position as a pointer to a `__tree_node`. In both of these cases the pointee can be the end node. This is fixed by changing them to store `__tree_end_node` pointers instead. To make this change I introduced an `__iter_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node` in the current one. Both `__tree::__begin_node_` and iterator pointers are now stored as `__iter_pointers`. The other situation where `__tree_end_node` is stored as the wrong type is in `__tree_node_base::__parent_`. Currently `__left_`, `__right_`, and `__parent_` are all `__tree_node_base` pointers. Since the end node will only be stored in `__parent_` the fix is to change `__parent_` to be a pointer to `__tree_end_node`. To make this change I introduced a `__parent_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node_base` in the current one. Note that in the new ABI `__iter_pointer` and `__parent_pointer` are the same type (but not in the old one). The confusion between these two types is unfortunate but it was the best solution I could come up with that maintains the ABI. The typedef changes force a ton of explicit type casts to correct pointer types and to make current code compatible with both the old and new pointer typedefs. This is the bulk of the change and it's really messy. Unfortunately I don't know how to avoid it. Please let me know what you think. Reviewers: howard.hinnant, mclow.lists Subscribers: howard.hinnant, bbannier, cfe-commits Differential Revision: https://reviews.llvm.org/D20786 llvm-svn: 276003
* Fix static assert problem on gcc; remove XFAILs that I put in in r274250Marshall Clow2016-06-304-8/+0
| | | | llvm-svn: 274285
* Temporarily XFAIL the incomplete type tests for GCC while I figure out why ↵Marshall Clow2016-06-304-0/+8
| | | | | | adding a static_assert in r274235 broken them llvm-svn: 274250
* Implement LWG#2436: 'Comparators for associative containers should always be ↵Marshall Clow2016-06-304-0/+116
| | | | | | CopyConstructible' llvm-svn: 274235
* Make default_noexcept.pass.cpp container tests more portable. Patch from ↵Eric Fiselier2016-06-264-8/+12
| | | | | | STL@microsoft.com llvm-svn: 273823
* Move remaining _LIBCPP_VERSION tests into test/libcxxEric Fiselier2016-06-222-40/+0
| | | | llvm-svn: 273367
* Replace __cplusplus comparisons and dialect __has_feature checks with ↵Eric Fiselier2016-06-14149-185/+169
| | | | | | | | | TEST_STD_VER. This is a huge cleanup that helps make the libc++ test suite more portable. Patch from STL@microsoft.com. Thanks STL! llvm-svn: 272716
* Make the comparison objects that we pass in for various tests look more like ↵Marshall Clow2016-06-0920-20/+24
| | | | | | actual comparison objects. No functional change. llvm-svn: 272288
* Avoid Shadowing warnings in the associative containers tests. Thanks to STL ↵Marshall Clow2016-06-074-4/+8
| | | | | | for the patch. llvm-svn: 272018
* [libcxx] Fix c++98 test failures.Asiri Rathnayake2016-06-0312-13/+13
| | | | | | | | | Adds XFAIL/UNSUPPORTED lit tags as appropriate. Gets a clean test run for -std=c++98 on Fedora 20. NFC. llvm-svn: 271741
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-0154-160/+160
| | | | llvm-svn: 271435
* Fix or move various non-standard tests.Eric Fiselier2016-04-292-14/+0
| | | | | | | | | | | | This patch does the following: * Remove <__config> includes from some container tests. * Guards uses of std::launch::any in async tests because it's an extension. * Move "test/std/extensions" to "test/libcxx/extensions" * Moves various non-standard tests including those in "sequences/vector", "std/localization" and "utilities/meta". llvm-svn: 267981
* Add braces, move braces, and rename variables to avoid shadowing. Patch from ↵Eric Fiselier2016-04-283-2/+6
| | | | | | STL@microsoft.com llvm-svn: 267844
* Fix = that should have been == in test. Thanks to STL@microsoft for the catchMarshall Clow2016-04-271-1/+1
| | | | llvm-svn: 267654
* Fix some non-standard parts of our test suite. Reported by STLEric Fiselier2016-04-224-3460/+0
| | | | llvm-svn: 267131
* Complete LWG issue #2016. Allocators must be nothrow swappableEric Fiselier2016-04-224-10/+12
| | | | llvm-svn: 267085
* Fix LWG issue 2345 - Add insert(value_type&&)Eric Fiselier2016-04-1810-455/+316
| | | | llvm-svn: 266585
* Extract key to avoid preemptive mallocs in insert/emplace in associative ↵Eric Fiselier2016-04-156-430/+63
| | | | | | | | | | | | | | containers Summary: This patch applies Duncan's work on __hash_table to __tree. Reviewers: mclow.lists, dexonsmith Subscribers: dexonsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D18637 llvm-svn: 266491
* Fix LWG issue 2469 - Use piecewise construction in map::operator[].Eric Fiselier2016-03-312-4/+68
| | | | | | | | | | | | | | | map's allocator may only be used to construct objects of 'value_type', or in this case 'pair<const Key, Value>'. In order to respect this requirement in operator[], which requires default constructing the 'mapped_type', we have to use pair's piecewise constructor with '(tuple<Kep>, tuple<>)'. Unfortunately we still need to provide a fallback implementation for C++03 since we don't have <tuple>. Even worse this fallback is the last remaining user of '__hash_map_node_destructor' and '__construct_node_with_key'. This patch also switches try_emplace over to __tree.__emplace_unique_key_args. llvm-svn: 264989
* Teach __tree how to handle map's __value_typeEric Fiselier2016-03-314-0/+479
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is fairly large and contains a number of changes. The changes all work towards allowing __tree to properly handle __value_type esspecially when inserting into the __tree. I chose not to break this change into smaller patches because it wouldn't be possible to write meaningful standard-compliant tests for each patch. It is very similar to r260513 "[libcxx] Teach __hash_table how to handle unordered_map's __hash_value_type". Changes in <map> * Remove __value_type's constructors because it should never be constructed directly. * Make map::emplace and multimap::emplace forward to __tree and remove the old definitions * Remove "__construct_node" map and multimap member functions. Almost all of the construction is done within __tree. * Fix map's move constructor to access "__value_type.__nc" directly and pass this object to __tree::insert. Changes in <__tree> * Add traits to detect, handle, and unwrap, map's "__value_type". * Convert methods taking "value_type" to take "__container_value_type" instead. Previously these methods caused unwanted implicit conversions from "std::pair<Key, Value>" to "__value_type<Key, Value>". * Delete __tree_node and __tree_node_base's constructors and assignment operators. The node types should never be constructed because the "__value_" member of __tree_node must be constructed directly by the allocator. * Make the __tree_node_destructor class and "__construct_node" methods unwrap "__node_value_type" into "__container_value_type" before invoking the allocator. The user's allocator can only be used to construct and destroy the container's value_type. Passing it map's "__value_type" was incorrect. * Cleanup the "__insert" and "__emplace" methods. Have __insert forward to an __emplace function wherever possible to reduce code duplication. __insert_unique(value_type const&) and __insert_unique(value_type&&) forward to __emplace_unique_key_args. These functions will not allocate a new node if the value is already in the tree. * Change the __find* functions to take the "key_type" directly instead of passing in "value_type" and unwrapping the key later. This change allows the find functions to be used without having to construct a "value_type" first. This allows for a number of optimizations. * Teach __move_assign and __assign_multi methods to unwrap map's __value_type. llvm-svn: 264986
* Cleanup node-type handling in the associative containers.Eric Fiselier2016-02-205-0/+247
| | | | | | | | | | | | | | | | | | | | | | | This patch is very similar to r260431. This patch is the first in a series of patches that's meant to better support map. map has a special "value_type" that differs from pair<const Key, Value>. In order to meet the EmplaceConstructible and CopyInsertable requirements we need to teach __tree about this special value_type. This patch creates a "__tree_node_types" traits class that contains all of the typedefs needed by the associative containers and their iterators. These typedefs include ones for each node type and node pointer type, as well as special typedefs for "map"'s value type. Although the associative containers already supported incomplete types, this patch makes it official by adding tests. This patch will be followed up shortly with various cleanups within __tree and fixes for various map bugs and problems. llvm-svn: 261416
* Add explicit include directives; the file was getting implicitly included ↵Marshall Clow2016-01-054-0/+4
| | | | | | already. NFC llvm-svn: 256864
* First half of LWG#2354: 'Unnecessary copying when inserting into maps with ↵Marshall Clow2016-01-054-4/+130
| | | | | | braced-init syntax' llvm-svn: 256859
* Add static_assert to set/multiset/map/multimap/forward_list/deque that the ↵Marshall Clow2015-11-264-0/+72
| | | | | | 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
* Remove undefined behavior from tests; specifically, ensure that the value ↵Marshall Clow2015-11-2411-31/+41
| | | | | | type of the allocators match the value type of the containers llvm-svn: 254030
* Make it possible to build a no-exceptions variant of libcxx.Asiri Rathnayake2015-11-101-0/+1
| | | | | | | | | | | | Fixes a small omission in libcxx that prevents libcxx being built when -DLIBCXX_ENABLE_EXCEPTIONS=0 is specified. This patch adds XFAILS to all those tests that are currently failing on the new -fno-exceptions library variant. Follow-up patches will update the tests (progressively) to cope with the new library variant. Change-Id: I4b801bd8d8e4fe7193df9e55f39f1f393a8ba81a llvm-svn: 252598
* Fix warnings in array and assoc containersEric Fiselier2015-07-184-9/+29
| | | | llvm-svn: 242629
* Implement the first part of N4258: 'Cleaning up noexcept in the Library'. ↵Marshall Clow2015-07-134-0/+352
| | | | | | This patch deals with swapping containers, and implements a more strict noexcept specification (a conforming extension) than the standard mandates. llvm-svn: 242056
* Implement N4279 and LWG#2664 for <map>. Reviewed as ↵Marshall Clow2015-07-072-0/+381
| | | | | | http://reviews.llvm.org/D10669 llvm-svn: 241539
* Add tests for LWG#2299. While doing so, I noticed that the tests we have for ↵Marshall Clow2015-06-3049-1/+1716
| | | | | | the transparent comparators don't actually call them. Fix those tests, too. Now one of them is failing, due to a missing const in <map>. Add that (twice). Next step is to do the same for <unordered_map> llvm-svn: 241091
* Fix for LWG Issue 2059: C++0x ambiguity problem with map::eraseMarshall Clow2015-05-104-0/+88
| | | | llvm-svn: 236950
* Allow declaration of map and multimap iterator with incomplete mapped type. ↵Eric Fiselier2015-03-032-4/+33
| | | | | | Patch from eugenis llvm-svn: 231119
* Remove use of zero length arrays in tests. Get tests passing with ↵Eric Fiselier2015-02-108-228/+58
| | | | | | -pedantic-errors llvm-svn: 228706
OpenPOWER on IntegriCloud