Commit Graph

9437 Commits

Author SHA1 Message Date
Michał Górny 09cf95bd3e [libcxx] [test] Cover i386 & sparc64 in string.capacity test
Differential Revision: https://reviews.llvm.org/D130837
2022-07-31 15:53:56 +02:00
Konstantin Varlamov db7d795978 [libc++][ranges] Implement `std::ranges::partial_sort_copy`.
Differential Revision: https://reviews.llvm.org/D130532
2022-07-30 02:42:18 -07:00
Nikolas Klauser 7912b1f8e7 [libc++] Fix reverse_iterator::iterator_concept
Fixes https://github.com/llvm/llvm-project/issues/56504

Reviewed By: ldionne, Mordante, huixie90, #libc

Spies: libcxx-commits, hewillk

Differential Revision: https://reviews.llvm.org/D129794
2022-07-30 10:53:59 +02:00
Louis Dionne 507125af3d [libc++] Rename __libcpp_assertion_handler to __libcpp_verbose_abort
With the goal of reusing that handler to do other things besides
handling assertions (such as terminating when an exception is thrown
under -fno-exceptions), the name `__libcpp_assertion_handler` doesn't
really make sense anymore.

Furthermore, I didn't want to use the name `__libcpp_abort_handler`,
since that would give the impression that the handler is called
whenever `std::abort()` is called, which is not the case at all.

Differential Revision: https://reviews.llvm.org/D130562
2022-07-29 13:52:42 -04:00
Louis Dionne 79086bf9b2 [libc++] Remove constexpr vector from LLVM 16 release notes
We are shipping it in LLVM 15 via a cherry-pick.
2022-07-29 09:46:21 -04:00
Hui Xie 72f57e3a30 [libc++][ranges] implement `std::ranges::unique{_copy}`
implement `std::ranges::unique` and `std::ranges::unique_copy`

Differential Revision: https://reviews.llvm.org/D130404
2022-07-29 08:28:17 +01:00
Xing Xue aeb1c98f4c [libc++][AIX] Use non-unique implementation for typeinfo comparison
Summary:
The AIX linker does not merge typeinfos when shared libraries are involved, which causes address comparison to fail although the types are the same. This patch changes to use the non-unique implementation for typeinfo comparison for AIX.

Reviewed by: hubert.reinterpretcast, philnik, libc++

Differential Revision: https://reviews.llvm.org/D130715
2022-07-28 13:17:12 -04:00
Louis Dionne 1422a9689d [libc++] Properly log crashes with the assertion handler on older Androids
This reintroduces the same workaround we have in libc++abi for older
Androids based on https://reviews.llvm.org/D130507#inline-1255914.

Differential Revision: https://reviews.llvm.org/D130708
2022-07-28 12:55:33 -04:00
Konstantin Varlamov b3afea1ce0 [libc++] Make `_IterOps::__iter_move` more similar to `std::ranges::iter_move`.
Avoid relying on `iterator_traits` and instead deduce the return type of
dereferencing the iterator. Additionally, add a static check to reject
iterators with incorrect `iterator_traits` at compile time.

Differential Revision: https://reviews.llvm.org/D130538
2022-07-28 02:06:57 -07:00
Nikolas Klauser d5a3cc1d88 [libc++] Fix merge-conflict in .clang-format 2022-07-28 10:32:02 +02:00
Nikolas Klauser e01b4fe956 [libc++] Fix unwrapping ranges with different iterators and sentinels
Reviewed By: ldionne, huixie90, #libc

Spies: arichardson, sstefan1, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D129040
2022-07-28 10:22:41 +02:00
Hui Xie 8a61749f76 [libc++][ranges] implement `std::ranges::inplace_merge`
Differential Revision: https://reviews.llvm.org/D130627
2022-07-28 08:37:48 +01:00
Mark de Wever 41f7bb9975 [libc++][chrono] Uses operator<=> in the calendar.
Since the calendar is added in C++20 the existing operators are removed.

Implements part of:
- P1614R2 The Mothership has Landed

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D129887
2022-07-27 21:53:08 +02:00
Nikolas Klauser 98d3d5b5da [libc++] Implement P1004R2 (constexpr std::vector)
Reviewed By: #libc, ldionne

Spies: mgorny, var-const, ormris, philnik, miscco, hiraditya, steven_wu, jkorous, ldionne, christof, libcxx-commits

