summaryrefslogtreecommitdiffstats
path: root/libcxx/include/memory
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement an _is_allocator type trait for use in deduction guides.Marshall Clow2018-01-111-0/+10
| | | | llvm-svn: 322306
* Implement most of P0607: Inline Variables for the Standard Library. This ↵Marshall Clow2018-01-021-1/+4
| | | | | | involved marking a lot of variables as inline (but only for C++17 and later). llvm-svn: 321658
* Mark a couple of internal routines as 'noexcept'Marshall Clow2017-12-051-2/+2
| | | | llvm-svn: 319779
* Land D28253 which fixes PR28929 (which we mistakenly marked as fixed before)Marshall Clow2017-12-051-0/+10
| | | | llvm-svn: 319736
* Implement LWG#2948: unique_ptr does not define operator<< for stream outputMarshall Clow2017-11-271-0/+3
| | | | llvm-svn: 319038
* More of P0600; marking allocation routines as [[nodiscard]]Marshall Clow2017-11-261-5/+6
| | | | llvm-svn: 318992
* [libcxx] Implement std::to_address for C++20Eric Fiselier2017-11-221-1/+40
| | | | | | | | | | | | | | Summary: Now implements P0653R2 - Utility to convert to raw pointer. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D35470 llvm-svn: 318865
* Add _LIBCPP_INLINE_VISIBILITY to __compressed_pair_elem membersAlex Lorenz2017-11-091-6/+12
| | | | | | | | | | | | | | The commit r300140 changed the implementation of compressed_pair, but didn't add _LIBCPP_INLINE_VISIBILITY to the constructors and get members of the compressed_pair_elem class. This patch adds the visibility annotation. I didn't find a way to test this change with libc++ regression tests. rdar://35352579 Differential Revision: https://reviews.llvm.org/D39751 llvm-svn: 317816
* Fix accidental ADL in std::allocator_traits meta-programming.Eric Fiselier2017-09-151-6/+6
| | | | | | | | | | | There were a number of cases where __double_underscore functions, for example __has_construct_test, were called without being qualified, causing ADL to occur. This patch qualifies those calls to avoid this problem. Thanks to David L. Jones for point out the issue initially. llvm-svn: 313324
* [NFC] remove trailing WSAditya Kumar2017-08-201-20/+20
| | | | llvm-svn: 311283
* Rework some metaprogramming to use the detection idiom; no functional changeMarshall Clow2017-06-141-99/+58
| | | | llvm-svn: 305417
* In several places in std::allocator<const T> (and one in shared_ptr, we were ↵Marshall Clow2017-06-141-9/+11
| | | | | | casting a 'const T*' to a 'void *' - implicitly casting away the const. Add const_cast to make that explicit. No functional change. llvm-svn: 305397
* Fix more unreserved namesEric Fiselier2017-06-011-11/+11
| | | | llvm-svn: 304383
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-2/+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
* Add support for shared_ptr<FunctionType>Erik Pilkington2017-05-251-12/+41
| | | | | | | | Fixes PR27566. Differential revision: https://reviews.llvm.org/D30837 llvm-svn: 303874
* Replace a nested namespace used for overload resolution with a struct. ↵Marshall Clow2017-05-111-2/+2
| | | | | | Richard Smith says that using the namespace results in an ODR violation, but I disagree. Nevertheless, the struct works just as well. llvm-svn: 302800
* [libc++] Fix PR32979 - types with a private std::enable_shared_from_this ↵Eric Fiselier2017-05-101-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | base break shared_ptr Summary: This patch fixes bugs.llvm.org/PR32979. [util.smartptr.shared.const] says: > In the constructor definitions below, enables shared_from_this with p, for a pointer p of type Y*, means > that if Y has an unambiguous and accessible base class that is a specialization of enable_shared_from_- > this. This means that libc++ needs to respect the access specifier of the base class, and not attempt to construct and enabled_shared_from_this base if it is private. However access specifiers don't affect overload resolution so our current implementation will attempt to construct the private base. This patch uses SFINAE to correctly detect if the shared_ptr input has an accessible enable_shared_from_this base class. Reviewers: mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33033 llvm-svn: 302709
* Add markup for libc++ dylib availabilityMehdi Amini2017-05-041-1/+12
| | | | | | | | | | | | | | | Libc++ is used as a system library on macOS and iOS (amongst others). In order for users to be able to compile a binary that is intended to be deployed to an older version of the platform, clang provides the availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_ that can be placed on declarations to describe the lifecycle of a symbol in the library. See docs/DesignDocs/AvailabilityMarkup.rst for more information. Differential Revision: https://reviews.llvm.org/D31739 llvm-svn: 302172
* Use nullptr instead of the literal 0Eric Fiselier2017-05-041-1/+1
| | | | llvm-svn: 302100
* Work around GCC 4.9 bug regarding default initialization of const variablesEric Fiselier2017-04-171-13/+15
| | | | llvm-svn: 300510
* Fix passing incorrectly value-category when constructing unique_ptr's deleterEric Fiselier2017-04-171-1/+1
| | | | llvm-svn: 300489
* Cleanup and better scope unique_ptr internalsEric Fiselier2017-04-161-25/+20
| | | | llvm-svn: 300408
* Cleanup default_delete specializationsEric Fiselier2017-04-161-55/+43
| | | | llvm-svn: 300407
* Overhaul unique_ptr - Implement LWG 2801, 2905, 2520.Eric Fiselier2017-04-161-351/+526
| | | | | | | | | | | | | | | | | | | | | This patch overhauls both specializations of unique_ptr while implementing the following LWG issues: * LWG 2801 - This issue constrains unique_ptr's constructors when the deleter type is not default constructible. Additionally it adds SFINAE conditions to unique_ptr<T[]>::unique_ptr(Up). * LWG 2905 - This issue reworks the unique_ptr(pointer, /* see below */ deleter) constructors so that they correctly SFINAE when the deleter argument cannot be used to construct the stored deleter. * LWG 2520 - This issue fixes initializing unique_ptr<T[]> from nullptr. Libc++ had previously implemented this issue, but the suggested resolution still broke initialization from NULL. This patch re-works the unique_ptr<T[]>(Up, deleter) overloads so that they accept NULL as well as nullptr. llvm-svn: 300406
* Fix C++03 test failuresEric Fiselier2017-04-131-1/+1
| | | | llvm-svn: 300159
* Fix the default constructibility of __compressed_pair.Eric Fiselier2017-04-131-2/+8
| | | | | | | This patch fixes a bug where the =default default ctor for __compressed_pair was incorrect for const qualified types. llvm-svn: 300152
* [libcxx] Fix __compressed_pair so it doesn't copy the argument multiple ↵Eric Fiselier2017-04-121-281/+148
| | | | | | | | | | | | | | | | | | | | | times, and add constexpr. Summary: __compressed_pair takes and passes it's constructor arguments by value. This causes arguments to be moved 3 times instead of once. This patch addresses that issue and fixes `constexpr` on the constructors. I would rather have this fix than D27564, and I'm fairly confident it's not ABI breaking but I'm not 100% sure. I prefer this solution because it removes a lot of code and makes the implementation *much* smaller. Reviewers: mclow.lists, K-ballo Reviewed By: K-ballo Subscribers: K-ballo, cfe-commits Differential Revision: https://reviews.llvm.org/D27565 llvm-svn: 300140
* Fix incorrectly qualified return type from unique_ptr::get_deleter().Eric Fiselier2017-04-121-8/+12
| | | | | | | | | | | For reference deleter types the const qualifier on the return type of get_deleter() should be ignored, and a non-const deleter should be returned. This patch fixes a bug where "const deleter_type&" is incorrectly formed. llvm-svn: 300121
* Implement LWG#2873: 'Add noexcept to several shared_ptr related functions' ↵Marshall Clow2017-04-111-24/+39
| | | | | | This issue missed a couple, so I added those as well (see LWG#2942) llvm-svn: 299963
* 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
* Update all bug URL's to point to https://bugs.llvm.org/...Eric Fiselier2017-02-171-1/+1
| | | | llvm-svn: 295434
* Remove auto_ptr in C++17. Get it back by defining ↵Marshall Clow2017-01-241-6/+23
| | | | | | _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR llvm-svn: 292986
* Implement P0513R0 - "Poisoning the Hash"Eric Fiselier2017-01-211-352/+6
| | | | | | | | | | | | | | | | | | | | | 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
* Add ABI option to remove recently inlined __shared_count functions from the ↵Eric Fiselier2017-01-171-2/+4
| | | | | | | | | | | | | | library. In order to allow inlining of previously out-of-line functions without an ABI break libc++ provides legacy definitions in the dylib that old programs can continue to use. Unfortunatly Windows link.exe detects this hack and diagnoses the duplicate definitions. This patch disable the duplicate definitions on Windows by adding an ABI option which disables all "legacy out-of-line symbols" llvm-svn: 292190
* Fix DLL build by removing _LIBCPP_FUNC_VIS from member of class marked dllexportEric Fiselier2017-01-171-5/+5
| | | | llvm-svn: 292185
* [Test patch] Inline hot functions in libcxx shared_ptrKevin Hu2017-01-171-5/+69
| | | | | | | | | | | Moves hot functions such as atomic add into the memory header file so that they can be inlined, which brings performance benefits. Patch by Kevin Hu, Aditya Kumar, Sebastian Pop Differential Revision: https://reviews.llvm.org/D24991 llvm-svn: 292184
* Remove unused parameters in C++03Eric Fiselier2017-01-141-4/+4
| | | | llvm-svn: 291986
* Qualify some type names that I thought were fine, but some of the bots don't ↵Marshall Clow2017-01-101-2/+3
| | | | | | like. llvm-svn: 291580
* Fix up some mismatched SFINAE conditionsin shared_ptr; some used '_Tp*', ↵Marshall Clow2017-01-101-15/+17
| | | | | | others used 'element_type *'. Today, they're the same - but soon they won't be. No functional change. llvm-svn: 291572
* Move _PairT declaration out of __hash_combine to avoid warning under C++98Dimitry Andric2017-01-091-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Some parts of the FreeBSD tree are still compiled with C++98, and until rL288554 this has always worked fine. After that, a complaint about the newly introduced local _PairT is produced: /usr/include/c++/v1/memory:3354:27: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args] typedef __scalar_hash<_PairT> _HashT; ^~~~~~ /usr/include/c++/v1/memory:3284:29: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args] : public unary_function<_Tp, size_t> ^~~ /usr/include/c++/v1/memory:3356:12: note: in instantiation of template class 'std::__1::__scalar_hash<_PairT, 2>' requested here return _HashT()(__p); ^ As far as I can see, there should be no problem moving the _PairT struct to just before the __hash_combine() function, which fixes this particular warning. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits, emaste Differential Revision: https://reviews.llvm.org/D28472 llvm-svn: 291476
* [libc++] Tolerate presence of __deallocate macroEric Fiselier2017-01-071-3/+2
| | | | | | | | | | | | | | | Summary: On Windows the identifier `__deallocate` is defined as a macro by one of the Windows system headers. Previously libc++ worked around this by `#undef __deallocate` and generating a warning. However this causes the WIN32 version of `__threading_support` to always generate a warning on Windows. This is not OK. This patch renames all usages of `__deallocate` internally as to not conflict with the macro. Reviewers: mclow.lists, majnemer, rnk, rsmith, smeenai, compnerd Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28426 llvm-svn: 291332
* Fix PR26961 - Add default constructor to std::pointer_safety struct.Eric Fiselier2017-01-051-0/+3
| | | | | | | | In ABI v1 libc++ implements std::pointer_safety as a class type instead of an enumeration. However this class type does not provide a default constructor as it should. This patch adds that default constructor. llvm-svn: 291059
* Fix std::pointer_safety type in ABI v2Eric Fiselier2017-01-051-1/+24
| | | | | | | | | | | | | | | | | | | | In the C++ standard `std::pointer_safety` is defined as a C++11 strongly typed enum. However libc++ currently defines it as a class type which simulates a C++11 enumeration. This can be detected in valid C++ code. This patch introduces an the _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE ABI option. When defined `std::pointer_safety` is implemented as an enum type. Unfortunatly this also means it can no longer be provided as an extension in C++03. Additionally this patch moves the definition for `get_pointer_safety()` out of the dylib, and into the headers. New usages of `get_pointer_safety()` will now use the inline version instead of the dylib version. However in order to keep the dylib ABI compatible the old definition is explicitly compiled into it. llvm-svn: 291046
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-29/+29
| | | | | | | | | | | | | 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
* Fix unused parameters and variablesEric Fiselier2016-12-231-7/+7
| | | | llvm-svn: 290459
* Fix C++03 buildEric Fiselier2016-12-021-1/+1
| | | | llvm-svn: 288555
* Make variant's index part of the hash valueEric Fiselier2016-12-021-0/+11
| | | | llvm-svn: 288554
* Remove _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONSEric Fiselier2016-11-181-182/+2
| | | | | | | | libc++ no longer supports C++11 compilers that don't implement `= default`. This patch removes all instances of the feature test macro _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS as well as the potentially dead code it hides. llvm-svn: 287321
* Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted ↵Marshall Clow2016-11-141-1/+2
| | | | | | last week in Issaquah llvm-svn: 286858
* Fix incorrect exception handling behavior in the uninitialized algorithmsEric Fiselier2016-10-111-39/+100
| | | | llvm-svn: 283941
OpenPOWER on IntegriCloud