897 Commits

Author SHA1 Message Date
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
Mark de Wever
a9a6f977bb [libc++][doc] Updates the release notes.
This is a preparation for the upcoming LLVM 17 release.

Reviewed By: ldionne, philnik, avogelsgesang, jloser, #libc

Differential Revision: https://reviews.llvm.org/D141304
2023-01-13 17:46:45 +01:00
Nikolas Klauser
633927db84 [libc++] Add [[nodiscard]] extensions in <math.h>
There are quite a few functions marked `[[gnu::const]]` inside the compiler. This patch adds `[[nodiscard]]` to libc++-provided overloads of these functions to match the diagnostics produced.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D140855
2023-01-12 18:34:49 +01:00
Arthur O'Dwyer
64fc3cd55d [libc++] Hold mutex lock while notify_all is called at notify_all_at_thread_exit
Releasing the mutex before the call to notify_all is an optimization.
This optimization cannot be used here. The thread waiting on the
condition might destroy the associated resources — mutex + condition
variable — and the notifier thread will access an destroyed variable
— the condition variable. In fact, notify_all_at_thread_exit is meant
exactly to join on detached threads, and the waiting thread doesn't
expect for the notifier thread to access any further shared resources,
making this scenario very likely to happen. The waiting thread might
awake spuriously on the release of the mutex lock. The reorder is
necessary to prevent this race.

Further details can be found at https://cplusplus.github.io/LWG/issue3343.

Differential Revision: https://reviews.llvm.org/D105758
2023-01-11 17:01:21 -05:00
James Y Knight
73d94b1916 [Libcxx] Add <source_location> header.
This requires the __builtin_source_location() builtin, as implemented
by GCC and Clang.

Fixes https://github.com/llvm/llvm-project/issues/56363

Differential Revision: https://reviews.llvm.org/D120634
2023-01-11 16:01:30 -05:00
Louis Dionne
e4897c7c43 [libc++][NFC] Improve consistency in status csv files 2023-01-11 10:30:49 -05:00
Marek Kurdej
7223bcf04c [libc++] [C++20] [P0415] Constexpr for std::complex.
This patch adds constexpr to <complex> header: operators, member operators, and member functions (real, imag, norm, conj).

https://eel.is/c++draft/complex.numbers
https://wg21.link/p0415

Reviewed By: ldionne, #libc

Spies: philnik, danilaml, Quuxplusone, wmaxey, arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D79555
2023-01-08 15:46:51 +01:00
Nikolas Klauser
52bff450dd [libc++] Implement constexpr {isfinite, isinf, isnan, isnormal}
This starts implementing P0533

Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D140277
2022-12-25 20:14:29 +01:00
Mark de Wever
105fef5dca [libc++][chrono] Add calendar type formatters.
Some of the calendar types have landed before, this adds the missing
set. Note this does not complete the implementation of the chrono
formatters.

This removes the `chrono` header for some transitive include in C++17
mode. This is needed to avoid inclusion cycles.

Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D137022
2022-12-24 15:11:41 +01:00
Mark de Wever
0edc92e6e0 [libc++] LWG3738 Validates a missing precondition.
No real changes were needed, but add an assert for the pre-condition.

This implements:
- 3738 Missing preconditions for take_view constructor

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D140568
2022-12-23 17:20:57 +01:00
Mark de Wever
83c1816224 [libc++] LWG3745 noexcept for atomic_wait.
The noexcept was already implemented, this only updates the synposis and
adds tests to validate that the functions are noexcept.

This implements:
- LWG3745 std::atomic_wait and its friends lack noexcept

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D140575
2022-12-23 17:17:00 +01:00
Mark de Wever
eb6e13cb32 [libc++][format] Adds formatter for tuple and pair
Implements parts of
- P2286R8 Formatting Ranges

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D136775
2022-12-22 19:36:28 +01:00
Mark de Wever
2b6ce25a2a [libc++] Adds __cpp_lib_constexpr_algorithms to utility.
Implements:
- LWG3792 __cpp_lib_constexpr_algorithms should also be defined in <utility>

Depends on D140407

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D140413
2022-12-21 17:30:16 +01:00
Mark de Wever
44ea075d9c [libc++][doc] Adds Kona plenary papers and issues.
Directly marked entries with Nothing to do where applicable.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D140407
2022-12-21 17:29:02 +01:00
Igor Zhukov
c45f382a12 Implement LWG-3646 std::ranges::view_interface::size returns a signed type
Reviewed By: Mordante, philnik, #libc

Differential Revision: https://reviews.llvm.org/D139791
2022-12-16 07:14:00 +07:00
Nikolas Klauser
3ec6c997c6 [libc++] Implement P1169R4 (static operator())
Reviewed By: ldionne, huixie90, #libc

Spies: EricWF, libcxx-commits, royjacobson

Differential Revision: https://reviews.llvm.org/D135016
2022-12-15 02:18:54 +01:00
Hui Xie
e356f681f6 [libc++] Implement std::expected P0323R12
Implement `std::expected` https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html

