summaryrefslogtreecommitdiffstats
path: root/libcxx/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [libc++] (Take 2) Add a test that uses the debug database from multiple threadsLouis Dionne2019-04-171-0/+72
| | | | | | | | | | | | In r358591, I added a test that uses the debug database from multiple threads and that helped us uncover the problem that was fixed in r355367. However, the test broke the tsan CI bots, and I think the problem is the test allocator that was used in the test (which is not thread safe). I'm committing again without using the test allocator, and in a separate test file. llvm-svn: 358610
* Revert "[libc++] Add a test that uses the debug database from multiple threads"Louis Dionne2019-04-171-34/+0
| | | | | | | | This reverts r358591, which seems to have uncovered an actual bug and causes the tsan CI to fail. We need to fix the bug and re-commit the test. llvm-svn: 358593
* [libc++] Add a test that uses the debug database from multiple threadsLouis Dionne2019-04-171-0/+34
| | | | | | | This test helped us concurrently discover the problem that was fixed in r355367. llvm-svn: 358591
* Add tests for stability to list::sort and forward_list::sort. Thanks to ↵Marshall Clow2019-04-174-0/+184
| | | | | | Jonathan Wakely for the notice llvm-svn: 358541
* Fix list/forward_list implementations of remove_if and unique to deal with ↵Marshall Clow2019-04-164-0/+94
| | | | | | predicates that are part of the sequence passed in. We already do this for remove. llvm-svn: 358534
* [libc++] Fix debug_less test in C++03Louis Dionne2019-04-151-9/+9
| | | | | | We were using C++11 features but the test needs to work in C++03 too. llvm-svn: 358433
* [libc++] Fix build failure with _LIBCPP_DEBUG=0 when iterators return values ↵Thomas Anderson2019-04-151-0/+35
| | | | | | | | | | | | | | | | | | | instead of references There are many STL algorithms (such as lexicographical_compare) that compare values pointed to by iterators like so: __comp(*it1, *it2); When building with `_LIBCPP_DEBUG=0`, comparators are wrapped in `__debug_less` which does some additional validation. But `__debug_less::operator()` takes non-const references, so if the type of `*it1` is int, not int&, then the build will fail. This change adds a `const&` overload for `operator()` to fix the build. Differential Revision: https://reviews.llvm.org/D60592 llvm-svn: 358423
* [libc++] Run back-deployment CI against previously-released libc++abi dylibsLouis Dionne2019-04-122-4/+2
| | | | | | | | | | | We used to do it against the current system's libc++abi, which is not as good as doing it with the libc++abi that matches the libc++ we're running against. Note that I made sure we were indeed picking up the provided libc++abi by replacing it by something that doesn't work and watching it burn. llvm-svn: 358294
* [libc++] Make sure we don't eagerly diagnose non-const comparators for ↵Louis Dionne2019-04-114-6/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | containers of incomplete types Summary: In r348529, I improved the library-defined diagnostic for using containers with a non-const comparator/hasher. However, the check is now performed too early, which leads to the diagnostic being emitted in cases where it shouldn't. See PR41360 for details. This patch moves the diagnostic to the destructor of the containers, which means that the diagnostic will only be emitted when the container is instantiated at a point where the comparator and the key/value are required to be complete. We still retain better diagnostics than before r348529, because the diagnostics are performed in the containers themselves instead of __tree and __hash_table. As a drive-by fix, I improved the diagnostic to mention that we can't find a _viable_ const call operator, as suggested by EricWF in PR41360. Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits, zoecarver Tags: #libc Differential Revision: https://reviews.llvm.org/D60540 llvm-svn: 358189
* [libc++] Add XFAILs for istream tests that were added in r357775Louis Dionne2019-04-0521-0/+143
| | | | | | | | We fixed incorrect behavior of input streams in r357775 and tests were added accordingly. However, older versions of macOS don't have the change in the dylib yet, so the tests fail on those platforms. llvm-svn: 357794
* [libc++] Fix error flags and exceptions propagated from input stream operationsLouis Dionne2019-04-0540-159/+1962
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is a re-application of r357533 and r357531. They had been reverted because we thought the commits broke the LLDB data formatters, but it turns out this was because only r357531 had been included in the CI run. Before this patch, we would only ever throw an exception if the badbit was set on the stream. The Standard is currently very unclear on how exceptions should be propagated and what error flags should be set by the input stream operations. This commit changes libc++ to behave under a different (but valid) interpretation of the Standard. This interpretation of the Standard matches what other implementations are doing. This effectively implements the wording in p1264r0. It hasn't been voted into the Standard yet, however there is wide agreement that the fix is correct and it's just a matter of time before the fix is standardized. PR21586 PR15949 rdar://problem/15347558 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D49863 llvm-svn: 357775
* Try to suppress nodiscard_extension failures with Xcode 9Nico Weber2019-04-042-0/+8
| | | | | | See https://crbug.com/949509 for the error message. llvm-svn: 357692
* Cleanup test failures in no discard tests.Eric Fiselier2019-04-032-0/+26
| | | | llvm-svn: 357637
* libcxx: Add _LIBCPP_NODISCARD_EXT to 38 more functionsNico Weber2019-04-032-7/+355
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This builds on the work done in r342808 and adds _LIBCPP_NODISCARD_EXT to 37 more functions, namely: adjacent_find, all_of, any_of, binary_search, clamp, count_if, count, equal_range, equal, find_end, find_first_not_of, find_first_of, find_if, find, includes, is_heap_until, is_heap, is_partitioned, is_permutation, is_sorted_until, is_sorted, lexicographical_compare, lower_bound, max_element, max, min_element, min, minmax_element, minmax, mismatch, none_of, remove_if, remove, search_n, search, unique, upper_bound The motivation here is that we noticed that find_if is nodiscard with Visual Studio's standard library, and we deemed that useful (https://crbug.com/948122). https://devblogs.microsoft.com/cppblog/c17-progress-in-vs-2017-15-5-and-15-6/ says "Our criteria for emitting the warning are: discarding the return value is a guaranteed leak [...], discarding the return value is near-guaranteed to be incorrect (e.g. remove()/remove_if()/unique()), or the function is essentially a pure observer (e.g. vector::empty() and std::is_sorted())." so I went through algorithm and tried to apply these criteria. Some of these, like vector::empty() are already nodiscard per C++ standard and didn't need changing. I didn't (yet?) go over std::string::find* methods which should probably have _LIBCPP_NODISCARD_EXT too (but not as part of this change). Differential Revision: https://reviews.llvm.org/D60145 llvm-svn: 357619
* [libc++] Use std::is_nothrow_callable for std::invoke according to LWG 2807Louis Dionne2019-04-031-2/+3
| | | | | | | Thanks to Zoe Carver for the patch. Differential Revision: https://reviews.llvm.org/D58097 llvm-svn: 357616
* [libc++][NFC] Rename test file according to the libc++ conventionLouis Dionne2019-04-031-0/+0
| | | | llvm-svn: 357588
* [libc++] (Take 2) Correctly handle Objective-C++ ARC qualifiers in ↵Louis Dionne2019-04-031-0/+64
| | | | | | | | | | | | | | | | | | | | | std::is_pointer Summary: Otherwise, std::is_pointer<id __strong> works, but std::is_pointer<id __weak> (and others) don't work as expected. The previous patch (r357517) had to be reverted in r357569 because it broke the Chromium build. This patch shouldn't have the same problem. rdar://problem/49126333 Reviewers: ahatanak, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D60087 llvm-svn: 357586
* Revert "[libc++] Correctly handle Objective-C++ ARC qualifiers in ↵Hans Wennborg2019-04-031-56/+0
| | | | | | | | | | | | | | | | | | | | std::is_pointer" This broke the Chromium build on Mac, see https://crbug.com/949071 > Summary: > Otherwise, std::is_pointer<id __strong> works, but std::is_pointer<id __weak> > (and others) don't work as expected. > > rdar://problem/49126333 > > Reviewers: ahatanak, EricWF > > Subscribers: christof, jkorous, dexonsmith, libcxx-commits > > Differential Revision: https://reviews.llvm.org/D60087 llvm-svn: 357569
* [libcxx] [test] Add missing <stdexcept> to name std::out_of_range to ↵Billy Robert O'Neal III2019-04-031-2/+3
| | | | | | string.conversions\stold.pass.cpp. llvm-svn: 357547
* [libcxx] [test] Use ptrdiff_t rather than int in splice_after_range.pass.cpp ↵Billy Robert O'Neal III2019-04-031-23/+24
| | | | | | | | to avoid narrowing from pointer subtraction to int warnings. Reviewed as https://reviews.llvm.org/D60104 llvm-svn: 357546
* [libcxx] [test] Fix test bugs in string.cons/copy_alloc.pass.cpp.Billy Robert O'Neal III2019-04-031-6/+7
| | | | | | | | | | | | | | Fixed the inability to properly rebind the testing allocator, by making the inner alloc_impl type a plain struct and making the operations templates. Before rebind failed to compile complaining that a alloc_impl<T>* was not convertible to an alloc_impl<U>*. This enables the test to pass for MSVC++ once we provide the strong guarantee for the copy assignment operator. Reviewed as https://reviews.llvm.org/D60023 llvm-svn: 357545
* Revert "[libc++] Fix error flags and exceptions propagated from input stream ↵Louis Dionne2019-04-0240-1962/+159
| | | | | | | | | | operations" This reverts commits r357533 and r357531, which broke the LLDB data formatters. I'll hold off until we know how to fix the data formatters accordingly. llvm-svn: 357536
* [libc++] Fix error flags and exceptions propagated from input stream operationsLouis Dionne2019-04-0240-159/+1962
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before this patch, we would only ever throw an exception if the badbit was set on the stream. The Standard is currently very unclear on how exceptions should be propagated and what error flags should be set by the input stream operations. This commit changes libc++ to behave under a different (but valid) interpretation of the Standard. This interpretation of the Standard matches what other implementations are doing. I will submit a paper in San Diego to clarify the Standard such that the interpretation used in this commit (and other implementations) is the only possible one. PR21586 PR15949 rdar://problem/15347558 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D49863 llvm-svn: 357531
* [libc++] Correctly handle Objective-C++ ARC qualifiers in std::is_pointerLouis Dionne2019-04-021-0/+56
| | | | | | | | | | | | | | | | Summary: Otherwise, std::is_pointer<id __strong> works, but std::is_pointer<id __weak> (and others) don't work as expected. rdar://problem/49126333 Reviewers: ahatanak, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D60087 llvm-svn: 357517
* Fix a number of bugs in __val_expr's subset operator[].Eric Fiselier2019-04-028-218/+340
| | | | | | | | The current definitions were entirely broken. They didn't call any existing constructor and the forgot to friend the expression types they were trying to construct. llvm-svn: 357453
* [libcxx] Make sure reference_wrapper works with incomplete typesLouis Dionne2019-04-014-0/+162
| | | | | | | | | | | | Summary: Completes P0357R3, which was merged into the C++20 Working Draft in San Diego. Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D54722 llvm-svn: 357423
* [libc++] Declare std::tuple_element as struct instead of classLouis Dionne2019-04-014-8/+4
| | | | | | | | | | | | Similarly to https://reviews.llvm.org/rL350972, this revision changes std::tuple_element from class to struct. Fixes PR41331. Thanks to Jan Wilken Dörrie for the patch. Differential Revision: https://reviews.llvm.org/D60069 llvm-svn: 357411
* Fix PR41130 - 'operator/ of std::chrono::duration and custom type'. Thanks ↵Marshall Clow2019-04-018-2/+127
| | | | | | to Zulan for the report, and Howard for the direction of the fix. llvm-svn: 357410
* Make common_type's implementation common Eric Fiselier2019-03-311-77/+98
| | | | | | | | | | | | | | | | | | | Summary: Currently the C++03 implementation of common_type has much different behavior than the C++11 one. This causes bugs, including inside `<chrono>`. This patch unifies the two implementations as best it can. The more code they share, the less their behavior can diverge. Reviewers: mclow.lists, ldionne, sbenza Reviewed By: mclow.lists, ldionne Subscribers: libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D59678 llvm-svn: 357370
* Fix PR#35967: '<regex> syntax_option_type is not a proper bitmask' Sadly, ↵Marshall Clow2019-03-282-1/+5
| | | | | | this is an ABI break, so it's only available if you define either '_LIBCPP_ABI_VERSION > 2' or '_LIBCPP_ABI_UNSTABLE' or '_LIBCPP_ABI_REGEX_CONSTANTS_NONZERO' and rebuild your dylib. llvm-svn: 357190
* [libc++] Remove unnecessary <iostream> #includes in testsLouis Dionne2019-03-2825-46/+4
| | | | | | | Some tests #include <iostream> but they don't use anything from the header. Those are probably artifacts of when the tests were developped. llvm-svn: 357181
* Reworked all the utilities/meta tests to use ASSERT_SAME_TYPE instead of ↵Marshall Clow2019-03-2827-153/+120
| | | | | | 'static_assert( is_same<'. Much easier to read. I left two tests alone: is_same.pass.cpp, which should call 'is_same' directly, and common_type.pass.cpp, which Eric is working on. NFC intended llvm-svn: 357146
* [libc++] Rename span's as_writeable_bytes to as_writable_bytesLouis Dionne2019-03-283-52/+52
| | | | | | | | | | | | Summary: The Standard says as_writable_bytes. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D59882 llvm-svn: 357139
* Fix occurrences of _LIBCPP_ASSERT in span testsCasey Carter2019-03-273-8/+8
| | | | llvm-svn: 357092
* [libc++] Add proper XFAILs for shared_mutex testsLouis Dionne2019-03-2714-2/+13
| | | | | | | | | | Dylib support for shared_mutex was added in macOS 10.12, so the tests should be XFAILed accordingly instead of being completely disabled whenever availability is enabled. rdar://problem/48769104 llvm-svn: 357079
* Revert "[coroutines] Add std::experimental::task<T> type"Brian Gesiak2019-03-2610-1172/+0
| | | | | | | | This revision is causing build and test failures, such as http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv8-linux/builds/648/steps/test.libcxx/logs/stdio, so I'll revert it. llvm-svn: 357023
* [coroutines] Add std::experimental::task<T> typeBrian Gesiak2019-03-2610-0/+1172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adds the coroutine `std::experimental::task<T>` type described in proposal P1056R0. See https://wg21.link/P1056R0. This implementation allows customization of the allocator used to allocate the coroutine frame by passing std::allocator_arg as the first argument, followed by the allocator to use. This supports co_awaiting the same task multiple times. The second and subsequent times it returns a reference to the already-computed value. This diff also adds some implementations of other utilities that have potential for standardization as helpers within the test/... area: - `sync_wait(awaitable)` - See P1171R0 - `manual_reset_event` Move the definition of the __aligned_allocation_size helper function from <experimental/memory_resource> to <experimental/__memory> so it can be more widely used without pulling in memory_resource. Outstanding work: - Use C++14 keywords directly rather than macro versions eg. use `noexcept` instead of `_NOEXCEPT`). - Add support for overaligned coroutine frames. This may need wording in the Coroutines TS to support passing the extra `std::align_val_t`. - Eliminate use of `if constexpr` if we want it to compile under C++14. Patch by @lewissbaker (Lewis Baker). llvm-svn: 357010
* Cleaup of requirements for optional. While researching LWG3196, I realized ↵Marshall Clow2019-03-251-0/+47
| | | | | | that optional did not reject 'const in_place_t' like it should. Added a test as well, and a check for arrays (which were already disallowed, but now we get a better error message). Should not affect anyone's code. llvm-svn: 356918
* Fix a minor bug with std::next and prev not and negative numbers. In ↵Marshall Clow2019-03-225-13/+145
| | | | | | particular, std::prev cannot require Bidirectional Iterators, because you might 'go back' -1 places, which goes forward. Thanks to Ville and Jonathan for the bug report. llvm-svn: 356818
* Fix a vector test to not use a local type as a template parameter. This ↵Marshall Clow2019-03-221-7/+9
| | | | | | causes a warning on C++03. NFC llvm-svn: 356726
* [libc++] Remove too-stringent XFAILs for file_clock testsLouis Dionne2019-03-213-4/+0
| | | | | | | Those tests actually pass because we don't use anything that's marked as unavailable. llvm-svn: 356719
* [libc++] Mark bad_any_cast tests as unsupported when the dylib doesn't ↵Louis Dionne2019-03-213-12/+3
| | | | | | | | | support bad_any_cast With the latest compiler fix to availability, some availability failures that didn't trigger before now trigger. llvm-svn: 356678
* Mark debug death tests as unsupported on WindowsEric Fiselier2019-03-2111-2/+11
| | | | llvm-svn: 356639
* [libcxx] [test] Revert r356632 add (void) casts to operator new calls, to ↵Billy Robert O'Neal III2019-03-216-6/+6
| | | | | | suppress warnings generated by [[nodiscard]]." llvm-svn: 356635
* Allow disabling of filesystem library.Eric Fiselier2019-03-214-0/+7
| | | | | | | | | | | | | | Summary: Filesystem doesn't work on Windows, so we need a mechanism to turn it off for the time being. Reviewers: ldionne, serge-sans-paille, EricWF Reviewed By: EricWF Subscribers: mstorsjo, mgorny, christof, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D59619 llvm-svn: 356633
* [libcxx] [test] Add (void) casts to operator new calls, to suppress warnings ↵Billy Robert O'Neal III2019-03-206-6/+6
| | | | | | | | generated by [[nodiscard]]. This allows these tests to pass when compiled by MSVC++. llvm-svn: 356632
* [libc++] Mark <filesystem> as unavailable on Apple platforms using pragmasLouis Dionne2019-03-203-0/+4
| | | | | | | | | | | | | | | | | | | | | Summary: Also add the corresponding XFAILs to tests that require filesystem. The approach taken to mark <filesystem> as unavailable in this patch is to mark all the header as unavailable using #pragma clang attribute. Marking each declaration using the attribute is more intrusive and does not provide a lot of value right now because pretty much everything in <filesystem> requires dylib support, often transitively. This is an alternative to https://reviews.llvm.org/D59093. A similar (but partial) patch was already applied in r356558. Reviewers: mclow.lists, EricWF, serge-sans-paille Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D59224 llvm-svn: 356616
* Mark <charconv> tests as unsupported for C++11 and C++14 if you're not ↵Marshall Clow2019-03-204-0/+8
| | | | | | testing libc++. Thanks to Louis for the suggestion. llvm-svn: 356602
* Make to_chars/from_chars work back to C++11. This means that we can use them ↵Marshall Clow2019-03-205-10/+11
| | | | | | to implement to_string as well. Reviewed as https://reviews.llvm.org/D59598. llvm-svn: 356585
* [libc++] Mark <filesystem> tests as failing when the dylib doesn't support ↵Louis Dionne2019-03-2010-0/+14
| | | | | | | | | | | | filesystem This fixes CI for back-deployment testers on platforms that don't have <filesystem> support in the dylib. This is effectively half of https://reviews.llvm.org/D59224. The other half requires fixes in Clang. llvm-svn: 356558
OpenPOWER on IntegriCloud