Commit Graph

9492 Commits

Author SHA1 Message Date
Mark de Wever da38bcfd52 [libc++][format] Improves generated files.
This improves the formatting of the generated files. That allows it to
remove the clang-format step in D129668.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D130911
2022-08-02 18:56:02 +02:00
Mark de Wever 679169b7dd [libc++][format] Enables feature-test macro.
The macro is only enabled when the Clang is used with
-fexperimental-library.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D130792
2022-08-02 18:43:27 +02:00
Igor Zhukov 8be1197285 [libc++] Implement P2499R0 (`string_view` range constructor should be `explicit`)
Reviewed By: #libc, philnik, Mordante

Spies: Mordante, jloser, philnik, libcxx-commits

Differential Revision: https://reviews.llvm.org/D130785
2022-08-02 12:47:45 +02:00
Gabriel Ravier c23e2c015f [libcxx] Fixed a number of typos
I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Reviewed By: #libc, philnik

Spies: philnik, libcxx-commits, mgorny, arichardson

Differential Revision: https://reviews.llvm.org/D130905
2022-08-02 12:42:34 +02:00
Konstantin Varlamov c64c3d31c4 [libc++][ranges][NFC] Fix a few links on the Ranges status page. 2022-08-01 20:43:59 -07:00
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
Mark de Wever 857a78c04d [libc++] Implements Unicode grapheme clustering
This implements the Grapheme clustering as required by
P1868R2 width: clarifying units of width and precision in std::format

This was omitted in the initial patch, but the paper was marked as completed. This really completes the paper.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D126971
2022-07-20 18:38:32 +02:00
Mark de Wever 29a66ab766 [libc++][doc] Updates the release notes.
This is a preparation for the upcoming LLVM 16 release.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D130031
2022-07-20 18:20:18 +02:00
Nikolas Klauser 309aed3068 [libc++] Implement P1423R3 (char8_t backward compatibility remediation)
Reviewed By: Mordante, #libc

Spies: h-vetinari, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D129195
2022-07-20 11:27:51 +02:00
Nikolas Klauser 20d30f709b [libc++] Add clang-tidy for the tests
Reviewed By: Mordante, huixie90, #libc

Spies: aheejin, libcxx-commits

Differential Revision: https://reviews.llvm.org/D129976
2022-07-20 11:26:49 +02:00
Konstantin Varlamov 25aa29f38a [libc++][ranges][NFC] Consolidate range algorithm checks for returning `dangling`.
Also simplify the `robust` test files for non-boolean predicates and
omitting `std::invoke`.

Differential Revision: https://reviews.llvm.org/D129741
2022-07-19 20:46:22 -07:00
varconst 5dd19ada57 [libc++][ranges] Implement `ranges::partial_sort`.
Differential Revision: https://reviews.llvm.org/D128744
2022-07-19 20:10:34 -07:00
Konstantin Varlamov 18f46f3ab0 [libc++][ranges] Fix broken CI. 2022-07-19 18:14:44 -07:00
Hui Xie 9c0564a3a7 [libc++][ranges] fix `std::search_n` incorrect `static_assert`
[libc++][ranges] fix `std::search_n` incorrect `static_assert`
see more detail in https://reviews.llvm.org/D124079?#3661721

Differential Revision: https://reviews.llvm.org/D130124
2022-07-19 17:24:47 -07:00
Konstantin Varlamov b8d54d1d6a [libc++][ranges][NFC] Test that range algorithms support iterators requiring `iter_move`.
Differential Revision: https://reviews.llvm.org/D130057
2022-07-19 17:21:08 -07:00
Joe Loser 50cfb76e02
[libc++] Define ostream nullptr inserter for >= C++17 only
The `ostream` `nullptr` inserter implemented in 3c125fe is missing a C++ version
guard. Normally, `libc++` takes the stance of backporting LWG issues to older
standards modes as was done in 3c125fe. However, backporting to older standards
modes breaks existing code in popular libraries such as `Boost.Test` and
`Google Test` who define their own overload for `nullptr_t`.

Instead, only apply this `operator<<` overload in C++17 or later.

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

Differential Revision: https://reviews.llvm.org/D127033
2022-07-19 18:16:45 -06:00
Louis Dionne 91941f0142 [libc++][NFC] Add commit SHA for ABI change 2022-07-19 17:16:53 -04:00
Louis Dionne f1c3013541 [libc++] Drop the legacy debug mode symbols by default
Leave the escape hatch in place with a note, but don't include the
debug mode symbols by default since we don't support the debug mode
in the normal library anymore.

