summaryrefslogtreecommitdiffstats
path: root/libcxx/include/optional
Commit message (Collapse)AuthorAgeFilesLines
* Add a missing '__uncvref_t' to the SFINAE constraints for optional's ↵Marshall Clow2019-06-271-1/+1
| | | | | | assignment operator. Fixes PR38638. Thanks to Jonathan Wakely for the report llvm-svn: 364574
* Apply new meta-programming traits throughout the library.Eric Fiselier2019-06-231-50/+51
| | | | | | The new meta-programming primitives are lower cost than the old versions. This patch removes those old versions and switches libc++ to use the new ones. llvm-svn: 364160
* Cleaup of requirements for optional. While researching LWG3196, I realized ↵Marshall Clow2019-03-251-1/+3
| | | | | | 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
* Allow optional to tolerate being used with a nested class.Eric Fiselier2019-03-111-3/+7
| | | | | | | | | | | | | | | When Clang tries to complete a type containing `std::optional` it considers the `in_place_t` constructor with no arguments which checks if the value type is default constructible. If the value type is a nested class type, then this check occurs too early and poisons the is_default_constructible trait. This patch makes optional deduce `in_place_t` so we can prevent this early SFINAE evaluation. Technically this could break people doing weird things with the in_place_t tag, but that seems less important than making the nested class case work. llvm-svn: 355877
* 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
* [libcxx] Reorganize tests since the application of P0602R4Louis Dionne2019-01-101-2/+2
| | | | | | | | | | | | | | | | | Summary: P0602R4 makes the special member functions of optional and variant conditionally trivial based on the types in the optional/variant. We already implemented that, but the tests were organized as if this were a non-standard extension. This patch reorganizes the tests in a way that makes more sense since this is not an extension anymore. Reviewers: EricWF, mpark, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D54772 llvm-svn: 350884
* [libcxx] Add availability markup for bad_optional_access, bad_variant_access ↵Louis Dionne2018-11-191-1/+6
| | | | | | | | | | | | and bad_any_cast Reviewers: dexonsmith, EricWF Subscribers: christof, arphaman, libcxx-commits Differential Revision: https://reviews.llvm.org/D53256 llvm-svn: 347219
* 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
* Add deduction guides for optionalMarshall Clow2018-05-251-0/+9
| | | | llvm-svn: 333251
* Implement P0777: Treating unnecessay decayMarshall Clow2018-02-061-3/+3
| | | | llvm-svn: 324398
* Implement most of P0607: Inline Variables for the Standard Library. This ↵Marshall Clow2018-01-021-2/+2
| | | | | | involved marking a lot of variables as inline (but only for C++17 and later). llvm-svn: 321658
* Update the synopsis to match the P/R of 2945. No code changes.Marshall Clow2017-11-011-6/+6
| | | | llvm-svn: 317063
* optional: Implement LWG 2900 and P0602Casey Carter2017-07-091-14/+90
| | | | | | Differential Revision: https://reviews.llvm.org/D32385 llvm-svn: 307505
* add missing constexpr to optional::value_orCasey Carter2017-06-061-1/+1
| | | | | | | | [Credit to cpplearner] Differential Revision: https://reviews.llvm.org/D27850 llvm-svn: 304813
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-1/+6
| | | | | | | | | | | | | | | | Summary: This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning. This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header. Reviewers: mclow.lists, bcraig, compnerd, EricWF Reviewed By: EricWF Subscribers: cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D33080 llvm-svn: 304357
* Mark the copy constructor and move Marshall Clow2017-05-171-2/+2
| | | | | | constructor to be constexpr. This only works when the contained type has a constexpr copy/move ctor. llvm-svn: 303268
* [optional] Update synopsis for LWG2934Casey Carter2017-04-171-38/+40
| | | | | | (comment-only change) llvm-svn: 300488
* Implement part of LWG#2857 - any/optional. Still to do - variant. Reviewed ↵Marshall Clow2017-04-121-5/+7
| | | | | | as https://reviews.llvm.org/D31956 llvm-svn: 300123
* Fix LWG 2934 - optional<const T> doesn't compare with TEric Fiselier2017-03-301-54/+54
| | | | llvm-svn: 299105
* Implement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>Eric Fiselier2017-03-301-1/+1
| | | | llvm-svn: 299100
* Implement P0599: 'noexcept for hash functions'. Fix a couple of hash ↵Marshall Clow2017-03-231-1/+1
| | | | | | functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234 llvm-svn: 298573
* Restore the _NOEXCEPT on the dtor of bad_optional_access. Destructors are ↵Marshall Clow2017-02-051-1/+1
| | | | | | noexcept by default, so it's not really needed, but the other exception classes have the _NOEXCEPT, and gcc complains if these are missing. I think we should remove them all - but not today. llvm-svn: 294142
* Change the base class of std::bad_optional_access. This is a (subtle) ABI ↵Marshall Clow2017-02-051-5/+3
| | | | | | change, and is in response to http://http://wg21.link/LWG2806, which I *expect* to be adopted in Kona. I am making this change now in anticipation, and will get it into 4.0, because (a) 4.0 is the first release with std::optional, and (b) I don't want to make an ABI-change later, when the user base should be significantly larger. Note that I didn't change std::experimental::bad_optional_access, because that's still specified to derive from std::logic_error. llvm-svn: 294133
* Implement P0513R0 - "Poisoning the Hash"Eric Fiselier2017-01-211-2/+4
| | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | 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
* remove some inherited attributes on exceptionsSaleem Abdulrasool2016-12-311-1/+0
| | | | | | | | | | | | | | These exception types are marked with `_LIBCPP_EXCEPTION_ABI` which expands to `__attribute__((__visibility__("default")))` or `__declspec(dllexport)`. When building for Windows, we would hit an error: cannot apply 'dllexport' to a 'dllexport' class Remove the duplicate annotations as they will be inherited from the class. llvm-svn: 290785
* Fix unused parameters and variablesEric Fiselier2016-12-231-2/+2
| | | | llvm-svn: 290459
* Update status for std::optional LWG issues and fix an optional SFINAE bugEric Fiselier2016-10-161-6/+8
| | | | llvm-svn: 284323
* Implement N4606 optionalEric Fiselier2016-10-121-0/+1313
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adapt implementation of Library Fundamentals TS optional into an implementation of N4606 optional. - Update relational operators per http://wg21.link/P0307 - Update to requirements of http://wg21.link/P0032 - Extension: Implement trivial copy/move construction/assignment for `optional<T>` when `T` is trivially copyable. Audit P/Rs for optional LWG issues: - 2756 "C++ WP optional<T> should 'forward' T's implicit conversions" Implemented, which also resolves 2753 "Optional's constructors and assignments need constraints" (modulo my refusal to explicitly delete the move operations, which is a design error that I'm working on correcting in the 2756 P/R). - 2736 "nullopt_t insufficiently constrained" Already conforming. I've added a test ensuring that `nullopt_t` is not copy-initializable from an empty braced-init-list, which I believe is the root intent of the issue, to avoid regression. - 2740 "constexpr optional<T>::operator->" Already conforming. - 2746 "Inconsistency between requirements for emplace between optional and variant" No P/R, but note that the author's '"suggested resolution" is already implemented. - 2748 "swappable traits for optionals" Already conforming. - 2753 "Optional's constructors and assignments need constraints" Implemented. Most of the work for this patch was done by Casey Carter @ Microsoft. Thank you Casey! Reviewers: mclow.lists, CaseyCarter, EricWF Differential Revision: https://reviews.llvm.org/D22741 llvm-svn: 283980
* Revert Add <optional>. Will recommit with better commit messageEric Fiselier2016-10-121-1318/+0
| | | | llvm-svn: 283978
* Add <optional> header.Eric Fiselier2016-10-121-0/+1318
| | | | | | | | This patch is largely thanks to Casey Carter @ Microsoft. He did the initial work of porting our experimental implementation and tests over to namespace std. llvm-svn: 283977
* Move <optional> into include/experimental, and into the std::experimental ↵Marshall Clow2013-11-151-697/+0
| | | | | | namespace, since it's not part of C++14, but of an upcoming TS llvm-svn: 194867
* Implement N3672, optional<T>.Howard Hinnant2013-09-021-0/+697
llvm-svn: 189772
OpenPOWER on IntegriCloud