summaryrefslogtreecommitdiffstats
path: root/libcxx
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup test failures in no discard tests.Eric Fiselier2019-04-032-0/+26
| | | | llvm-svn: 357637
* Attempt to upgrade compiler used by appveyor buildsEric Fiselier2019-04-031-1/+1
| | | | llvm-svn: 357632
* disable appveyor config for MSVC 2015Eric Fiselier2019-04-031-5/+6
| | | | llvm-svn: 357631
* libcxx: Add _LIBCPP_NODISCARD_EXT to 38 more functionsNico Weber2019-04-034-84/+536
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-033-5/+10
| | | | | | | Thanks to Zoe Carver for the patch. Differential Revision: https://reviews.llvm.org/D58097 llvm-svn: 357616
* Add more benchmarks for literal strings.Samuel Benzaquen2019-04-031-10/+42
| | | | | | | | | | | | | | | | | | Summary: Comparing against the empty string should generate much better code that what it does today. We can also generate better code when comparing against literals that are larger than the SSO space. Reviewers: EricWF Subscribers: christof, jdoerfert, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D59781 llvm-svn: 357614
* [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-032-1/+73
| | | | | | | | | | | | | | | | | | | | | 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-032-61/+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
* [CMake] Differentiate between static and shared libc++abiPetr Hosek2019-04-032-22/+25
| | | | | | | | | | | | | | | This addresses the issue introduced in r354212 which broke the case when static libc++abi is merged into static libc++, but shared libc++ is linked against shared libc++. There are 4 different possible combinations which is difficult to capture using a single variable. This change splits LIBCXX_CXX_ABI_LIBRARY into two: LIBCXX_CXX_SHARED_ABI_LIBRARY and LIBCXX_CXX_STATIC_ABI_LIBRARY to handle the shared and static cases. This in turn allows simplification of some of the logic around merging of static archives. Differential Revision: https://reviews.llvm.org/D60114 llvm-svn: 357556
* [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
* Fix backwards test that I committed yesterday. SighMarshall Clow2019-04-031-2/+2
| | | | llvm-svn: 357540
* Revert "[libc++] Fix error flags and exceptions propagated from input stream ↵Louis Dionne2019-04-0242-2480/+533
| | | | | | | | | | 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 build when exceptions are turned offLouis Dionne2019-04-021-1/+1
| | | | llvm-svn: 357533
* [libc++] Fix error flags and exceptions propagated from input stream operationsLouis Dionne2019-04-0242-533/+2480
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-022-0/+61
| | | | | | | | | | | | | | | | 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
* [libc++] Remove use of auto with actual typeLouis Dionne2019-04-021-2/+2
| | | | | | For compatibility with C++03. llvm-svn: 357512
* [libc++][NFC] Remove useless public: label at the end of classLouis Dionne2019-04-021-1/+0
| | | | llvm-svn: 357511
* Special case some duration arithmetic for GCC and PPC because their long ↵Marshall Clow2019-04-021-0/+5
| | | | | | double constant folding is broken. Fixes PR#39696. llvm-svn: 357478
* Fix typo that I introduced in r357413. Thanks to ensadc@mailnesia.com for ↵Marshall Clow2019-04-021-1/+2
| | | | | | the catch. llvm-svn: 357474
* Fix a number of bugs in __val_expr's subset operator[].Eric Fiselier2019-04-029-222/+359
| | | | | | | | 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-015-1/+163
| | | | | | | | | | | | 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
* Fix PR#41323 'Race condition in steady_clock::now for _LIBCPP_WIN32API'. ↵Marshall Clow2019-04-011-6/+15
| | | | | | thanks to Ivan Afanasyev for the report. llvm-svn: 357413
* [libc++] Declare std::tuple_element as struct instead of classLouis Dionne2019-04-019-32/+19
| | | | | | | | | | | | 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-019-28/+139
| | | | | | 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-312-152/+154
| | | | | | | | | | | | | | | | | | | 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
* Mark fenv.h as a system header before the #include_next directiveEric Fiselier2019-03-291-1/+2
| | | | | | | | This fixes a -Wgnu-include-next warning Patch by dmauro. llvm-svn: 357267
* Fix PR#35967: '<regex> syntax_option_type is not a proper bitmask' Sadly, ↵Marshall Clow2019-03-284-13/+51
| | | | | | 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-284-58/+58
| | | | | | | | | | | | 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 and speedup __libcpp_locale_guard on WindowsThomas Anderson2019-03-271-19/+33
| | | | | | | | | | | | | | The old implementation assumed the POSIX `setlocale()` API where the old locale is returned. On Windows, the _new_ locale is returned. This meant that `__libcpp_locale_guard` wasn't resetting the locale on destruction. The new implementation fixes the above issue and takes advantage of `setlocale(LC_ALL)` to reduce the number of calls, and also avoids setting the locale at all if it's not necessary. Differential Revision: https://reviews.llvm.org/D59572 llvm-svn: 357104
* 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-2715-2/+17
| | | | | | | | | | 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
* [libc++] Fix return value of snprintf_l() on Windows when buffer is too smallThomas Anderson2019-03-261-4/+5
| | | | | | | | | | | | | | | | | When the output buffer is too small to contain the output, `vsnprintf()` fills the buffer and returns the number of characters that __would have__ been written if the buffer was sufficiently large. `_vnsprintf_s()` on the other hand fills the buffer and returns -1 when this happens. We want the former behavior, but we also want to be able to pass in a locale to prevent having to call `setlocale()`. `__stdio_common_vsprintf()` is the only function general enough to get the behavior we want. Differential Revision: https://reviews.llvm.org/D59727 llvm-svn: 357024
* Revert "[coroutines] Add std::experimental::task<T> type"Brian Gesiak2019-03-2615-1687/+8
| | | | | | | | 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-2615-8/+1687
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-252-1/+50
| | | | | | 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
* [libc++][CMake] Allow merging libc++abi.a into libc++ even on Apple platformsLouis Dionne2019-03-253-11/+12
| | | | | | | | | | | | | | | | | | | | Summary: I can't see a good reason to disallow this, even though it isn't the standard way we build libc++ for Apple platforms. Making this work on Apple platforms requires using different flags for --whole-archive and removing the -D flag when running `ar` to merge archives because that flag isn't supported by the `ar` shipped on Apple platforms. This shouldn't be an issue since the -D option appears to be enabled by default in GNU `ar`. Reviewers: phosek, EricWF, serge-sans-paille Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D59513 llvm-svn: 356903
* Fix a minor bug with std::next and prev not and negative numbers. In ↵Marshall Clow2019-03-226-18/+157
| | | | | | 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
* [libc++] Update the list of symbols exported from libc++abi for new/deleteLouis Dionne2019-03-221-2/+14
| | | | | | | | When libc++ does not provide new/delete, libc++abi now also provides the aligned allocation and deallocation functions, so those should be part of the re-export list for libc++. llvm-svn: 356804
* [libc++] Re-export the sjlj ABI v2 for ARM architecturesLouis Dionne2019-03-222-1/+311
| | | | | | We were previously not exporting the right ABI version of libc++abi. llvm-svn: 356798
* 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
* [NFC][libc++] Reindent #ifdefsLouis Dionne2019-03-211-12/+12
| | | | | | | | I don't understand why we don't always do that. We do it for normal `if`s in the code, but not for preprocessor `if`s? It's a lot more readable when indented properly. llvm-svn: 356693
* [libc++] Re-document how to use <filesystem> with various versions of libc++Louis Dionne2019-03-211-0/+10
| | | | | | | | | This documentation was removed when we added <filesystem> to the dylib in r356518, but it really should have been updated to reflect the new state of things. Keeping documentation around doesn't hurt and users will have an easier time migrating. llvm-svn: 356681
* Add relational benchmark against a string constant.Samuel Benzaquen2019-03-211-4/+44
| | | | | | | | | | | | | | | | | Summary: Add relational benchmark against a string constant. These can potentially trigger inlining of the operations. We want to benchmark that. Reviewers: EricWF Subscribers: christof, jdoerfert, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D59512 llvm-svn: 356680
* [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
OpenPOWER on IntegriCloud