926 Commits

Author SHA1 Message Date
Nikolas Klauser
b4ecfd3c46 [libc++] Forward to std::memcmp for trivially comparable types in equal
Reviewed By: #libc, ldionne

Spies: ldionne, Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D139554
2023-02-21 17:11:21 +01:00
Nikolas Klauser
e8cb3559ee [libc++] Move constexpr <cstring> functions into their own headers and remove unused <cstring> includes
Reviewed By: ldionne, Mordante, #libc, #libc_abi

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D143329
2023-02-21 16:56:29 +01:00
Mark de Wever
c1877e6465 [NFC][libc++][doc] Fixes formatting. 2023-02-18 18:30:56 +01:00
Mark de Wever
8caa8d95af [libc++][format] Addresses LWG3810.
LWG3810 CTAD for std::basic_format_args

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144275
2023-02-17 21:08:24 +01:00
Mark de Wever
3476b56f0c [libc++][test] Adds more generic test macros.
These macros are intended to replace the macros in rapid-cxx-test.h.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142808
2023-02-17 17:01:58 +01:00
Nikolas Klauser
40a20ae6ab [libc++] Granularize <bit> includes
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D141228
2023-02-17 11:36:19 +01:00
Joe Loser
83014d8770 [libc++] LWG 3857: allow string_view conversion when only traits vary
The `basic_string_view` constructor accepting a contiguous range rejects
converting between `basic_string_view` even when only the trait types vary.
This prevents conversions for converting from `basic_string_view<C, T1>` and
`basic_string<C, T1, A>` to `basic_string_view<C, T2>`.  Recently, this
constructor was made `explicit`, so there's no reason to really forbid this
conversion anymore.

Relax the restriction that the trait types need to match in this constructor.

Differential Revision: https://reviews.llvm.org/D143972
2023-02-16 06:00:01 -07:00
Hui
c510c38763 [libc++][NFC] update Range Status for the completion of C++20 ranges
Differential Revision: https://reviews.llvm.org/D142494
2023-02-14 21:27:30 +00:00
Mark de Wever
5c1b8de77d [libc++][doc] Sets the proper plenary date. 2023-02-14 21:03:34 +01:00
Mark de Wever
7f5d130a42 [libc++][chrono] Add hh_mm_ss formatter.
Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters
- P1466 Miscellaneous minor fixes for chrono

Depends on D137022

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D139771
2023-02-14 19:12:19 +01:00
Mark de Wever
f8877d86a8 [libc++][doc] Adds Issaquah papers and issues.
Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D143845
2023-02-14 19:04:53 +01:00
Adrian Vogelsgesang
855b67799b [libc++][NFC] Remove duplicated line from Cxx20Issues.csv 2023-02-13 16:33:21 -08:00
Mark de Wever
31c42f8f35 [libc++][doc] Updates format status page.
This adds the papers voted in during the Issaquah plenary.
2023-02-13 18:32:04 +01:00
Louis Dionne
5801090258 [libc++] Fix bug in allocate_shared_for_overwrite
Instead of destroying the object with allocator::destroy, we must
call its destructor directly. As a fly-by also mark LWG3008 as
fixed since it is handled by our implementation.

This was pointed out by Tim Song in https://reviews.llvm.org/D140913.

Differential Revision: https://reviews.llvm.org/D143791
2023-02-13 08:50:54 -05:00
Louis Dionne
87cc95a904 [libc++] Implement P2136R3 std::invoke_r
Differential Revision: https://reviews.llvm.org/D143610
2023-02-13 08:46:57 -05:00
Nikolas Klauser
e698c59504 [libc++] Granularize <type_traits> includes in <algorithm>
Reviewed By: Mordante, #libc

Spies: libcxx-commits, wenlei

Differential Revision: https://reviews.llvm.org/D140673
2023-02-13 13:21:25 +01:00
Adrian Vogelsgesang
2a06757a20 [libc++][spaceship] Implement lexicographical_compare_three_way
The implementation makes use of the freedom added by LWG 3410. We have
two variants of this algorithm:
* a fast path for random access iterators: This fast path computes the
  maximum number of loop iterations up-front and does not compare the
  iterators against their limits on every loop iteration.
* A basic implementation for all other iterators: This implementation
  compares the iterators against their limits in every loop iteration.
  However, it still takes advantage of the freedom added by LWG 3410 to
  avoid unnecessary additional iterator comparisons, as originally
  specified by P1614R2.

https://godbolt.org/z/7xbMEen5e shows the benefit of the fast path:
The hot loop generated of `lexicographical_compare_three_way3` is
more tight than for `lexicographical_compare_three_way1`. The added
benchmark illustrates how this leads to a 30% - 50% performance
improvement on integer vectors.

Implements part of P1614R2 "The Mothership has Landed"

Fixes LWG 3410 and LWG 3350