This is technically an ABI break for users who were depending on
those debug mode symbols in the dylib, however those users will
already be broken at compile-time because they must have been using
_LIBCPP_DEBUG=2, which is now an error.

Differential Revision: https://reviews.llvm.org/D127360
2022-07-19 17:16:06 -04:00
Louis Dionne 8711fcae27 [libc++] Treat incomplete features just like other experimental features
In particular remove the ability to expel incomplete features from the
library at configure-time, since this can now be done through the
_LIBCPP_ENABLE_EXPERIMENTAL macro.

Also, never provide symbols related to incomplete features inside the
dylib, instead provide them in c++experimental.a (this changes the
symbols list, but not for any configuration that should have shipped).

Differential Revision: https://reviews.llvm.org/D128928
2022-07-19 10:50:20 -04:00
Louis Dionne 7300a651f5 [libc++] Re-apply "Always build c++experimental.a""
This re-applies bb939931a1, which had been reverted by 09cebfb978
because it broke Chromium. The issues seen by Chromium should be
addressed by 1d0f79558c.

Differential Revision: https://reviews.llvm.org/D128927
2022-07-19 10:44:19 -04:00
Louis Dionne 1d0f79558c [libc++] Make sure cxx_experimental links against libc++ headers
This should fix builds where we build neither the static nor the shared
library.
2022-07-19 10:41:36 -04:00
Konstantin Varlamov 8ed702b83f [libc++][ranges] Implement `ranges::{,stable_}partition`.
Differential Revision: https://reviews.llvm.org/D129624
2022-07-18 21:06:17 -07:00
Hans Wennborg 09cebfb978 Revert "[libc++] Always build c++experimental.a"
This caused build failures when building Clang and libc++ together on Mac:

  fatal error: 'experimental/memory_resource' file not found

See the code review for details. Reverting until the problem and how to
solve it is better understood.

(Updates to some test files were not reverted, since they seemed
unrelated and were later updated by 340b48b267b96.)

> This is the first part of a plan to ship experimental features
> by default while guarding them behind a compiler flag to avoid
> users accidentally depending on them. Subsequent patches will
> also encompass incomplete features (such as <format> and <ranges>)
> in that categorization. Basically, the idea is that we always
> build and ship the c++experimental library, however users can't
> use what's in it unless they pass the `-funstable` flag to Clang.
>
> Note that this patch intentionally does not start guarding
> existing <experimental/FOO> content behind the flag, because
> that would merely break users that might be relying on such
> content being in the headers unconditionally. Instead, we
> should start guarding new TSes behind the flag, and get rid
> of the existing TSes we have by shipping their Standard
> counterpart.
>
> Also, this patch must jump through a few hoops like defining
> _LIBCPP_ENABLE_EXPERIMENTAL because we still support compilers
> that do not implement -funstable yet.
>
> Differential Revision: https://reviews.llvm.org/D128927

This reverts commit bb939931a1.
2022-07-18 16:57:15 +02:00
Brad Smith da11b775b1 [libcxx] Fix copy and pasto that broke the build on Android/Fuchsia
Reviewed by: Mordante, phosek

Differential Revision: https://reviews.llvm.org/D129978
2022-07-18 09:16:49 -04:00
David Spickett 22a8671fd6 Revert "[libcxx] Temporarily skip Arm configs"
This reverts commit 81bffdf6a5,
the machine is back online.

Differential Revision: https://reviews.llvm.org/D129987
2022-07-18 10:13:12 +00:00
Konstantin Varlamov a7c3379cf9 [libc++][ranges] Make range algorithms support proxy iterators
Also test all the range algorithms to verify the support.

Differential Revision: https://reviews.llvm.org/D129823
2022-07-17 18:12:06 -07:00
Nikolas Klauser 6f0f2f9a1a [libc++] Enable test for already written ranges algorithms
Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D129970
2022-07-18 00:58:07 +02:00
Igor Zhukov d2f21f98a9 Conversion from '__int64' to 'long', possible loss of data
llvm-project\libcxx\test\std\time\time.hms\time.hms.members\seconds.pass.cpp(38): note: see reference to function template instantiation 'long check_seconds<std::chrono::seconds>(Duration)' being compiled
        with
        [
            Duration=std::chrono::seconds
        ]