Added tests

Differential Revision: https://reviews.llvm.org/D124516

address comment
2022-12-14 15:43:42 +00:00
Mark de Wever
e8fdf8e31b [libc++][doc] Fixes a formating issue. 2022-12-10 15:28:15 +01:00
Konstantin Varlamov
21ca9c8d28 [libc++][ranges][NFC] Update Ranges status.
Add a link to an in-progress patch.
2022-12-09 19:32:18 -08:00
Nikolas Klauser
181cce6b69 [libc++] Implement P0339R6 (polymorphic_allocator<> as a vocabulary type)
Reviewed By: ldionne, #libc

Spies: LRFLEW, libcxx-commits, arichardson, krytarowski, jdoerfert

Differential Revision: https://reviews.llvm.org/D137739
2022-12-07 18:50:26 +01:00
Leonard Chan
96d63993dd Revert "[CMake] Use LLVM_TARGET_TRIPLE in runtimes"
This reverts commit bec8a372fc0db95852748691c0f4933044026b25.

This causes many of these errors to appear when rebuilding runtimes part
of fuchsia's toolchain:

ld.lld: error:
/usr/local/google/home/paulkirth/llvm-upstream/build/lib/x86_64-unknown-linux-gnu/libunwind.a(libunwind.cpp.o)
is incompatible with elf64-x86-64

This can be reproduced by making a complete toolchain, saving any source
file with no changes, then rerunning ninja distribution.
2022-12-05 22:20:51 +00:00
varconst
2c5a548b53 [libc++][ranges][NFC] Revamp the Ranges status page
Focus on the not-yet-implemented features: remove most details about the
already-implemented C++20 stuff, list out the major C++23 additions.

Differential Revision: https://reviews.llvm.org/D136657
2022-11-29 14:40:35 -08:00
Nikolas Klauser
65df5bf2d1 [lbc++] Implement the rest of P0600R1 (nodiscard in the library)
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D137597
2022-11-29 19:42:38 +01:00
Petr Hosek
bec8a372fc [CMake] Use LLVM_TARGET_TRIPLE in runtimes
This variable is derived from LLVM_DEFAULT_TARGET_TRIPLE by default,
but using a separate variable allows additional normalization to be
performed if needed.

Differential Revision: https://reviews.llvm.org/D137451
2022-11-29 04:08:24 +00:00
Louis Dionne
396fbe264f [libc++] Bump AppleClang compiler requirement
Per our policy, the latest released AppleClang has been 14 for a while,
so libc++ is removing support for AppleClang 13. Our CI bots have been
moved to AppleClang 14 a few weeks ago.

Differential Revision: https://reviews.llvm.org/D138685
2022-11-25 09:51:44 -05:00
Louis Dionne
08a0faf4cd [libc++] Keep char_traits<T> for arbitrary T around until LLVM 18
This is in response to failures seen after landing D138307.

Differential Revision: https://reviews.llvm.org/D138596
2022-11-24 08:22:39 -05:00
Nikolas Klauser
c418dccdbd [libc++] Remove P1908 from the status page
The paper doesn't include anything affecting the library. AFAICT there isn't even anything to do for the compiler, since it just reserved the std attribute namespace.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D138128
2022-11-24 14:10:19 +01:00
Louis Dionne
09f7554890 [libc++][NFC] Fix documentation build 2022-11-23 10:31:21 -05:00
Louis Dionne
aeecef08c3 [libc++] Remove default definition of std::char_traits
This patch removes the base template implementation for std::char_traits.
If my reading of http://eel.is/c++draft/char.traits is correct, the
Standard mandates that the library provides specializations for several
types like char and wchar_t, but not any implementation in the base
template. Indeed, such an implementation is bound to be incorrect for
most types anyways, since things like `eof()` and `int_type` will definitely
have to be customized.

Since the base template implementation should not have worked for anyone,
this shouldn't be a breaking change (I expect that anyone defining a
custom character type today will already have to provide their own
specialization of char_traits). However, since we're aware of some users
of char_traits for unsigned char and signed char, we're keeping those two
specializations around for two releases to give people some time to migrate.

Differential Revision: https://reviews.llvm.org/D138307
2022-11-23 09:51:01 -05:00
Alex Richardson
4559864897 [libc++] Fix __regex_word value when using newlib/picolibc
The ctype mask for newlib/picolibc is fully saturated, so __regex_word
has to overlap with one of the values. This commit uses the same workaround
as bionic did (uint16_t for char_class_type inside regex_traits). It
should be possible to have libc++ provide the default rune table instead,
but that will require a new mechanism to detect newlib inside __config
since the header defining the newlib/picolibc macros has not been included
yet inside __config. Doing it this way also avoids duplicating the ctype
table for newlib, reducing the global data size.

Differential Revision: https://reviews.llvm.org/D138195
2022-11-23 09:04:42 +00:00