Differential Revision: https://reviews.llvm.org/D131395
2023-02-12 14:51:08 -08:00
Adrian Vogelsgesang
bb00fb66ba [libc++][NFC] Fix formatting in ranges status page 2023-02-12 12:06:17 -08:00
Louis Dionne
1cf344d946 [libc++] Implement LWG3657 std::hash<filesystem::path>
This is implemented as a DR on top of C++17.

Differential Revision: https://reviews.llvm.org/D143452
2023-02-07 22:06:17 -08:00
Louis Dionne
16a1c85171 [libc++] Implement P1328R1 constexpr std::type_info::operator==
Differential Revision: https://reviews.llvm.org/D143447
2023-02-07 17:03:45 -08:00
Louis Dionne
a845b5b4fb [libc++] Use bounded iterators in std::string_view when the debug mode is enabled
Differential Revision: https://reviews.llvm.org/D142903
2023-01-31 18:23:46 -05:00
Mark de Wever
a125659f5e [NFC][libc++] Addresses LWG3781.
LWG3781 The exposition-only alias templates cont-key-type and
  cont-mapped-type should be removed

Libc++ never implemented these aliases.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D142912
2023-01-31 20:09:05 +01:00
Mark de Wever
f02c9e6f26 [libc++] Addresses LWG3755.
LWG3755 tuple-for-each can call user-defined operator,

Reviewed By: #libc, ldionne, philnik

Differential Revision: https://reviews.llvm.org/D142909
2023-01-31 20:08:07 +01:00
Mark de Wever
26597bf141 [libc++] Marks LWG2970 as complete.
LWG2970 Return type of std::visit misspecified

Was applied in D86006 including tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142840
2023-01-31 20:02:45 +01:00
Mark de Wever
87451cf05a [libc++] Partly addresses LWG3798.
LWG3798 Rvalue reference and iterator_category

The changes are only applied to `ranges::transform_view`, the other
views haven't been implemented yet.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142815
2023-01-31 20:00:40 +01:00
Mark de Wever
76804e89b3 [libc++] Addresses LWG3764.
LWG3764 reference_wrapper::operator() should propagate noexcept

As drive-by adds constexpr to the synopsis, since it has already been
implemented.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142814
2023-01-31 19:59:16 +01:00
Chuanqi Xu
226c444b38 [libc++] Remove <experimental/coroutine>
We've been shipping <coroutine> since LLVM 14, so LLVM 17 won't ship
the <experimental/coroutine> header per our policy for removing TSes.

Differential Revision: https://reviews.llvm.org/D108697
2023-01-30 16:32:48 -05:00
Mark de Wever
a3bfd2bc48 [libc++] Addresses LWG3754
LWG3754 Class template expected synopsis contains declarations that do
  not match the detailed description

This parts of the detailed synopsis that is not copied in libc++, so
effectively there's nothing to do.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D142809
2023-01-28 18:15:48 +01:00
Louis Dionne
051bcd4f31 [libc++] Add documentation for reproducing CI issues locally
Differential Revision: https://reviews.llvm.org/D142566
2023-01-26 14:52:20 -05:00
Tom Stellard
603c286334 Bump the trunk major version to 17 2023-01-24 22:57:27 -08:00
Louis Dionne
17c05a44d9 [libc++] Introduce a compile-time mechanism to override __libcpp_verbose_abort
This changes the mechanism for verbose termination (again!) to make it
support compile-time customization in addition to link-time customization,
which is important for users who need fine-grained control over what code
gets generated around sites that call the verbose termination handler.

This concern had been raised to me both privately by prospecting users
and in https://llvm.org/D140944, so I think it is clearly worth fixing.

We still support _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED for
a limited time since the same functionality can be achieved by overriding
the _LIBCPP_VERBOSE_ABORT macro.

Differential Revision: https://reviews.llvm.org/D141326
2023-01-24 21:39:14 -05:00
Mark de Wever
7c3a7c727b [libc++][doc] Updates format status.
The paper
- P2286R8 Formatting ranges
is fully implemented modulo its feature test macro. This macro has been
revised by
- LWG3750 Too many papers bump __cpp_lib_format
The new macro depends on
- P2585R0 Improving default container formatting
This paper revises parts of P2286R8 and adds new formatter
specializations. The specialization for debug strings has some wording
issues, which is addresses in this paper
- P2733R0 Fix handling of empty specifiers in std::format

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142153
2023-01-24 17:20:56 +01:00
Hui
a2b3ab8f77 [libc++][ranges] implement std::ranges::split_view
- implement `std::ranges::split_view` (last c++20 view)
- Work in process on testing iterator/sentinel, but since we are
getting closer to the deadline, I'd like to send the review early