Differential Revision: https://reviews.llvm.org/D68365
2022-07-27 20:26:44 +02:00
Mark de Wever 653b21416c [libc++] Fixes the CI.
The GDB test was disabled for clang-15, updated the filter since main
now is clang-16.
2022-07-27 19:59:56 +02:00
Mark de Wever 77ccf63ef0 [libc++][doc] Extended integral type support
This addresses a request during the review of D128929.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D129310
2022-07-27 18:22:08 +02:00
Mark de Wever 582b7d3ff0 [libc++] Update clang-format style.
After evaluating the new style I noticed inner namespaces are now
indented. I am not fond of that style and I've seen some other review
comment in this regard so I propose we remove this option and use the
LLVM default not to indent it.

Reviewed By: ldionne, philnik, var-const, #libc

Differential Revision: https://reviews.llvm.org/D129441
2022-07-27 18:18:44 +02:00
Mark de Wever 02761e3fae [libc++][doc] Updates format status page.
Remove some no longer relevant details and adds the C++23 papers voted
in at the last plenary.
2022-07-27 17:39:08 +02:00
Mark de Wever 759efa763a [libc++][doc] Updates status documents.
Adds the papers and LWG issues voted in during the July 2022 plenary.

Note the updating of the project based statuses is left to the active
contributors of these projects.

Reviewed By: #libc, huixie90, philnik

Differential Revision: https://reviews.llvm.org/D130595
2022-07-27 17:31:40 +02:00
Tom Stellard 809855b56f Bump the trunk major version to 16 2022-07-26 21:34:45 -07:00
Konstantin Varlamov b105f26c8a [libc++][ranges] Fix the CI. 2022-07-26 19:45:06 -07:00
Konstantin Varlamov 8e26c315a7 [libc++][NFC] Add checks for lifetime issues in classic algorithms.
Differential Revision: https://reviews.llvm.org/D130330
2022-07-26 16:15:11 -07:00
Konstantin Varlamov d406c6493e [libc++][ranges] Implement `ranges::is_heap{,_until}`.
Differential Revision: https://reviews.llvm.org/D130547
2022-07-26 16:11:24 -07:00
Konstantin Varlamov 964aeb713e [libc++][ranges] Make sure all range algorithms support differing projection types:
- for all algorithms taking more than one range, add a `robust` test to
  check the case where the ranges have different value types and the
  given projections are different, with each projection applying to
  a different value type;
- fix `ranges::include` to apply the correct projection to each range.

Differential Revision: https://reviews.llvm.org/D130515
2022-07-26 15:51:49 -07:00
Konstantin Varlamov ead7302bbb [libc++][ranges] Implement `ranges::generate{,_n}`.
Differential Revision: https://reviews.llvm.org/D130552
2022-07-26 15:50:32 -07:00
Nikolas Klauser f4fb72e6d4 [libc++] Use uninitialized algorithms for vector
Reviewed By: ldionne, #libc

Spies: huixie90, eaeltsin, joanahalili, bgraur, alexfh, hans, avogelsgesang, augusto2112, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D128146
2022-07-26 17:44:31 +02:00
Louis Dionne 3993c7a444 [libc++][NFC] Add missing SHA in ABI changelog 2022-07-26 07:44:26 -04:00
Louis Dionne 7de5aca84c [libc++] Generalize the customizeable assertion handler
Instead of taking a fixed set of arguments, use variadics so that
we can pass arbitrary arguments to the handler. This is the first
step towards using the handler to handle other non-assertion-related
failures, like std::unreachable and an exception being thrown in
-fno-exceptions mode, which would improve user experience by including
additional information in crashes (right now, we call abort() without
additional information).

Differential Revision: https://reviews.llvm.org/D130507
2022-07-26 07:42:38 -04:00
Louis Dionne 9566c4a682 [libc++] Remove XFAIL for libcpp_deallocate on AIX, which seems to be passing now 2022-07-26 07:41:53 -04:00
Nikolas Klauser 20a11cb550 [libc++] Fix algorithms which use reverse_iterator
This adds a C++20-version of `reverse_iterator` which doesn't SFINAE away the operators for use inside the classic STL algorithms. Pre-C++20 `_AlgRevIter` is just an alias for `reverse_iterator`.

Reviewed By: var-const, #libc

Spies: huixie90, libcxx-commits