llvm-project\libcxx\test\std\time\time.hms\time.hms.members\seconds.pass.cpp(31): warning C4244: 'return': conversion from '_Rep' to 'long', possible loss of data
        with
        [
            _Rep=__int64
        ]

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D129928
2022-07-17 16:43:41 +02:00
Brad Smith 21ef59a55e [libcxx] Replace remaining _LIBCPP_INLINE_VISIBILITY in __support
Replace remaining _LIBCPP_INLINE_VISIBILITY in __support with _LIBCPP_HIDE_FROM_ABI.

Reviewed by: Mordante

Differential Revision: https://reviews.llvm.org/D129922
2022-07-16 19:08:34 -04:00
Xing Xue d29c947732 [libc++][AIX] Correct the definition of __regex_word for AIX
Summary:
The patch changes the definition of __regex_word to 0x8000 for AIX because the current definition 0x80 clashes with ctype_base::print (_ISPRINT is defined as 0x80 in AIX ctype.h).

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

Differential Revision: https://reviews.llvm.org/D129862
2022-07-16 18:11:04 -04:00
Igor Zhukov 9aea9ab83d Visual C++ doesn't support C99 compound literal
Fix test libcxx/test/std/containers/sequences/array/array.creation/to_array.pass.cpp

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D129923
2022-07-16 19:47:45 +02:00
Igor Zhukov 844a320ccd Tests ignore the return value of sto{meow}, triggering nodiscard warnings in MS STL
Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D129925
2022-07-16 19:46:34 +02:00
Adhemerval Zanella 81bffdf6a5 [libcxx] Temporarily skip Arm configs
The machine hosting these agents will be down for maintenance July 15th.

Differential Revision: https://reviews.llvm.org/D129847
2022-07-15 09:11:26 -03:00
Nikolas Klauser 5492b71db3 [libc++] Update RangesAlgorithms.csv 2022-07-15 00:18:31 +02:00
Hui Xie 3151b95dad [libc++][ranges] implement `std::ranges::set_union`
[libc++][ranges] implement `std::ranges::set_union`

Differential Revision: https://reviews.llvm.org/D129657
2022-07-14 21:05:30 +01:00
David Tenty a83004f4ff [libcxx][AIX][z/OS] Remove headers included via `_IBMCPP__`
D127650 removed support for non-clang-based XL compilers, but left some
of the headers used only by this compiler and included under the
__IBMCPP__ macro. This change cleans this up by deleting these headers.

Reviewed By: hubert.reinterpretcast, fanbo-meng

Differential Revision: https://reviews.llvm.org/D129491
2022-07-14 15:41:46 -04:00
Louis Dionne 340b48b267 [libc++] Add missing UNSUPPORTED annotations to experimental tests that use RTTI 2022-07-14 15:12:20 -04:00
Nikolas Klauser 0a92e0728c [libc++] Use __unwrap_iter_impl for both unwrapping and rewrapping
Reviewed By: ldionne, #libc

Spies: arichardson, sstefan1, libcxx-commits

Differential Revision: https://reviews.llvm.org/D129039
2022-07-14 20:01:19 +02:00
Nikolas Klauser 64d63f4823 [libc++] Error if someone tries to use MSVC and tell them to contact the libc++ developers
Nobody knows if there are users of libc++ with MSVC. Let's try to find that out and encourage them to upstream their changes to make that configuration work.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D129055
2022-07-14 19:35:12 +02:00
Nikolas Klauser 2619ce8b7e [libc++] Test the size of basic_string
Reviewed By: ldionne, #libc

Spies: hubert.reinterpretcast, arichardson, mstorsjo, libcxx-commits

Differential Revision: https://reviews.llvm.org/D127672
2022-07-14 16:57:51 +02:00
Nikolas Klauser 0f050528fd [libc++] Allow setting _LIBCPP_OVERRIDABLE_FUNC_VIS
Chromium changes this flag to be able to use a custom new/delete from a
dylib.
2022-07-14 15:09:38 +02:00
Hui Xie a5c0638dec [libc++][ranges] implement `std::ranges::set_symmetric_difference`
[libc++][ranges] implement `std::ranges::set_symmetric_difference`