Differential Revision: https://reviews.llvm.org/D142063
2023-01-24 09:03:33 +00:00
Hui
9af9d39a47 [libc++] implement P1020R1 P1973R1 make_unique[shared]_for_overwrite
Differential Revision: https://reviews.llvm.org/D140913
2023-01-23 21:07:22 +00:00
Mark de Wever
4f7d7eb98a [libc++][doc] Fixes the usage of improper markup. 2023-01-23 18:26:18 +01:00
Nikolas Klauser
06385491a6 [libc++] Refactor clang-query checks to clang-tidy checks to get less obscure error messages
Also remove clang-query related code, since it's unused now.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D141805
2023-01-23 05:01:28 +01:00
Nikolas Klauser
987f08fe22 [libc++] Implement P1413R3 (Deprecate std::aligned_storage and std::aligned_union)
There are no tests for the aliases because clang doesn't diagnose deprecated template aliases currently.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D127678
2023-01-21 15:08:27 +01:00
Mark de Wever
857cbb9276 [libc++][format] range-default-formatter for set.
Implements the range-default-formatter specialization range_format::set.

Implements parts of
- P2286R8 Formatting Ranges
- P2585R0 Improving default container formatting

Depends on D140801

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D141195
2023-01-20 17:39:59 +01:00
Nikolas Klauser
21f4232dd9 [libc++] Enable segmented iterator optimizations for join_view::iterator
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D138413
2023-01-20 07:55:58 +01:00
Nikolas Klauser
79b917b6e8 [libc++] Mark LWG3349 as complete 2023-01-20 07:06:50 +01:00
Nikolas Klauser
e52ce7f554 [libc++] Remove old CI configurations and update the supported compiler versions
`_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` doesn't do anything anymore in C++23 mode, so it's now just a duplicate of the C++23 configuration.
Also add new steps to the post-release checklist for updating the supported compilers.

Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D133364
2023-01-20 06:04:35 +01:00
Nikolas Klauser
b40a3d73dc [libc++] Implement P2446R2 (views::as_rvalue)
Reviewed By: ldionne, var-const, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D137637
2023-01-20 06:00:40 +01:00
Mark de Wever
af5fc4b4d8 [libc++][format] range-default-formatter for map
Implements the range-default-formatter specialization range_format::map.

Implements parts of
- P2286R8 Formatting Ranges
- P2585R0 Improving default container formatting

Depends on D140653

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D140801
2023-01-19 20:55:52 +01:00
Nikolas Klauser
c90801457f [libc++] Refactor deque::iterator algorithm optimizations
This has multiple benefits:
- The optimizations are also performed for the `ranges::` versions of the algorithms
- Code duplication is reduced
- it is simpler to add this optimization for other segmented iterators,
  like `ranges::join_view::iterator`
- Algorithm code is removed from `<deque>`

Reviewed By: ldionne, huixie90, #libc

Spies: mstorsjo, sstefan1, EricWF, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D132505
2023-01-19 20:11:43 +01:00
Mark de Wever
a09b1dc1f2 [libc++][format] Adds formatter std::vector<bool>.
Implements parts of
- P2286R8 Formatting Ranges

Depends on D140653

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D141761
2023-01-19 17:58:05 +01:00
Mark de Wever
04d4f4b3d4 [libc++][format] Adds container adaptor formatters.
Implements parts of
- P2286R8 Formatting Ranges

Depends on D140653

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D141290
2023-01-19 17:50:16 +01:00
Mark de Wever
22e8525dfd [libc++][format] Implements range_formatter
Implements parts of
- P2286R8 Formatting Ranges
- P2585R0 Improving default container formatting

Depends on D140651

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D140653
2023-01-19 17:20:05 +01:00
Haojian Wu
d8a1d5024f [libc++][ranges] Remove a leftover include version control markers in Cxx20Papers.csv 2023-01-18 12:05:54 +01:00
Konstantin Varlamov
d94b069a89 [libc++][ranges] Mark completed Ranges papers and issues as done, bump version macro
All C++20 Ranges papers and LWG issues are done, with the exception of
https://wg21.link/P2210R2 ("Superior String Splitting"), and marked as
such.

All of these were already implemented prior to this patch except bumping
the feature test macro `__cpp_lib_ranges` as required by
https://wg21.link/P2325R3 ("Views should not be required to be default
constructible"). Note that, even though P2325R3 was voted into C++23, it
was voted with a recommendation for vendors to retroactively apply the
change to C++20 (see https://github.com/cplusplus/papers/issues/1007).

Differential Revision: https://reviews.llvm.org/D139900
2023-01-17 22:54:00 -08:00
Hui Xie
94461822c7 [libc++][ranges] implement std::views::elements_view
`subrange` is also a `tuple-like`. To avoid the add entire `subrange` dependencies to `tuple-like`, we need forward declaration of `subrange`. However, the class template constraints of `subrange` currently requires `__iterator/concepts.h`, which requires `<concepts>`. The problem is that currently `tuple-like` is used in several different places, including libc++ extension for pair constructors. we don't want to add `<concepts>` to pair and other stuff. So this change also created several small headers that `subrange`'s declaration needed inside `__iterator/concepts/`

Differential Revision: https://reviews.llvm.org/D136268
2023-01-15 17:36:10 +00:00