Differential Revision: https://reviews.llvm.org/D128864
2022-07-25 18:35:20 +02:00
Muhammad Usman Shahid 76476efd68 Rewording "static_assert" diagnostics
This patch rewords the static assert diagnostic output. Failing a
_Static_assert in C should not report that static_assert failed. This
changes the wording to be more like GCC and uses "static assertion"
when possible instead of hard coding the name. This also changes some
instances of 'static_assert' to instead be based on the token in the
source code.

Differential Revision: https://reviews.llvm.org/D129048
2022-07-25 07:22:54 -04:00
Nikolas Klauser b7aa9c4ac8 [libc++] Granularize some more type_traits
Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D128948
2022-07-24 22:22:12 +02:00
Brad Smith ba1915028e [libcxx] Remove static inline and make use of _LIBCPP_HIDE_FROM_ABI in __support/xlocale/__nop_locale_mgmt.h header
Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D129949
2022-07-23 22:12:37 -04:00
Ryan Prichard b4722cc4c9 [libc++][test] Fix infinite loop when mkstemp fails
mkstemp is guaranteed to make at least TMP_MAX attempts to create the
random file, and if it can't, it fails with EEXIST. get_temp_file_name
shouldn't call mkstemp again if it fails with anything other than
EEXIST. A single mkstemp call seems sufficient.