Differential Revision: https://reviews.llvm.org/D129520
2022-07-13 21:24:32 +01:00
Nikolas Klauser 101d1e9b3c [libc++] Implement ranges::find_end, ranges::search{, _n}
Reviewed By: var-const, #libc, huixie90

Spies: thakis, h-vetinari, huixie90, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D124079
2022-07-13 20:30:55 +02:00
Mark de Wever 6589729206 [libc++][format] Improves parsing speed.
A format string like "{}" is quite common. In this case avoid parsing
the format-spec when it's not present. Before the parsing was always
called, therefore some refactoring is done to make sure the formatters
work properly when their parse member isn't called.

From the wording it's not entirely clear whether this optimization is
allowed

[tab:formatter]
```
  and the range [pc.begin(), pc.end()) from the last call to f.parse(pc).
```
Implies there's always a call to `f.parse` even when the format-spec
isn't present. Therefore this optimization isn't done for handle
classes; it's unclear whether that would break user defined formatters.

The improvements give a small reduciton is code size:
 719408	  12472	    488	 732368	  b2cd0	before
 718824	  12472	    488	 731784	  b2a88	after

The performance benefits when not using a format-spec are:

```
Comparing ./formatter_int.libcxx.out-baseline to ./formatter_int.libcxx.out
Benchmark                                                               Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------------
BM_Basic<uint32_t>                                                   -0.0688         -0.0687            67            62            67            62
BM_Basic<int32_t>                                                    -0.1105         -0.1107            73            65            73            65
BM_Basic<uint64_t>                                                   -0.1053         -0.1049            95            85            95            85
BM_Basic<int64_t>                                                    -0.0889         -0.0888            93            85            93            85
BM_BasicLow<__uint128_t>                                             -0.0655         -0.0655            96            90            96            90
BM_BasicLow<__int128_t>                                              -0.0693         -0.0694            97            90            97            90
BM_Basic<__uint128_t>                                                -0.0359         -0.0359           256           247           256           247
BM_Basic<__int128_t>                                                 -0.0414         -0.0414           239           229           239           229
```

For the cases where a format-spec is used the results remain similar,
some are faster some are slower, differing per run.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D129426
2022-07-13 17:39:09 +02:00
Mark de Wever fd36a3d48d [libc++][chrono] Adds operator<=> for day.
Since the calendar classes were introduced in C++20 there's no need to
keep the old comparison operators.

This commit does the day calender class, the other calendar classes will
be in a followup commit.

Implements parts of:
- P1614R2 The mothership has landed

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D128603
2022-07-13 17:20:31 +02:00
Nikolas Klauser 1f04759316 Revert "[libc++] Implement ranges::find_end, ranges::search{, _n}"
This reverts commit 76a7651850.
2022-07-13 13:41:25 +02:00
Nikolas Klauser 76a7651850 [libc++] Implement ranges::find_end, ranges::search{, _n}
Reviewed By: var-const, #libc, huixie90

Spies: h-vetinari, huixie90, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D124079
2022-07-13 13:11:26 +02:00
Konstantin Varlamov 295b951ebc [lib++][ranges][NFC] Refactor `iterator_operations.h` to use tags.
Change the mechanism in `iterator_operations.h` to pass around a generic
policy tag indicating whether an internal function is being invoked from
a "classic" STL algorithm or a ranges algorithm. `IterOps` is now
a template class specialized on the policy tag.

The advantage is that this mechanism is more generic and allows defining
arbitrary conditions in a clean manner.

Also add a few more iterator functions to `IterOps`.

Differential Revision: https://reviews.llvm.org/D129390
2022-07-12 17:53:58 -07:00
Mark de Wever 984f5f3f62 [libc++][test] Adds spaceship support to macros.
This was already reviewed as D128603. This contains only the updates to
the test script.

Differential Revision: https://reviews.llvm.org/D129578
2022-07-12 21:10:23 +02:00
David Tenty 4a009797ec [libc++][NFC] Add MVS guard for locale_mgmt_zos.h
This header need not be included on non-z/OS IBM platforms (and indeed
will add nothing when it is), so add a guard. This let's us remove the
header without things breaking when shipping libc++ for AIX.

Reviewed By: hubert.reinterpretcast, fanbo-meng

Differential Revision: https://reviews.llvm.org/D129493
2022-07-12 14:15:42 -04:00
Mark de Wever 0d78597652 [libc++] Fixes CI. 2022-07-12 19:38:28 +02:00