summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* Wrap up the new chrono literals in an #ifdef so that old versions of clang ↵Marshall Clow2018-10-152-1/+6
| | | | | | don't complain. I'm looking at you, clang 5.0.1 llvm-svn: 344535
* Implement the first part of the calendar support for C++20. This is still ↵Marshall Clow2018-10-151-1/+1032
| | | | | | incomplete; there will be more patches coming. Reviewed as D51762 llvm-svn: 344529
* Revert commit r344254; does not work with C++03Marshall Clow2018-10-111-39/+14
| | | | llvm-svn: 344261
* Prefer to use the __is_XXX compiler intrinsics to the (old, busted) ↵Marshall Clow2018-10-111-14/+39
| | | | | | __has_XXX intrinsics when implementing type traits. Thanks to Richard Smith for the patch. llvm-svn: 344254
* Fix use of removed _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETEEric Fiselier2018-10-111-1/+1
| | | | | | | It was replaced with the better named _LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE. llvm-svn: 344214
* Distinguish between library and language support for aligned allocation.Eric Fiselier2018-10-113-26/+30
| | | | | | | | | | | | | | | | | | | | There are two cases: 1. The library has all it needs to provide align_val_t and the new/delete overloads needed to support aligned allocation. 2. The compiler has actually turned the language feature on. There are times where libc++ needs to distinguish between the two. This patch adds the additional macro _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION which denotes when case (1) does not hold. _LIBCPP_HAS_NO_ALIGNED_ALLOCATION is defined whenever _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION is defined, or when the compiler has not enabled the language feature. Additionally this patch cleans up a number of other macros related to detection of aligned allocation machinery. llvm-svn: 344207
* Annotate scoped_lock as with scoped_lockable attributeAaron Puchert2018-10-091-1/+1
| | | | | | | | | | | | | | | | | | Summary: Scoped capabilities need to be annotated as such, otherwise the thread safety analysis won't work as intended. Fixes PR39234. Reviewers: ldionne Reviewed By: ldionne Subscribers: christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D53049 llvm-svn: 344096
* Do the math in uniform_int_distribution::operator() as unsigned to prevent ↵Marshall Clow2018-10-081-2/+3
| | | | | | UB when overflowing. Also add a UBSAN notification that we're ffine with unsigned overflow. This fixes PR#32617. Thanks to Vincent & Christoph for their help with this issue. llvm-svn: 343996
* [libc++][NFC] Add error messages to a couple of static_asserts in spanLouis Dionne2018-10-031-3/+3
| | | | | | | | | | | | | | | | | Summary: Add error messages to a couple of static_asserts in span to match the style used in the rest of the file. Also fix an extra paren typo in a assert error message. Committed on behalf of Jason Lovett. Reviewers: ldionne Subscribers: libcxx-commits Differential Revision: https://reviews.llvm.org/D52841 llvm-svn: 343725
* Attempt to fix aligned allocation configuration under clang-clEric Fiselier2018-10-011-0/+4
| | | | | | | | | | When we're using clang-cl and Microsoft's runtime implementation, we don't provide align_val_t or aligned new/delete ourselves. This patch updates the _LIBCPP_HAS_NO_ALIGNED_ALLOCATION macro to reflect this. llvm-svn: 343441
* Fix Shadowing warning on WindowsEric Fiselier2018-10-011-2/+2
| | | | llvm-svn: 343439
* Fix even more Clang warnings.Eric Fiselier2018-10-015-9/+12
| | | | | | | This patch disables shift-sign-overflow warnings for now. It also fixes most -Wfloat-equal warnings and -Wextra-semi warnings. llvm-svn: 343438
* [libc++] Remove Fuchsia-specific knowledge to pick the ABI versionLouis Dionne2018-09-261-5/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: The ABI version used by libc++ is a configuration option just like any other configuration option. It is a knob that can be used by vendors to customize the libc++ that they ship. As such, we should not be hardcoding vendor-specific configuration choices in libc++. When building libc++ for Fuchsia, Fuchsia's build scripts should simply define the libc++ ABI version to 2 -- this will result in the _LIBCPP_ABI_VERSION macro being defined in the __config header that is generated when libc++ is built and installed, which is the correct way to customize libc++'s behavior for specific vendors. Reviewers: phosek, EricWF Subscribers: mgorny, christof, dexonsmith, cfe-commits, libcxx-commits Differential Revision: https://reviews.llvm.org/D52397 llvm-svn: 343079
* [libc++] Add deprecated attributes to many deprecated componentsLouis Dionne2018-09-235-49/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: These deprecation warnings are opt-in: they are only enabled when the _LIBCXX_DEPRECATION_WARNINGS macro is defined, which is not the case by default. Note that this is a first step in the right direction, but I wasn't able to get an exhaustive list of all deprecated components per standard, so there's certainly stuff that's missing. The list of components this commit marks as deprecated is: in C++11: - auto_ptr, auto_ptr_ref - binder1st, binder2nd, bind1st(), bind2nd() - pointer_to_unary_function, pointer_to_binary_function, ptr_fun() - mem_fun_t, mem_fun1_t, const_mem_fun_t, const_mem_fun1_t, mem_fun() - mem_fun_ref_t, mem_fun1_ref_t, const_mem_fun_ref_t, const_mem_fun1_ref_t, mem_fun_ref() in C++14: - random_shuffle() in C++17: - unary_negate, binary_negate, not1(), not2() <rdar://problem/18168350> Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D48912 llvm-svn: 342843
* [NFC][libcxx] Rename helpers with 4 underscores to something more reasonableLouis Dionne2018-09-231-14/+14
| | | | llvm-svn: 342840
* [libc++] Add _LIBCPP_ENABLE_NODISCARD and _LIBCPP_NODISCARD_EXT to allow ↵Roman Lebedev2018-09-222-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pre-C++2a [[nodiscard]] Summary: The `[[nodiscard]]` attribute is intended to help users find bugs where function return values are ignored when they shouldn't be. After C++17 the C++ standard has started to declared such library functions as `[[nodiscard]]`. However, this application is limited and applies only to dialects after C++17. Users who want help diagnosing misuses of STL functions may desire a more liberal application of `[[nodiscard]]`. For this reason libc++ provides an extension that does just that! The extension must be enabled by defining `_LIBCPP_ENABLE_NODISCARD`. The extended applications of `[[nodiscard]]` takes two forms: 1. Backporting `[[nodiscard]]` to entities declared as such by the standard in newer dialects, but not in the present one. 2. Extended applications of `[[nodiscard]]`, at the libraries discretion, applied to entities never declared as such by the standard. Users may also opt-out of additional applications `[[nodiscard]]` using additional macros. Applications of the first form, which backport `[[nodiscard]]` from a newer dialect may be disabled using macros specific to the dialect it was added. For example `_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17`. Applications of the second form, which are pure extensions, may be disabled by defining `_LIBCPP_DISABLE_NODISCARD_EXT`. This patch was originally written by me (Roman Lebedev), then but then reworked by Eric Fiselier. Reviewers: mclow.lists, thakis, EricWF Reviewed By: thakis, EricWF Subscribers: llvm-commits, mclow.lists, lebedev.ri, EricWF, rjmccall, Quuxplusone, cfe-commits, christof Differential Revision: https://reviews.llvm.org/D45179 llvm-svn: 342808
* Revert "Implement LWG 2221 - No formatted output operator for nullptr."Volodymyr Sapsai2018-09-191-10/+1
| | | | | | | | | This reverts r342566 as it causes on bots linker errors like > Undefined symbols for architecture i386: > "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::nullptr_t)", referenced from: llvm-svn: 342599
* Implement LWG 2221 - No formatted output operator for nullptr. Reviewed as ↵Marshall Clow2018-09-191-1/+10
| | | | | | https://reviews.llvm.org/D44263 llvm-svn: 342566
* Don't require relops on variant alternatives to all return the sameEric Fiselier2018-09-191-6/+16
| | | | | | | | | | | | type. Libc++ correctly asserts that a set of visitors for a variant all return the same type. However, we use the visitation machinary to perform relational operations. This causes a static assertion when some of the alternatives relops return a UDT which is implicitly convertible to bool instead of 'bool' exactly. llvm-svn: 342560
* Fix typoFangrui Song2018-09-171-1/+1
| | | | llvm-svn: 342361
* Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow2018-09-1237-11/+49
| | | | | | feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
* Implement LWG #3017. list splice functions should use addressofMarshall Clow2018-09-121-1/+1
| | | | llvm-svn: 342057
* Update the synopsis for <version>. NFCMarshall Clow2018-09-111-0/+79
| | | | llvm-svn: 341990
* Fix PR# 38900 - don't call swap inside of random_shuffle when we'd be ↵Marshall Clow2018-09-111-1/+2
| | | | | | swapping an element with itself llvm-svn: 341975
* [asan] Update a vector's storage annotation during destruction. Reviewed as ↵Marshall Clow2018-09-071-2/+3
| | | | | | https://reviews.llvm.org/D50101. Thanks to bobsayshilol (Ben) for the patch. llvm-svn: 341671
* Last week, someone noted that a couple of the time_point member functions ↵Marshall Clow2018-08-291-12/+14
| | | | | | were not constexpr. I looked, and they were right. They were made constexpr in p0505, so I looked at all the other bits in that paper to make sure that I didn't miss anything else. There were a couple methods in the synopsis that should have been marked constexpr, but the code was correct. llvm-svn: 340992
* Use addressof instead of operator& in make_shared. Fixes PR38729. As a ↵Marshall Clow2018-08-281-3/+3
| | | | | | drive-by, make the same change in raw_storage_iterator (twice). llvm-svn: 340823
* Fix ODR violation: namespace-scope helpers should not be declared 'static'.Richard Smith2018-08-271-1/+1
| | | | llvm-svn: 340778
* [libc++] Fix handling of negated character classes in regexLouis Dionne2018-08-241-9/+6
| | | | | | | | | | | | | | | | Summary: This commit fixes a regression introduced in r316095, where we don't match inverted character classes when there's no negated characrers in the []'s. rdar://problem/43060054 Reviewers: mclow.lists, timshen, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50534 llvm-svn: 340609
* [libc++] Remove race condition in std::asyncLouis Dionne2018-08-241-12/+7
| | | | | | | | | | | | | | | | | Summary: The state associated to the future was set in one thread (with synchronization) but read in another thread without synchronization, which led to a data race. https://bugs.llvm.org/show_bug.cgi?id=38181 rdar://problem/42548261 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D51170 llvm-svn: 340608
* Comment out #define __cpp_lib_node_extract, we only support half of that ↵Erik Pilkington2018-08-231-1/+2
| | | | | | | | functionality Differential revision: https://reviews.llvm.org/D51172 llvm-svn: 340544
* Add diagnostics for min/max algorithms when a InputIterator is used.Eric Fiselier2018-08-221-0/+6
| | | | | | | | | | These algorithms require a ForwardIterator or better. Ensure we diagnose the contract violation at compile time instead of of silently doing the wrong thing. Further algorithms will be audited in upcoming patches. llvm-svn: 340426
* Fix Bug 38644: multimap::clear() missing exception specifier. Add noexcept ↵Marshall Clow2018-08-221-1/+1
| | | | | | tests for all the containers that have clear(). llvm-svn: 340385
* Teach libc++ to use native NetBSD's max_align_tKamil Rytarowski2018-08-202-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: The NetBSD headers ship with max_align_t, that is not compatible with the fallback version in libc++. There is no defined a compiler specific symbol in the headers like: - __CLANG_MAX_ALIGN_T_DEFINED - _GCC_MAX_ALIGN_T - __DEFINED_max_align_t Sponsored by <The NetBSD Foundation> Reviewers: chandlerc, dlj, EricWF, joerg Reviewed By: joerg Subscribers: bsdjhb, llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D47814 llvm-svn: 340224
* Refactor the newly created <bit> header. Still (almost) NFC. Reviewed as ↵Marshall Clow2018-08-172-83/+72
| | | | | | https://reviews.llvm.org/D50876 llvm-svn: 340049
* Recommit r339943 - Establish the <bit> header. NFC yet. Reviewed as ↵Marshall Clow2018-08-174-136/+175
| | | | | | https://reviews.llvm.org/D50815 - with a fix for the sanitizer bots llvm-svn: 340045
* Revert "Establish the <bit> header. NFC yet. Reviewed as ↵Vitaly Buka2018-08-163-174/+136
| | | | | | | | | | https://reviews.llvm.org/D50815" Breaks build on sanitizer bots. This reverts commit r339943. llvm-svn: 339971
* [libc++] Use correct rand.eng.mers all-zeroes seed sequence fallbackHubert Tong2018-08-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: When a seed sequence would lead to having no non-zero significant bits in the initial state of a `mersenne_twister_engine`, the fallback is to flip the most significant bit of the first value that appears in the textual representation of the initial state. rand.eng.mers describes this as setting the value to be 2 to the power of one less than w; the previous value encoded in the implementation, namely one less than "2 to the power of w", is replaced by the correct value in this patch. Reviewers: mclow.lists, EricWF, jasonliu Reviewed By: mclow.lists Subscribers: mclow.lists, jasonliu, EricWF, christof, ldionne, cfe-commits Differential Revision: https://reviews.llvm.org/D50736 llvm-svn: 339969
* Establish the <bit> header. NFC yet. Reviewed as https://reviews.llvm.org/D50815Marshall Clow2018-08-163-136/+174
| | | | llvm-svn: 339943
* [libcxx] By default, do not use internal_linkage to hide symbols from the ABILouis Dionne2018-08-162-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: https://reviews.llvm.org/D49240 led to symbol size problems in Chromium, and we expect this may be the case in other projects built in debug mode too. Instead, unless users explicitly ask for internal_linkage, we use always_inline like we used to. In the future, when we have a solution that allows us to drop always_inline without falling back on internal_linkage, we can replace always_inline by that. Note that this commit introduces a change in contract for existing libc++ users: by default, libc++ used to guarantee that TUs built with different versions of libc++ could be linked together. With the introduction of the _LIBCPP_HIDE_FROM_ABI_PER_TU macro, the default behavior is that TUs built with different libc++ versions are not guaranteed to link. This is a change in contract but not a change in behavior, since the current implementation still allows linking TUs built with different libc++ versions together. Reviewers: EricWF, mclow.lists, dexonsmith, hans, rnk Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D50652 llvm-svn: 339874
* Selectively import timespec_get into namespace std, since some C libraries ↵Marshall Clow2018-08-153-3/+6
| | | | | | don't have it. Reviewed as https://reviews.llvm.org/D50799 llvm-svn: 339816
* libcxx: Mark __temp_value::__temp_value as _LIBCPP_NO_CFI.Peter Collingbourne2018-08-151-2/+5
| | | | | | | | | | | | | | This constructor needs to cast a pointer to uninitialized memory to a pointer to object type in order to call allocator_traits::construct(). This cast is not allowed when CFI cast checks are enabled. I did this instead of marking __addr() as _LIBCPP_NO_CFI so that we don't lose CFI checks on get() or the dtor. Differential Revision: https://reviews.llvm.org/D50743 llvm-svn: 339797
* [libc++] Detect C11 features on non-Clang compilersLouis Dionne2018-08-151-22/+22
| | | | | | | | | | | | | | | Summary: The macros were inside `#if defined(_LIBCPP_COMPILER_CLANG)`, which means we would never detect C11 features on non-Clang compilers. According to Marshall Clow, this is not the intended behavior. Reviewers: mclow.lists, EricWF Subscribers: krytarowski, christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50748 llvm-svn: 339741
* [libc++] Enable aligned allocation based on feature test macro, irrespective ↵Louis Dionne2018-08-102-7/+5
| | | | | | | | | | | | | | | | | | | | | of standard Summary: The current code enables aligned allocation functions when compiling in C++17 and later. This is a problem because aligned allocation functions might not be supported on the target platform, which leads to an error at link time. Since r338934, Clang knows not to define __cpp_aligned_new when it's not available on the target platform -- this commit takes advantage of that to only use aligned allocation functions when they are available. Reviewers: vsapsai, EricWF Subscribers: christof, dexonsmith, cfe-commits, EricWF, mclow.lists Differential Revision: https://reviews.llvm.org/D50344 llvm-svn: 339431
* [libc++] Add the _LIBCPP_HIDE_FROM_ABI_AFTER_V1 macroLouis Dionne2018-08-061-13/+10
| | | | | | | | | | | | | | | | | | | | | Summary: This macro allows hiding symbols from the ABI when the library is built with an ABI version after ABI v1, which is currently the only stable ABI. This commit defines `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` to be `_LIBCPP_HIDE_FROM_ABI_AFTER_V1`, meaning that symbols that were only exported by the library for historical reasons are not exported anymore in the unstable ABI. Because of that, this commit is an ABI break for ABI v2. This ABI version is not stable, however, so this should not be a problem. Reviewers: EricWF, mclow.lists Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D49914 llvm-svn: 339012
* [NFC][libc++] Consistently use spaces to indentLouis Dionne2018-08-0312-79/+79
| | | | | | rdar://problem/19988944 llvm-svn: 338933
* Implement P1023: constexpr comparison operators for std::arrayMarshall Clow2018-08-021-6/+6
| | | | llvm-svn: 338668
* Implement P0887: The identity metafunctionMarshall Clow2018-08-021-0/+10
| | | | llvm-svn: 338666
* Update version to 8.0.0svn: cmake, includes files and docsHans Wennborg2018-08-012-2/+2
| | | | llvm-svn: 338555
* [libc++] Fix GCC 7.2.0 macro redefinition warningLouis Dionne2018-08-011-1/+1
| | | | | | | | | | The warning happens when LIBCXX_ENABLE_EXCEPTIONS cmake option is not set, and it fires every time __config is included, 33 in total. Patch by Jason Lovett Reviewed as https://reviews.llvm.org/D49997 llvm-svn: 338531
OpenPOWER on IntegriCloud