On Android, I've seen mkstemp fail with:
 - EROFS (because cwd wasn't set to a writable filesystem)
 - EACCES (because cwd pointed to a dir owned by root, but the test
   program was running as the shell user instead)

Previously, get_temp_file_name would run forever in these situations.

See D4962 and "llvm-svn: 229035"

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D130214
2022-07-22 16:20:47 -07:00
Konstantin Varlamov 14cf74d65d [libc++][ranges] Implement `ranges::shuffle`.
Differential Revision: https://reviews.llvm.org/D130321
2022-07-22 09:59:13 -07:00
Louis Dionne deb3b5552f [libc++] Take advantage of -fexperimental-library in libc++
When -fexperimental-library is passed, libc++ will now pick up the
appropriate __has_feature flag defined by Clang to enable the
experimental library features.

As a fly-by, also update the documentation for the various TSes.

Differential Revision: https://reviews.llvm.org/D130176
2022-07-22 08:33:39 -04:00
Louis Dionne 07e984bc52 [libc++] Support int8_t and uint8_t in integer distributions as an extension
In D125283, we ensured that integer distributions would not compile when
used with arbitrary unsupported types. This effectively enforced what
the Standard mentions here: http://eel.is/c++draft/rand#req.genl-1.5.

However, this also had the effect of breaking some users that were
using integer distributions with unsupported types like int8_t. Since we
already support using __int128_t in those distributions, it is reasonable
to also support smaller types like int8_t and its unsigned variant. This
commit implements that, adds tests and documents the extension. Note that
we voluntarily don't add support for instantiating these distributions
with bool and char, since those are not integer types. However, it is
trivial to replace uses of these random distributions on char using int8_t.

It is also interesting to note that in the process of adding tests
for smaller types, I discovered that our distributions sometimes don't
provide as faithful a distribution when instantiated with smaller types,
so I had to relax a couple of tests. In particular, we do a really bad
job at implementing the negative binomial, geometric and poisson distributions
for small types. I think this all boils down to the algorithm we use in
std::poisson_distribution, however I am running out of time to investigate
that and changing the algorithm would be an ABI break (which might be
reasonable).

As part of this patch, I also added a mitigation for a very likely
integer overflow bug we were hitting in our tests in negative_binomial_distribution.
I also filed http://llvm.org/PR56656 to track fixing the problematic
distributions with int8_t and uint8_t.

Supersedes D125283.

Differential Revision: https://reviews.llvm.org/D126823
2022-07-22 08:33:01 -04:00
Hui Xie c559964d85 [libc++][ranges] implement `std::ranges::includes`
implement `std::ranges::includes` and delegate to `std::includes`

Differential Revision: https://reviews.llvm.org/D130116
2022-07-22 10:27:48 +01:00
Hui Xie 0f6364b8a1 [libc++][ranges] implement `std::ranges::equal_range`
implement `std::ranges::equal_range` which delegates to
`std::equal_range`

Differential Revision: https://reviews.llvm.org/D129796
2022-07-22 10:24:08 +01:00
Augusto Noronha 1d057a6d43 Revert "[libc++] Use uninitialized algorithms for vector"
This reverts commit 23cf42e706.
2022-07-21 14:19:20 -07:00
Louis Dionne 448220a884 [libc++] Reorganize release notes
In particular, create sections for deprecations and removals, and also
for announcing upcoming deprecations/removals.
2022-07-21 12:57:27 -04:00
Louis Dionne 66e01f47e4 [libc++][NFC] Fix weird unicode character in release notes 2022-07-21 12:47:47 -04:00
Mark de Wever 4db55a459e [libc++][format] Adhere to clang-tidy style.
D126971 broke the CI due to recent changes in the clang-tidy settings.
This fixes them.
2022-07-21 17:33:27 +02:00
Erich Keane 1da3119025 Revert "Rewording the "static_assert" to static assertion"
Looks like we again are going to have problems with libcxx tests that
are overly specific in their dependency on clang's diagnostics.

This reverts commit 6542cb55a3.
2022-07-21 06:40:14 -07:00
Muhammad Usman Shahid 6542cb55a3 Rewording the "static_assert" to static assertion
This patch is basically the rewording of the static assert statement's
output(error) on screen after failing. Failing a _Static_assert in C
should not report that static_assert failed. It’d probably be better to
reword the diagnostic to be more like GCC and say “static assertion”
failed in both C and C++.

consider a c file having code

_Static_assert(0, "oh no!");

In clang the output is like:

<source>:1:1: error: static_assert failed: oh no!
_Static_assert(0, "oh no!");
^              ~
1 error generated.
Compiler returned: 1

Thus here the "static_assert" is not much good, it will be better to
reword it to the "static assertion failed" to more generic. as the gcc
prints as:

<source>:1:1: error: static assertion failed: "oh no!"
    1 | _Static_assert(0, "oh no!");
          | ^~~~~~~~~~~~~~
          Compiler returned: 1

The above can also be seen here. This patch is about rewording
the static_assert to static assertion.

Differential Revision: https://reviews.llvm.org/D129048
2022-07-21 06:34:14 -07:00
Hui Xie 7abbd6224b [libc++] Fix proxy iterator issues that trigger an assertion in Chromium.
Crash report:
https://bugs.chromium.org/p/chromium/issues/detail?id=1346012

The triggered assertion is related sorting with `v8::internal::AtomicSlot`.
`AtomicSlot` is a proxy iterator with a proxy type `AtomicSlot::Reference`
(see 9bcb5eb590/src/objects/slots-atomic-inl.h).

https://reviews.llvm.org/D130197 correctly spotted the issue in
`__iter_move` but doesn't actually fix the issue. The reason is that
`AtomicSlot::operator*` returns a prvalue `Reference`. After the fix in
D130197, the return type of `__iter_move` is `Reference&&`. But the
rvalue reference is bound to the temporary value returned by
`operator*`, which will be dangling after `__iter_move` returns.

The idea of the fix in this change is borrowed from C++17's move_iterator
https://timsong-cpp.github.io/cppwp/n4659/move.iterators#move.iterator-1
When the underlying reference is a prvalue, we just return it by value.

Differential Revision: https://reviews.llvm.org/D130212
2022-07-20 18:05:49 -07:00
Konstantin Varlamov bc4d2e7051 [libc++] Fix `_IterOps::__iter_move` to support proxy iterators.
The return type was specified incorrectly for proxy iterators that
define `reference` to be a class that implicitly converts to
`value_type`. `__iter_move` would end up returning an object of type
`reference` which would then implicitly convert to `value_type`; thus,
the function will return a `value_type&&` rvalue reference to the local
temporary.

Differential Revision: https://reviews.llvm.org/D130197
2022-07-20 13:19:00 -07:00
Nikolas Klauser 23cf42e706 [libc++] Use uninitialized algorithms for vector
Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D128146
2022-07-20 22:02:14 +02:00
Konstantin Varlamov 065202f3ca [libc++][ranges] Implement `std::ranges::partition_{point,copy}`.
Reviewed By: #libc, huixie90, ldionne

Differential Revision: https://reviews.llvm.org/D130070
2022-07-20 11:39:07 -07:00
Mark de Wever b32e600edd [libc++][format] Updates the status page. 2022-07-20 19:26:28 +02:00