summaryrefslogtreecommitdiffstats
path: root/libcxx/include/utility
Commit message (Collapse)AuthorAgeFilesLines
* Refactor default constructor SFINAE in pair and tuple.Eric Fiselier2019-09-301-14/+9
| | | | | | | Refactor the recent implicit default constructor changes to match the existing SFINAE style. llvm-svn: 373263
* [libc++] Take 2: Implement LWG 2510Louis Dionne2019-09-261-6/+26
| | | | | | | | | | | | | | | | | | | | | | | 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
* Revert r372777: [libc++] Implement LWG 2510 and its follow-upsIlya Biryukov2019-09-251-26/+6
| | | | | | | | | | | | 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++] Implement LWG 2510Louis Dionne2019-09-241-6/+26
| | | | | | | | | | | | | | | | | | | 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
* Consolidate swap, swap_ranges, and iter_swap in <type_traits>.Zoe Carver2019-09-111-21/+3
| | | | | | NFC. Thanks to @Quuxplusone (Arthur O'Dwyer) for this change. llvm-svn: 371639
* [NFC][libc++] Add missing EXPLICIT to pair and tuple synopsisLouis Dionne2019-07-221-4/+4
| | | | | | | The constructors for std::pair and std::tuple have been made conditionally explicit, however the synopsis in the headers do not reflect that. llvm-svn: 366735
* This patch makes swap functions constexpr. Both swap overloads, swap_ranges ↵Zoe Carver2019-07-051-2/+2
| | | | | | and iter_swap are updated (with tests). llvm-svn: 365238
* Fix -Wdouble-promotion warnings.Bruce Mitchener2019-07-011-2/+2
| | | | | | | | | | Reviewers: mclow.lists Subscribers: christof, ldionne, cfe-commits, libcxx-commits Differential Revision: https://reviews.llvm.org/D62782 llvm-svn: 364798
* Apply [[nodebug]] to typedefs throughout the STL.Eric Fiselier2019-06-121-16/+16
| | | | | | | | | | | | | | | | When applied to a typedef or alias template, the [[nodebug]] attribute makes the typedef transparent to the debugger, so instead of seeing `std::__function::__alloc_func<remove_reference<void(&)()>::type, allocator<remove_reference<void(&)()>, void()>::_Target` you see `void(&)()` as the type of the variable in your debugger. Removing all this SFINAE noise from debug info has huge binary size wins, in addition to improving the readability. For now this change is on by default. Users can override it by specifying -D_LIBCPP_NODEBUG_TYPE= llvm-svn: 363117
* [libc++] Declare std::tuple_element as struct instead of classLouis Dionne2019-04-011-6/+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
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | 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
* Fix PR40230 - std::pair may have padding on FreeBSD.Eric Fiselier2019-01-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: FreeBSD ships a very old and deprecated ABI for std::pair where the copy and move constructors are not allowed to be trivial. D25389 change how this was implemented by introducing a non-trivial base class. This patch, introduced in October 2016, introduced an ABI bug that caused nested `std::pair` instantiations to have padding. For example: ``` using PairT = std::pair< std::pair<char, char>, char >; static_assert(offsetof(PairT, first) == 0, "First member should exist at offset zero"); // Fails on FreeBSD! ``` The bug occurs because the base class for the first element (the nested pair) cannot be put at offset zero because the top-level pair already has the same base class laid out there. This patch fixes that ABI bug by templating the dummy base class on the same parameters as the pair. Technically this fix is an ABI break for users who depend on the "broken" ABI introduced in 2016. I'm putting this up for review so that the FreeBSD maintainers can sign off on fixing the ABI by breaking the ABI. Another option, since we have to "break" the ABI to fix it, would be to move FreeBSD off the deprecated non-trivial pair ABI instead. Also see: * https://llvm.org/PR40230 * https://reviews.llvm.org/D21329 Reviewers: rsmith, dim, emaste Reviewed By: rsmith Subscribers: mclow.lists, krytarowski, christof, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D56357 llvm-svn: 351290
* Change from a to a . Fixes PR#39871.Marshall Clow2019-01-111-2/+2
| | | | llvm-svn: 350972
* [pair] Mark constructors as conditionally noexceptLouis Dionne2018-12-111-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: std::tuple marks its constructors as noexcept when the corresponding memberwise constructors are noexcept too -- this commit improves std::pair so that it behaves the same. This is a re-application of r348824, which broke the build in C++03 mode because a test was marked as supported in C++03 when it shouldn't be. Note: I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)` constructors because those are non-standard extensions, and supporting them properly is tedious (we have to copy the rvalue-referenceness of the deduced _Tuple&& onto the result of tuple_element). <rdar://problem/29537079> Reviewers: mclow.lists, EricWF Subscribers: christof, llvm-commits Differential Revision: https://reviews.llvm.org/D48669 llvm-svn: 348847
* Revert "[pair] Mark constructors as conditionally noexcept"Louis Dionne2018-12-111-21/+1
| | | | | | | This broke the tests on Linux. Reverting until I find out why the tests are broken (tomorrow). llvm-svn: 348825
* [pair] Mark constructors as conditionally noexceptLouis Dionne2018-12-111-1/+21
| | | | | | | | | | | | | | | | | | | | | | | Summary: std::tuple marks its constructors as noexcept when the corresponding memberwise constructors are noexcept too -- this commit improves std::pair so that it behaves the same. Note: I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)` constructors because those are non-standard extensions, and supporting them properly is tedious (we have to copy the rvalue-referenceness of the deduced _Tuple&& onto the result of tuple_element). <rdar://problem/29537079> Reviewers: mclow.lists, EricWF Subscribers: christof, llvm-commits Differential Revision: https://reviews.llvm.org/D48669 llvm-svn: 348824
* [libcxx] Implement P0318: unwrap_ref_decay and unwrap_referenceLouis Dionne2018-12-031-15/+20
| | | | | | | | | | | | | | | | | | Summary: This was voted into C++20 in San Diego. Note that there was a revision D0318R2 which did include unwrap_reference_t, but we mistakingly voted P0318R1 into the C++20 Working Draft (which does not include unwrap_reference_t). This patch implements D0318R2, which is what we'll end up with in the Working Draft once this mistake has been fixed. Reviewers: EricWF, mclow.lists Subscribers: christof, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D54485 llvm-svn: 348138
* Fix -Wimplicit-fallthrough warningFangrui Song2018-11-071-0/+2
| | | | | | | | | | | | Reviewers: EricWF, ldionne, mclow.lists Reviewed By: ldionne Subscribers: christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D54234 llvm-svn: 346369
* [libc++] Make sure we can build libc++ with -fvisibility=hiddenLouis Dionne2018-10-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: When building with -fvisibility=hidden, some symbols do not get exported from libc++.dylib. This means that some entities are not explicitly given default visibility in the source code, and that we rely on the fact -fvisibility=default is the default. This commit explicitly gives default visibility to those symbols to avoid being dependent on the command line flags used. The commit also remove symbols from the dylib -- those symbols do not actually need to be exported from the dylib and this should not be an ABI break. Finally, in the future, we may want to mark the whole std:: namespace as having hidden visibility (to switch from opt-out to opt-in), in which case the changes done in this commit will be required. Reviewers: EricWF Subscribers: mgorny, christof, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D52662 llvm-svn: 345260
* Fix even more Clang warnings.Eric Fiselier2018-10-011-3/+3
| | | | | | | This patch disables shift-sign-overflow warnings for now. It also fixes most -Wfloat-equal warnings and -Wextra-semi warnings. llvm-svn: 343438
* Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow2018-09-121-0/+1
| | | | | | feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
* [libc++] Remove _LIBCPP_BUILDING_XXX macros, which are redundant since ↵Louis Dionne2018-08-011-1/+1
| | | | | | | | | | | | | | _LIBCPP_BUILDING_LIBRARY Summary: As suggested by Marshall in https://reviews.llvm.org/D49914 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50008 llvm-svn: 338475
* [NFC] Add <initializer_list> to the synopsis of <utility>Louis Dionne2018-07-051-0/+2
| | | | | | | | | | | | | | Summary: It is part of the synopsis in the Standard and <utility> does include it, but it was left out of the synopsis comment. Reviewers: EricWF, mclow.lists Subscribers: christof, llvm-commits Differential Revision: https://reviews.llvm.org/D48611 llvm-svn: 336368
* Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catchMarshall Clow2018-02-111-1/+1
| | | | llvm-svn: 324851
* Last batch of P0202 constexpr additions: includes/set_intersection/exchangeMarshall Clow2018-01-221-1/+1
| | | | llvm-svn: 323159
* Temporarily revert the inlining of 'piecewise_construct' because it is ↵Marshall Clow2018-01-021-1/+1
| | | | | | exported from the dylib. llvm-svn: 321663
* Implement most of P0607: Inline Variables for the Standard Library. This ↵Marshall Clow2018-01-021-14/+5
| | | | | | involved marking a lot of variables as inline (but only for C++17 and later). llvm-svn: 321658
* Add C++17 explicit deduction guides to std::pair.Eric Fiselier2017-10-041-0/+5
| | | | | | | This patch adds the newly standardized deduction guides for std::pair, allowing it to work class template deduction. llvm-svn: 314864
* Add an `__is_inplace_index` metafunction.Michael Park2017-06-141-0/+6
| | | | | | | | | | | | Summary: This is used to constrain `variant`'s converting constructor correctly. Reviewers: EricWF, mclow.lists Reviewed By: EricWF, mclow.lists Differential Revision: https://reviews.llvm.org/D34111 llvm-svn: 305370
* Make tuple_element static_assert in pair if the index is out of range. Also, ↵Marshall Clow2017-06-121-0/+6
| | | | | | add a message to variant_alternative<> in the similar case (it already asserted). Add tests for this llvm-svn: 305196
* Fix dllimport on a class templateEric Fiselier2017-04-201-1/+1
| | | | llvm-svn: 300808
* Cleanup remaining usages of _LIBCPP_HAS_NO_<c++11-feature> in tuple and utilityEric Fiselier2017-04-191-19/+12
| | | | llvm-svn: 300644
* Fix hash requirements check in __hash_table.Eric Fiselier2017-03-031-3/+8
| | | | | | | | | | | | | | r296565 attempted to add better diagnostics when an unordered container is instantiated with a hash that doesn't meet the Hash requirements. However I mistakenly checked the wrong set of requirements. Specifically it checked if the hash met the requirements for specializations of std::hash. However these requirements are stricter than the generic Hash requirements. This patch fixes the assertions to only check the Hash requirements. llvm-svn: 296919
* Prevent UBSAN from generating unsigned overflow diagnostics in the hashing ↵Eric Fiselier2017-02-081-10/+23
| | | | | | internals llvm-svn: 294391
* Implement P0513R0 - "Poisoning the Hash"Eric Fiselier2017-01-211-0/+640
| | | | | | | | | | | | | | | | | | | | | Summary: Exactly what the title says. This patch also adds a `std::hash<nullptr_t>` specialization in C++17, but it was not added by this paper and I can't find the actual paper that adds it. See http://wg21.link/P0513R0 for more info. If there are no comments in the next couple of days I'll commit this Reviewers: mclow.lists, K-ballo, EricWF Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28938 llvm-svn: 292684
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-6/+6
| | | | | | | | | | | | | The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both _LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to __attribute__((__type_visibility__)) with Clang. The only remaining difference is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas _LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on templates). This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS. llvm-svn: 291035
* Workaround compilers w/o C++1z inline variablesEric Fiselier2016-11-171-3/+12
| | | | llvm-svn: 287255
* Implement P0504R0: Revisiting in-place tag types for any/optional/variantEric Fiselier2016-11-171-53/+29
| | | | llvm-svn: 287250
* Update issue status for LWG 2744Eric Fiselier2016-10-161-4/+14
| | | | llvm-svn: 284322
* Fix std::pair on FreeBSDEric Fiselier2016-10-111-20/+12
| | | | | | | | | | | | | | | | Summary: FreeBSD ships an old ABI for std::pair which requires that it have non-trivial copy/move constructors. Currently the non-trivial copy/move is achieved by providing explicit definitions of the constructors. This is problematic because it means the constructors don't SFINAE properly. In order to SFINAE copy/move constructors they have to be explicitly defaulted and hense non-trivial. This patch attempts to provide SFINAE'ing copy/move constructors for std::pair while still making them non-trivial. It does this by adding a base class with a non-trivial copy constructor and then allowing pair's constructors to be generated by the compiler. This also allows the constructors to be constexpr. Reviewers: emaste, theraven, rsmith, dim Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25389 llvm-svn: 283944
* Fix pair::operator=(TupleLike&&).Eric Fiselier2016-08-291-1/+1
| | | | | | | | | | | This assignment operator was previously broken since the SFINAE always resulted in substitution failure. This caused assignments to turn into copy construction + assignment. This patch was originally committed as r279953 but was reverted due to warnings in the test-suite. This new patch corrects those warnings. llvm-svn: 279955
* Revert r279953 - Fix pair::operator=(TupleLike&&)Eric Fiselier2016-08-291-1/+1
| | | | | | | The test emits warnings causing the test-suite to fail. Since I want this patch merged into 3.9 I'll recommit it with a clean test. llvm-svn: 279954
* Fix pair::operator=(TupleLike&&).Eric Fiselier2016-08-291-1/+1
| | | | | | | | This assignment operator was previously broken since the SFINAE always resulted in substitution failure. This caused assignments to turn into copy construction + assignment. llvm-svn: 279953
* Implement the std::pair parts of "Improving pair and tuple". Completes N4387.Eric Fiselier2016-07-251-100/+180
| | | | llvm-svn: 276605
* Recommit r276548 - Make pair/tuples assignment operators SFINAE properly.Eric Fiselier2016-07-251-12/+30
| | | | | | | I think I've solved issues with is_assignable and references to incomplete types. The updated patch adds tests for this case. llvm-svn: 276603
* Revert r276548 - Make pair/tuples assignment operators SFINAE properly.Eric Fiselier2016-07-251-20/+5
| | | | | | | | | | | | This is a breaking change. The SFINAE required is instantiated the second the class is instantiated, and this can cause hard SFINAE errors when applied to references to incomplete types. Ex. struct IncompleteType; extern IncompleteType it; std::tuple<IncompleteType&> t(it); // SFINAE will blow up. llvm-svn: 276598
* Don't SFINAE pair's copy assignment operator in C++03 mode.Eric Fiselier2016-07-251-0/+4
| | | | | | | | In C++03 mode evaluating the SFINAE can cause a hard error due to access control violations. This is a problem because the SFINAE is evaluated as soon as the class is instantiated, and not later. llvm-svn: 276594
* Add __is_inplace_type metafunction helperEric Fiselier2016-07-241-0/+5
| | | | llvm-svn: 276556
* Make pair/tuples assignment operators SFINAE properly.Eric Fiselier2016-07-241-5/+16
| | | | llvm-svn: 276548
* Implement the in_place tags from p0032r3.Eric Fiselier2016-07-231-0/+58
| | | | | | | That paper also has changes to any/optional but those will be implemented later. llvm-svn: 276537
OpenPOWER on IntegriCloud