summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* [libc++] Remove C++03 variadics in shared_ptr (v2)Zoe Carver2019-10-071-70/+0
| | | | | | | | | | | | | | Summary: In my last patch (D67675) I forgot a few variadics. This patch removes the remaining make_shared and allocate_shared C++03 variadics. Reviewers: ldionne, EricWF, mclow.lists Subscribers: christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D68000 llvm-svn: 373971
* [libc++] Harden usage of static_assert against C++03Louis Dionne2019-10-011-2/+2
| | | | | | | In C++03, we emulate static_assert with a macro, and we must parenthesize multiple arguments. llvm-svn: 373328
* Refactor default constructor SFINAE in pair and tuple.Eric Fiselier2019-09-303-44/+29
| | | | | | | Refactor the recent implicit default constructor changes to match the existing SFINAE style. llvm-svn: 373263
* [libc++] Take 2: Implement LWG 3158Louis Dionne2019-09-271-13/+29
| | | | | | | | | | | | | | | | | | | | | Summary: LWG 3158 marks the allocator_arg_t constructor of std::tuple as conditionnally explicit based on whether the default constructors of the tuple's members are explicitly default constructible. This was previously committed as r372778 and reverted in r372832 due to the commit breaking LLVM's build in C++14 mode. This issue has now been addressed. Reviewers: mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65232 llvm-svn: 373092
* [libc++] Take 2: Implement LWG 2510Louis Dionne2019-09-267-23/+85
| | | | | | | | | | | | | | | | | | | | | | | Summary: LWG2510 makes tag types like allocator_arg_t explicitly default constructible instead of implicitly default constructible. It also makes the constructors for std::pair and std::tuple conditionally explicit based on the explicit-ness of the default constructibility for the pair/tuple's elements. This was previously committed as r372777 and reverted in r372832 due to the commit breaking LLVM's build in C++14 mode. This issue has now been addressed. Reviewers: mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372983
* [libcxx] Do not implicitly #include assert.hDavid Zarzycki2019-09-262-2/+0
| | | | | | | | | Users should only get the assert() macros if they explicitly include them. Found after switching from the GNU C++ stdlib to the LLVM C++ stdlib. llvm-svn: 372963
* Add forward declaration of operator<< in <string_view> as required.Eric Fiselier2019-09-252-1/+8
| | | | | | | | This declaration was previously missing despite appearing in the synopsis. Users are still required to include <ostream> to get the definition of the streaming operator. llvm-svn: 372909
* Add a missing default parameter to regex::assign. This is LWG3296; reviewed ↵Marshall Clow2019-09-251-6/+6
| | | | | | as https://reviews.llvm.org/D67944 llvm-svn: 372896
* Revert r372777: [libc++] Implement LWG 2510 and its follow-upsIlya Biryukov2019-09-257-96/+27
| | | | | | | | | | | | This also reverts: - r372778: [libc++] Implement LWG 3158 - r372782: [libc++] Try fixing tests that fail on GCC 5 and older - r372787: Purge mentions of GCC 4 from the test suite Reason: the change breaks compilation of LLVM with libc++, for details see http://lists.llvm.org/pipermail/libcxx-dev/2019-September/000599.html llvm-svn: 372832
* [libc++] Remove C++03 variadics in shared_ptrZoe Carver2019-09-241-194/+0
| | | | | | | | | | | | | | Summary: As suggested by @ldionne in D66178, this patch removes C++03 variadics //only//. Following patches will apply more updates. Reviewers: ldionne, EricWF, mclow.lists Subscribers: christof, dexonsmith, libcxx-commits, ldionne Tags: #libc Differential Revision: https://reviews.llvm.org/D67675 llvm-svn: 372780
* [libc++] Implement LWG 3158Louis Dionne2019-09-241-13/+29
| | | | | | | | | | | | | | | | | Summary: LWG 3158 marks the allocator_arg_t constructor of std::tuple as conditionnally explicit based on whether the default constructors of the tuple's members are explicitly default constructible. Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65232 llvm-svn: 372778
* [libc++] Implement LWG 2510Louis Dionne2019-09-247-23/+76
| | | | | | | | | | | | | | | | | | | Summary: LWG2510 makes tag types like allocator_arg_t explicitly default constructible instead of implicitly default constructible. It also makes the constructors for std::pair and std::tuple conditionally explicit based on the explicit-ness of the default constructibility for the pair/tuple's elements. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372777
* Revert "Extension: Mark the default constructor of chrono::duration as ↵Marshall Clow2019-09-231-1/+1
| | | | | | | | conditionally noexcept"; this breaks the gcc5 bot for C++11 This reverts commit c8ca15c95c4c0d6d1356500d5fe49a319ea4ca01. llvm-svn: 372546
* Extension: Mark the default constructor of chrono::duration as conditionally ↵Marshall Clow2019-09-231-1/+1
| | | | | | noexcept llvm-svn: 372539
* Revert "Revert "Implement std::condition_variable via ↵Dan Albert2019-09-182-17/+138
| | | | | | | | | | pthread_cond_clockwait() where available"" With the fix for non-Linux. This reverts commit c1c519d2f1a66dd2eeaa4c321d8d7b50f623eb71. llvm-svn: 372242
* Revert "Implement std::condition_variable via pthread_cond_clockwait() where ↵Dan Albert2019-09-162-134/+17
| | | | | | | | available" This reverts commit 5e37d7f9ff257ec62d733d3d94b11f03e0fe51ca. llvm-svn: 372034
* Open fstream files in O_CLOEXEC mode when possible.Dan Albert2019-09-162-12/+23
| | | | | | | | | | | | | | Reviewers: EricWF, mclow.lists, ldionne Reviewed By: ldionne Subscribers: smeenai, dexonsmith, christof, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D59839 llvm-svn: 372027
* Implement std::condition_variable via pthread_cond_clockwait() where availableDan Albert2019-09-162-17/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::condition_variable is currently implemented via pthread_cond_timedwait() on systems that use pthread. This is problematic, since that function waits by default on CLOCK_REALTIME and libc++ does not provide any mechanism to change from this default. Due to this, regardless of if condition_variable::wait_until() is called with a chrono::system_clock or chrono::steady_clock parameter, condition_variable::wait_until() will wait using CLOCK_REALTIME. This is not accurate to the C++ standard as calling condition_variable::wait_until() with a chrono::steady_clock parameter should use CLOCK_MONOTONIC. This is particularly problematic because CLOCK_REALTIME is a bad choice as it is subject to discontinuous time adjustments, that may cause condition_variable::wait_until() to immediately timeout or wait indefinitely. This change fixes this issue with a new POSIX function, pthread_cond_clockwait() proposed on http://austingroupbugs.net/view.php?id=1216. The new function is similar to pthread_cond_timedwait() with the addition of a clock parameter that allows it to wait using either CLOCK_REALTIME or CLOCK_MONOTONIC, thus allowing condition_variable::wait_until() to wait using CLOCK_REALTIME for chrono::system_clock and CLOCK_MONOTONIC for chrono::steady_clock. pthread_cond_clockwait() is implemented in glibc (2.30 and later) and Android's bionic (Android API version 30 and later). This change additionally makes wait_for() and wait_until() with clocks other than chrono::system_clock use CLOCK_MONOTONIC.<Paste> llvm-svn: 372016
* Add debug check for null pointers passed to <string_view>Eric Fiselier2019-09-142-1/+13
| | | | llvm-svn: 371925
* Fix C++03 build failures due to >>Eric Fiselier2019-09-131-1/+1
| | | | llvm-svn: 371894
* Fix various test failures with GCCEric Fiselier2019-09-131-2/+2
| | | | llvm-svn: 371880
* Recommit r370502: Make `vector` unconditionally move elements whenEric Fiselier2019-09-132-10/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | exceptions are disabled. The patch was reverted due to some confusion about non-movable types. ie types that explicitly delete their move constructors. However, such types do not meet the requirement for `MoveConstructible`, which is required by `std::vector`: Summary: `std::vector<T>` is free choose between using copy or move operations when it needs to resize. The standard only candidates that the correct exception safety guarantees are provided. When exceptions are disabled these guarantees are trivially satisfied. Meaning vector is free to optimize it's implementation by moving instead of copying. This patch makes `std::vector` unconditionally move elements when exceptions are disabled. This optimization is conforming according to the current standard wording. There are concerns that moving in `-fno-noexceptions`mode will be a surprise to users. For example, a user may be surprised to find their code is slower with exceptions enabled than it is disabled. I'm sympathetic to this surprised, but I don't think it should block this optimization. Reviewers: mclow.lists, ldionne, rsmith Reviewed By: ldionne Subscribers: zoecarver, christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D62228 llvm-svn: 371867
* Consolidate swap, swap_ranges, and iter_swap in <type_traits>.Zoe Carver2019-09-112-22/+26
| | | | | | NFC. Thanks to @Quuxplusone (Arthur O'Dwyer) for this change. llvm-svn: 371639
* Remove ::gets for FreeBSD 13 and laterDimitry Andric2019-09-072-1/+8
| | | | | | | | | | | | | | | | | | Summary: In https://svnweb.freebsd.org/changeset/base/351659 @emaste removed gets() from FreeBSD 13's libc, and our copies of libc++ and libstdc++. In that change, the declarations were simply deleted, but I would like to propose this conditional test instead. Reviewers: EricWF, mclow.lists, emaste Reviewed By: mclow.lists Subscribers: krytarowski, christof, ldionne, emaste, libcxx-commits Differential Revision: https://reviews.llvm.org/D67316 llvm-svn: 371324
* [libc++] Revert "Make `vector` unconditionally move elements when exceptions ↵Louis Dionne2019-09-052-25/+10
| | | | | | | | | | are disabled." This reverts r370502, which broke the use case of a copy-only T (with a deleted move constructor) when exceptions are disabled. Until we figure out the right behavior, I'm reverting the commit. llvm-svn: 371068
* [libc++] Move __clamp_to_integral to <cmath>, and harden against min()/max() ↵Louis Dionne2019-09-042-34/+36
| | | | | | macros llvm-svn: 370900
* [libc++] Add `__truncating_cast` for safely casting float types to integersLouis Dionne2019-09-041-0/+34
| | | | | | | | | | | This is needed anytime we need to clamp an arbitrary floating point value to an integer type. Thanks to Eric Fiselier for the patch. Differential Revision: https://reviews.llvm.org/D66836 llvm-svn: 370891
* [libc++] Use __extension__ in a portable mannerLouis Dionne2019-09-042-1/+9
| | | | llvm-svn: 370889
* [libc++] Mark usage of _Atomic with __extension__Louis Dionne2019-09-031-1/+1
| | | | | | | | | An upcoming change in Clang will flag _Atomic as being a C11 extension. To avoid generating this warning in libc++, this commit marks the only use of _Atomic with the __extension__ extension, which suppresses such warnings. llvm-svn: 370796
* Make `vector` unconditionally move elements when exceptions are disabled.Eric Fiselier2019-08-302-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | Summary: `std::vector<T>` is free choose between using copy or move operations when it needs to resize. The standard only candidates that the correct exception safety guarantees are provided. When exceptions are disabled these guarantees are trivially satisfied. Meaning vector is free to optimize it's implementation by moving instead of copying. This patch makes `std::vector` unconditionally move elements when exceptions are disabled. This optimization is conforming according to the current standard wording. There are concerns that moving in `-fno-noexceptions`mode will be a surprise to users. For example, a user may be surprised to find their code is slower with exceptions enabled than it is disabled. I'm sympathetic to this surprised, but I don't think it should block this optimization. Reviewers: mclow.lists, ldionne, rsmith Reviewed By: ldionne Subscribers: zoecarver, christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D62228 llvm-svn: 370502
* [libc++] Fix visibility of __vector_base_common on GCCLouis Dionne2019-08-281-1/+1
| | | | | | | | | | | Since we build the library with -fvisibility=hidden, the shared object wouldn't contain __vector_base_common<true>::__throw_length_error() and __vector_base_common<true>::__throw_out_of_range(), leading to link errors. This only happened on GCC for some reason. https://llvm.org/PR43140 llvm-svn: 370240
* [libcxx] Only declare contents of threading API whenDavid Spickett2019-08-211-2/+5
| | | | | | | | | | | _LIBCPP_HAS_THREAD_API_EXTERNAL is not defined. When it is defined they will be declared by the __external_threading header instead. Differential revision: https://reviews.llvm.org/D66518 llvm-svn: 369537
* Add a missing _VSTD:: before a call to merge. Fixes PR43034. Checked the ↵Marshall Clow2019-08-201-1/+1
| | | | | | rest of 'algorithm' looking for unqualified calls. Didn't find any. llvm-svn: 369463
* Fix a couple of unguarded operator, calls in algorithm. Fixes PR#43063. ↵Marshall Clow2019-08-201-13/+13
| | | | | | Updated all the heap tests to check this. llvm-svn: 369448
* [libc++] Implement LWG 3199Louis Dionne2019-08-201-1/+1
| | | | | | | | | | | | | | | | Summary: The resolution of LWG 3199 makes sure that input-streaming into an empty bitset does not set the failbit on the input stream. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65105 llvm-svn: 369422
* Fix availability of __thread_id on builds with external threading. Reviewed ↵Marshall Clow2019-08-201-8/+11
| | | | | | as https://reviews.llvm.org/D66480 llvm-svn: 369399
* [libc++] Explicitly cast in generate_canonicalLouis Dionne2019-08-201-1/+1
| | | | | | | | | | A new clang warning introduced in r367497 was complaining about the change in value. Thanks to Brian Cain for the patch. Differential Revision: https://reviews.llvm.org/D66422 llvm-svn: 369393
* [libcxx] Fix build breakage on mipsMikhail Maltsev2019-08-201-1/+1
| | | | | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=43011 caused by https://reviews.llvm.org/D63284. Committing as obvious. llvm-svn: 369364
* [libc++] reverts commit a5f5aad568bb7a91ceee47641f3076ac339ef8c7.Zoe Carver2019-08-191-110/+260
| | | | | | | | | The commit being reverted caused segfaults when building with libc++ and GCC (and possibly other configurations). Differential Revision: https://reviews.llvm.org/D62868 llvm-svn: 369270
* Fix thread comparison by making sure we never pass our special 'not a ↵Marshall Clow2019-08-141-3/+11
| | | | | | thread' value to the underlying implementation. Fixes PR#42918. llvm-svn: 368916
* This commit removes std::shared_ptr::make_shared and ↵Zoe Carver2019-08-141-260/+110
| | | | | | std::shared_ptr::allocate_shared as they are not part of the standard. This commit also adds the helper function "__create_with_cntrl_block" which std::allocate_shared and std::make_shared have been updated to use. llvm-svn: 368885
* [libc++] Enable <chrono> ""d and ""y literals for AppleClang 10 and upLouis Dionne2019-08-141-3/+4
| | | | | | AppleClang supports those literals starting in version 10.0.1. llvm-svn: 368882
* [libc++] Do not define _LIBCPP_CLANG_VER for non-LLVM ClangLouis Dionne2019-08-141-6/+2
| | | | | | | | | | | | | In r292833, we started defining _LIBCPP_CLANG_VER to 0 for Apple Clang. The result is that AppleClang is detected as being a very old version of LLVM Clang (version 0), which is obviously incorrect. I believe this was added so that we don't have to check whether _LIBCPP_CLANG_VER is defined prior to comparing it with a number (which can trigger a warning). This commit also fixes the two places that use the macro correspondingly. llvm-svn: 368880
* Rework recursive_timed_mutex so that it uses __thread_id instead of using ↵Marshall Clow2019-08-143-72/+81
| | | | | | the lower-level __libcpp_thread_id. This is prep for fixing PR42918. Reviewed as https://reviews.llvm.org/D65895 llvm-svn: 368867
* [libc++] Always build with -fvisibility=hiddenLouis Dionne2019-08-132-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This avoids symbols being accidentally exported from the dylib when they shouldn't. The next step is to use a pragma to apply hidden visibility to all declarations (unless otherwise specified), which will allow us to drop the per-declaration hidden visibility attributes we currently have. This also has the nice side effect of making sure the dylib exports the same symbols regardless of the optimization level. PR38138 Reviewers: EricWF, mclow.lists Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D62868 llvm-svn: 368703
* [libc++] Use [[nodiscard]] for lock_guard, as an extensionLouis Dionne2019-08-131-2/+3
| | | | | | | | | | | | | | | | | | | Summary: D64914 added support for applying [[nodiscard]] to constructors. This commit uses that capability to flag incorrect uses of std::lock_guard where one forgets to actually create a variable for the lock_guard. rdar://45790820 Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits, Quuxplusone, lebedev.ri Tags: #libc Differential Revision: https://reviews.llvm.org/D65900 llvm-svn: 368664
* [libc++] Implement CTAD for std::tupleLouis Dionne2019-08-121-7/+21
| | | | | | | | | | | | | | | | | | | | | Summary: We were using implicit deduction guides instead of explicit ones, however the implicit ones don't do work anymore when changing the constructors. This commit adds the actual guides specified in the Standard to make libc++ (1) closer to the Standard and (2) more resistent to changes in std::tuple's constructors. Reviewers: Quuxplusone Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65225 llvm-svn: 368599
* Improve codegen for deque.Eric Fiselier2019-08-122-25/+117
| | | | | | | | | | | | | | | | | | | | | | | 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
* Implement hh_mm_ss from P1466R3. Reviewed as https://reviews.llvm.org/D65365.Marshall Clow2019-08-081-6/+114
| | | | llvm-svn: 368299
* [pstl][libc++] Provide uglified header names for interface headersLouis Dionne2019-08-064-4/+4
| | | | | | | | | | | For the few (currently four) headers that make up the PSTL's interface to other Standard Libraries, provide a stable uglified header file that can be included by those Standard Libraries. We can then more easily change the internal organization of the PSTL without having to change the integration with Standard Libraries. llvm-svn: 368088
OpenPOWER on IntegriCloud