summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers
Commit message (Collapse)AuthorAgeFilesLines
...
* Implment the last part of P1024: tuple-like interface to span. Reviewed as ↵Marshall Clow2019-02-276-0/+248
| | | | | | https://reviews.llvm.org/D58706. llvm-svn: 354988
* Fix an ambiguity in the tests that gcc-tot complained about.Marshall Clow2019-02-2711-22/+22
| | | | llvm-svn: 354944
* First part of P1227R2 - change span over to use 'size_t' instead of ↵Marshall Clow2019-02-275-18/+18
| | | | | | 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639. llvm-svn: 354936
* LWG3101 - span's Container constructors need another constraint. Reviewed as ↵Marshall Clow2019-02-252-50/+10
| | | | | | https://reviews.llvm.org/D57058. llvm-svn: 354805
* Commit LWG3144 - span does not have a const_pointer typedef. Reviewed as D57039.Marshall Clow2019-02-251-0/+4
| | | | llvm-svn: 354802
* First part of P1024: Usability Enhancements for std::span. Remove operator() ↵Marshall Clow2019-02-253-8/+154
| | | | | | for indexing, and add 'front' and 'back' calls. llvm-svn: 354801
* [libcxx] Do not assume the number of elements in a moved-from associative ↵Louis Dionne2019-02-134-12/+24
| | | | | | | | | container Reviewed as https://reviews.llvm.org/D57903. Thanks to Andrey Maksimov for the patch. llvm-svn: 353955
* Update some newly added files that mistakenly used the old file headerChandler Carruth2019-02-112-8/+6
| | | | | | to the new one. llvm-svn: 353668
* Support tests in freestandingJF Bastien2019-02-041143-1185/+3395
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* Mark some of the behavior in the move w/allocator constructors of ↵Marshall Clow2019-01-295-36/+41
| | | | | | deque/unordered containers as 'libc++-specific'. Thanks to Andrey Maksimov for pointing this out. llvm-svn: 352512
* [libcxx] Portability fix: unordered_set and unordered_multiset iterators are ↵Louis Dionne2019-01-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | not required to be the same The unordered_set and unordered_multiset iterators are specified in the standard as follows: using iterator = implementation-defined; // see [container.requirements] using const_iterator = implementation-defined; // see [container.requirements] using local_iterator = implementation-defined; // see [container.requirements] using const_local_iterator = implementation-defined; // see [container.requirements] The pairs iterator/const_iterator and local_iterator/const_local_iterator are not required to be the same. The reasonable requirement would be that iterator can convert to const_iterator and local_iterator can convert to const_local_iterator. This patch weakens the check and makes the test more portable. Reviewed as https://reviews.llvm.org/D56493. Thanks to Andrey Maksimov for the patch. llvm-svn: 352083
* Apply D28248: 'Work around GCC PR37804'. Thanks to mdaniels for the patchMarshall Clow2019-01-232-0/+42
| | | | llvm-svn: 351993
* While reviewing D57058, Louis had some questions about the existing span ↵Marshall Clow2019-01-222-36/+69
| | | | | | constructor tests. They were not testing the stuff that they said they were. Updated the tests to test what they should have been doing llvm-svn: 351887
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191143-4572/+3429
| | | | | | | | | | | | | | | | | | 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
* Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. Eric Fiselier2019-01-161-2/+0
| | | | | | | | | | | | | | | | | | | | | Summary: Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See llvm.org/PR39713 This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used. This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement. I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. Reviewers: ldionne, EricWF Reviewed By: ldionne, EricWF Subscribers: jyknight, christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D54814 llvm-svn: 351289
* [NFC] Normalize some test 'main' signaturesJF Bastien2019-01-091-2/+1
| | | | | | There were 3 tests with 'int main(void)', and 6 with the return type on a different line. I'm about to send a patch for main in tests, and this NFC change is unrelated. llvm-svn: 350770
* [libcxx] Optimize vectors construction of trivial types from an iterator ↵Volodymyr Sapsai2019-01-081-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | range with const-ness mismatch. We already have a specialization that will use memcpy for construction of trivial types from an iterator range like std::vector<int>(int *, int *); But if we have const-ness mismatch like std::vector<int>(const int *, const int *); we would use a slow path that copies each element individually. This change enables the optimal specialization for const-ness mismatch. Fixes PR37574. Contributions to the patch are made by Arthur O'Dwyer, Louis Dionne. rdar://problem/40485845 Reviewers: mclow.lists, EricWF, ldionne, scanon Reviewed By: ldionne Subscribers: christof, ldionne, howard.hinnant, cfe-commits Differential Revision: https://reviews.llvm.org/D48342 llvm-svn: 350583
* [libcxx] Fix order checking in unordered_multimap tests.Louis Dionne2018-12-206-152/+379
| | | | | | | | | | | | | | | Some tests assume that iteration through an unordered multimap elements will return them in the same order as at the container creation. This assumption is not true since the container is unordered, so that no specific order of elements is ever guaranteed for such container. This patch introduces checks verifying that any iteration will return elements exactly from a set of valid values and without repetition, but in no particular order. Reviewed as https://reviews.llvm.org/D54838. Thanks to Andrey Maksimov for the patch. llvm-svn: 349780
* Portability fix: add missing includes and static_casts. Reviewed as ↵Marshall Clow2018-12-181-0/+2
| | | | | | https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch. llvm-svn: 349566
* Fix static assert diagnostic checks in i386Eric Fiselier2018-12-153-3/+3
| | | | llvm-svn: 349252
* Tolerate Clangs new static_assert messagesEric Fiselier2018-12-143-3/+3
| | | | llvm-svn: 349189
* Implement P1209 - Adopt Consistent Container Erasure from Library ↵Marshall Clow2018-12-1416-0/+1279
| | | | | | Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532 llvm-svn: 349178
* Update a couple of vector<bool> tests that were testing libc++-specific ↵Marshall Clow2018-12-073-10/+17
| | | | | | bahavior. Thanks to Andrey Maksimov for the catch. llvm-svn: 348660
* [libcxx] Add checks for unique value of array<T, 0>.begin() and array<T, ↵Louis Dionne2018-12-061-1/+8
| | | | | | | | | | | | | | | 0>.end() The standard section [array.zero] requires the return value of begin() and end() methods of a zero-sized array to be unique. Eric Fiselier clarifies: "That unique value cannot be null, and must be properly aligned". This patch adds checks for the first part of this clarification: unique value returned by these methods cannot be null. Reviewed as https://reviews.llvm.org/D55366. Thanks to Andrey Maksimov for the patch. llvm-svn: 348509
* [libcxx] Make return value of array<T, 0>.data() checked only for libc++Louis Dionne2018-12-062-6/+6
| | | | | | | | | | | The section array.zero says: "The return value of data() is unspecified". This patch marks all checks of the array<T, 0>.data() return value as libc++ specific. Reviewed as https://reviews.llvm.org/D55364. Thanks to Andrey Maksimov for the patch. llvm-svn: 348485
* Revert "Move internal usages of `alignof`/`__alignof` to use ↵Eric Fiselier2018-11-281-0/+2
| | | | | | | | | | | `_LIBCPP_ALIGNOF`. " This reverts commit 087f065cb0c7463f521a62599884493aaee2ea12. The tests were failing on 32 bit builds, and I don't have time to clean them up right now. I'll recommit tomorrow with fixed tests. llvm-svn: 347816
* Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. Eric Fiselier2018-11-281-2/+0
| | | | | | | | | | | | | | | | | | | | | Summary: Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See llvm.org/PR39713 This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used. This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement. I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. Reviewers: ldionne, EricWF Reviewed By: EricWF Subscribers: christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D54814 llvm-svn: 347787
* Implement P1085R2 - Should Span be Regular?. This consists entirely of deletionsMarshall Clow2018-11-276-950/+0
| | | | llvm-svn: 347672
* [libcxx] Fix incorrect iterator type in vector container testLouis Dionne2018-11-211-24/+32
| | | | | | | | | | | | The iterator types for different specializations of containers with the same element type but different allocators are not required to be convertible. This patch makes the test to take the iterator type from the same container specialization as the created container. Reviewed as https://reviews.llvm.org/D54806. Thanks to Andrey Maksimov for the patch. llvm-svn: 347423
* [libcxx] Fix incorrect #include for std::hashLouis Dionne2018-11-191-1/+1
| | | | | | | Reviewed as https://reviews.llvm.org/D54705. Thanks to Andrey Maksimov for the patch. llvm-svn: 347233
* [libcxx] Add missing <cstddef> includes in testsLouis Dionne2018-11-192-0/+3
| | | | | | | | | | | Some tests use type std::max_align_t, but don't include <cstddef> header directly. As a result, these tests won't compile against some conformant libraries. Reviewed as https://reviews.llvm.org/D54645. Thanks to Andrey Maksimov for the patch. llvm-svn: 347232
* [libcxx] Add missing includes in testsLouis Dionne2018-11-1621-0/+24
| | | | | | | | | | | | | | | A bunch of unordered containers tests call library functions but don't directly include the corresponding header files: - fabs() (defined in <cmath> which is not included); - is_permutation() (defined in <algorithm> which is not included); - next() (defined in <iterator> which is not included). - As a result, these tests won't compile against some conformant libraries. Reviewed as https://reviews.llvm.org/D54643. Thanks to Andrey Maksimov for the patch. llvm-svn: 347085
* Get tests compiling with -Wunused-local-typedefEric Fiselier2018-11-1511-30/+2
| | | | llvm-svn: 346914
* [libcxx] [test] Fix Clang -Wunused-local-typedef warnings.Stephan T. Lavavej2018-11-144-20/+0
| | | | | | C++11's [hash.requirements] never required these typedefs from users. llvm-svn: 346912
* [libcxx] [test] Include <cassert> for assert().Stephan T. Lavavej2018-11-148-0/+8
| | | | | | This fixes compiler errors with MSVC's STL. llvm-svn: 346911
* [libcxx] [test] Fix MSVC warning C4800.Stephan T. Lavavej2018-11-141-6/+6
| | | | | | | | | | | | This was implicitly converting [1, 3] to bool, which triggers an MSVC warning. The test should just pass `true`, which is simpler, has the same behavior, and avoids the warning. (This is a library test, not a compiler test, and the conversion happens before calling `push_back`, so passing [1, 3] isn't interesting in any way. This resembles a previous change to stop passing `1 == 1` in the `vector<bool>` tests.) llvm-svn: 346910
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2018-11-1440-156/+156
| | | | llvm-svn: 346826
* Add emplace tests for multiset/unordered_multiset.Eric Fiselier2018-11-133-1/+46
| | | | | | | | This patch adds tests to ensure that multiset/unordered_multiset's emplace method correctly constructs the elements without any intervening constructions. llvm-svn: 346743
* Second half of C++17's splicing maps and setsErik Pilkington2018-10-318-0/+1232
| | | | | | | | | | This commit adds a merge member function to all the map and set containers, which splices nodes from the source container. This completes support for P0083r3. Differential revision: https://reviews.llvm.org/D48896 llvm-svn: 345744
* [libcxx] [test] Add missing <stdexcept> to map at tests.Billy Robert O'Neal III2018-10-192-3/+5
| | | | | | Reviewed as https://reviews.llvm.org/D50551 llvm-svn: 344821
* Update the array tests to not use a local type; removes warnings in C++03. NFCMarshall Clow2018-10-123-9/+13
| | | | llvm-svn: 344417
* Update all the max_size tests to eliminate signed/unsigned comparison ↵Marshall Clow2018-10-1212-62/+62
| | | | | | warnings. NFC llvm-svn: 344416
* Remove unused include of "verbose_assert.h"Marshall Clow2018-09-191-1/+0
| | | | llvm-svn: 342524
* Mark LWG#3102 as complete. No code changes, but I updated a test or twoMarshall Clow2018-09-131-0/+6
| | | | llvm-svn: 342103
* mark LWG#2953 as complete. No code changes required, but added a couple of ↵Marshall Clow2018-09-122-0/+64
| | | | | | extra tests. llvm-svn: 342070
* Implement LWG #3017. list splice functions should use addressofMarshall Clow2018-09-122-0/+21
| | | | llvm-svn: 342057
* Fix Bug 38644: multimap::clear() missing exception specifier. Add noexcept ↵Marshall Clow2018-08-2212-11/+113
| | | | | | tests for all the containers that have clear(). llvm-svn: 340385
* [libcxx] [test] Avoid -Wunused-local-typedef in node_handle.pass.cpp.Billy Robert O'Neal III2018-08-081-1/+3
| | | | llvm-svn: 339218
* Update the changes to the array tests (that I committed yesterday) to use ↵Marshall Clow2018-08-031-55/+8
| | | | | | the test_comparison routines that I committed last week. NFC. llvm-svn: 338797
* Implement P1023: constexpr comparison operators for std::arrayMarshall Clow2018-08-021-0/+46
| | | | llvm-svn: 338668
OpenPOWER on IntegriCloud