Commit Graph

9461 Commits

Author SHA1 Message Date
Konstantin Varlamov 36c746ca2d [libc++][ranges] Implement `ranges::rotate`.
Also fix `ranges::stable_sort` and `ranges::inplace_merge` to support
proxy iterators now that their internal implementations can correctly
dispatch `rotate`.

Differential Revision: https://reviews.llvm.org/D130758
2022-08-03 16:04:24 -07:00
Adrian Vogelsgesang 3b217f2f12 [libc++] Implement `operator<=>` for `shared_ptr`
Implements part of:

* P1614R2 The Mothership has Landed

Fixes LWG3427

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D130852
2022-08-03 18:32:45 +02:00
Louis Dionne 144cea2ce9 [libc++] Mark -fexperimental-library test as unsupported on another AppleClang 2022-08-03 12:24:00 -04:00
Casey Carter 3a45677467 [libcxx][test] Silence narrowing warning 2022-08-03 09:10:47 -07:00
Louis Dionne b7fb856397 [libc++] Simplify how we define the linker script for libc++
Trying to be generic didn't work properly because we had to special-case
some interface libraries that we didn't want in the linker script. Instead,
only look at the ABI and the unwinding libraries explicitly.

This should solve the issue reported by @dim in [1].

[1]: https://discourse.llvm.org/t/15-0-0-rc1-has-been-tagged/64174/22

Differential Revision: https://reviews.llvm.org/D131037
2022-08-03 09:29:50 -04:00
Louis Dionne 3d5d44269c [libc++] More documentation improvements about running tests 2022-08-03 09:25:01 -04:00
Nikolas Klauser 68264b6494 [libc++][ranges] Implement `ranges::{prev, next}_permutation`.
Co-authored-by: Konstantin Varlamov <varconst@apple.com>

Differential Revision: https://reviews.llvm.org/D129859
2022-08-02 22:46:15 -07:00
cpplearner 8a78b72289 [libc++][test] Replace `_LIBCPP_STD_VER` with `TEST_STD_VER`
Differential Revision: https://reviews.llvm.org/D130979
2022-08-03 13:54:04 +08:00
Konstantin Varlamov 6bdb642234 [libc++][ranges] Implement `ranges::sample`.
Differential Revision: https://reviews.llvm.org/D130865
2022-08-02 22:34:23 -07:00
Nikolas Klauser 93172c1c2b [libc++][ranges] Implement `ranges::replace_copy{,_if}`.
Co-authored-by: Konstantin Varlamov <varconst@apple.com>

Differential Revision: https://reviews.llvm.org/D129806
2022-08-02 22:32:01 -07:00
Konstantin Varlamov f537a01d39 [libc++][ranges] Fix the return value of `{copy,move}_backward`.
The return value for both of these algorithms is specified as
```
`{last, result - N}` for the overloads in namespace `ranges`.
```
But the current implementation instead returns `{first, result - N}`.

Also add both algorithms to the relevant "robust" tests.

Differential Revision: https://reviews.llvm.org/D130968
2022-08-02 22:22:59 -07:00
Nikolas Klauser 760d2b462c [libc++][ranges] Implement `ranges::remove_copy{, _if}`.
Co-authored-by: Hui Xie <hui.xie1990@gmail.com>

Differential Revision: https://reviews.llvm.org/D130599
2022-08-02 22:19:13 -07:00
Michał Górny 39d4e169d3 [libc++][test] Propagate host environment to libc++ test suite
Propagate the complete host environment to the tests run via the new
testconfig. This ensures that all envvars needed e.g. for the compiler
to work correctly are present. This mimics the behavior explicitly
implemented in the legacy config.

https://github.com/llvm/llvm-project/issues/56816

Differential Revision: https://reviews.llvm.org/D130843
2022-08-02 21:53:03 -04:00
Igor Zhukov 495519e5f8 [libc++][NFC] Don't rely on `<algorithm>` transitively including `<memory>` in tests
Found by @cpplearner (https://github.com/microsoft/STL/pull/2976#discussion_r935440806)

Differential Revision: https://reviews.llvm.org/D130997
2022-08-02 20:46:05 -04:00
Igor Zhukov db0ac307c9 [libc++] Fix warning C4244 in std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/eval.pass.cpp
frederick-vs-ja noticed that https://github.com/microsoft/STL/pull/2976#issuecomment-1201926893
while we are working on updating LLVM submodule for MS STL:

    [...]\std\numerics\rand\rand.dist\rand.dist.samp\rand.dist.samp.discrete\eval.pass.cpp(33): error C2220: the following warning is treated as an error
    [...]\std\numerics\rand\rand.dist\rand.dist.samp\rand.dist.samp.discrete\eval.pass.cpp(287): note: see reference to function template instantiation 'void tests<__int64>(void)' being compiled
    [...]\std\numerics\rand\rand.dist\rand.dist.samp\rand.dist.samp.discrete\eval.pass.cpp(33): warning C4244: 'argument': conversion from '__int64' to 'const unsigned int', possible loss of data

Differential Revision: https://reviews.llvm.org/D130963
2022-08-02 20:44:46 -04:00
Louis Dionne ce6aff8d13 [libc++] Update documentation on testing libc++ 2022-08-02 16:16:02 -04:00
Casey Carter a1a30dc933 [libcxx][test] Test code should inspect `TEST_STD_VER`, not `_LIBCPP_STD_VER`. 2022-08-02 12:07:29 -07:00
Mark de Wever f712775daf [libc++][format] Exposes basic-format-string
This paper was accepted during the last plenary and is intended to be
backported to LLVM 15. When backporting the release notes in the branch
should be updated too.

Note the feature-test macro isn't updated since this will change; three
papers have updated the same macro in the same plenary.

Implements:
- P2508R1 Exposing std::basic-format-string

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D130643
2022-08-02 20:33:17 +02:00
Adrian Vogelsgesang ceebf91744 [libc++][doc] Update spaceship status page
* `operator<=>` for `iota_view::iterator` was enabled in 8320017b79
    * Removed P2405R0 which was not accepted and seems inactive
      (https://github.com/cplusplus/papers/issues/1075)
    * Added the previously missing `operator==` for `filesystem::space_info`
      to the tracking list.
    * Updated the "Assignee" for `string_view`, `string` as Mark de Wever
      mentioned he is working on them in Discord
    * Updated the status of the items for which I sent review requests
      yesterday.

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D130855
2022-08-02 20:11:03 +02:00
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