Commit Graph

7669 Commits

Author SHA1 Message Date
Louis Dionne ad6bee87e6 [libc++] NFCI: Remove unused Lit parameter sanitizer_library 2021-06-28 14:21:25 -04:00
Nancy Wang 4f5ebfdcd6 [SystemZ][z/OS][libcxx]: fix libcxx test cases failed on ebcdic mode on z/OS
This patch is to fix 2 libcxx test cases, test cases assumed 'a' > 'A' which is not case in z/OS platform on ebcdic mode, modified test cases to compare between upper letters or lower letters, or digits so ordering will be true for all platform.

Differential Revision: https://reviews.llvm.org/D104748
2021-06-28 14:04:52 -04:00
Arthur O'Dwyer a8d1182f66 [libc++] Remove some _LIBCPP_CXX03_LANG from iostreams headers.
With the STL containers, I didn't enable move operations in C++03 mode
because that would change the overload resolution for things that today
are copy operations. With iostreams, though, the copy operations aren't
present at all, and so I see no problem with enabling move operations
even in (Clang's greatly extended) C++03 mode.

Clang's C++03 mode does not support delegating constructors.

Differential Revision: https://reviews.llvm.org/D104310
2021-06-28 12:55:26 -04:00
Louis Dionne f32f3db9fc [libc++] Split the various iterator types out of <iterator>
Differential Revision: https://reviews.llvm.org/D104669
2021-06-28 12:25:40 -04:00
Jonathan Crowther 8d5c0b8768 [libc++] Remove unnecessary reinterpret_cast from typeinfo
In typeinfo there is a reinterpret_cast between a uintptr_t and size_t. These are two integer types and therefore a reinterpret_cast is not right for this situation. It looks like it may have been copied and pasted from above in the file. An implicit cast works in it's place.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D104814
2021-06-28 10:00:33 -04:00
Arthur O'Dwyer 585496803c [libc++] Enable the rvalue overloads of operator<< and operator>> even in C++03.
Continuing to eliminate no-longer-needed uses of _LIBCPP_CXX03_LANG.

Differential Revision: https://reviews.llvm.org/D104725
2021-06-25 14:59:58 -04:00
Mark de Wever e00969c0b7 [libc++][NFC] Rename include guard. 2021-06-25 17:34:30 +02:00
Christopher Di Bella 69d5a66621 [libcxx][modularisation] splits `<utility>` into self-contained headers
* moves `std::hash` and `std::unary_function` into `__functional`
* Everything else goes into `__utility/${NAME}.h`

Differential Revision: https://reviews.llvm.org/D104002
2021-06-25 00:29:01 +00:00
zoecarver 46afddec41 [libcxx][nfc] Update the synopsis comment in <ranges> to include drop_view. 2021-06-24 11:09:25 -07:00
zoecarver ba032a614a [libcxx][ranges] Enable borrowed range for drop view when T has borrowing enabled. 2021-06-24 11:09:25 -07:00
Christopher Di Bella 6adbc83ee9 [libcxx][modularisation] moves <utility> content out of <type_traits>
Moves:

* `std::move`, `std::forward`, `std::declval`, and `std::swap` into
  `__utility/${FUNCTION_NAME}`.
* `std::swap_ranges` and `std::iter_swap` into
  `__algorithm/${FUNCTION_NAME}`

Differential Revision: https://reviews.llvm.org/D103734
2021-06-24 17:57:29 +00:00
Christopher Di Bella d87f159ab6 [libcxx][NFC] removes `swap`'s dependency on `swap_ranges`
Under the as-if rule, we can directly implement the array overload for
`std::swap`. By removing this circular dependency where `swap` is
implemented in terms of `swap_ranges` and `swap_ranges` is defined in
terms of `swap`, we can split them into their own headers. This will:

* limit the surface area in which Hyrum's law can bite us;
* force users to include the correct headers;
* make finding the definitions trivial (`swap` is a utility;
  `swap_ranges` is an algorithm).

Differential Revision: https://reviews.llvm.org/D104760
2021-06-24 17:57:29 +00:00
zoecarver 9824f86760 [libcxx][nfc] Add one more test case for contiguous_range.
If the `data` member function is different enough, `ranges::data` won't pick it, so the range remains a contiguous_range.
2021-06-24 10:45:25 -07:00
zoecarver 3450398738 [libcxx][ranges] Add contiguous_range.
Differential Revision: https://reviews.llvm.org/D104262
2021-06-24 10:40:05 -07:00
zoecarver 560170fa2d [libcxx][views] Add drop_view.
The first view in the libc++ ranges library 🚀

Differential Revision: https://reviews.llvm.org/D102037
2021-06-23 10:10:50 -07:00
Louis Dionne 0c0628c92c [libc++] Remove ad-hoc modules tests that are now unnecessary
Since we now have modules-enabled CI, it is now redundant to have ad-hoc
tests that check arbitrary things about our modules support. Instead,
the whole test suite should pass with modules enabled, period.

This patch also removes the module cache path workaround: one would
expect that modules work properly without that workaround. If that
isn't the case and we do run into flaky test failures, we can re-enable
the workaround temporarily (but that would be very vexing and we should
fix Clang ASAP if that's the case).

Differential Revision: https://reviews.llvm.org/D104746
2021-06-23 09:42:56 -04:00
Christopher Di Bella cafae05619 [libcxx][NFC] prepares `<type_traits>` for moving out forward and swap
* `<type_traits>` depends on `std::forward`, so we replaced it with
  `static_cast<T&&>`.
* `swap`'s return type is confusing, so it's been rearranged to improve
   readabilitiy.
2021-06-23 01:23:45 +00:00
Louis Dionne e35677c07c [libc++] NFC: Remove unused c++98 Lit feature 2021-06-22 16:24:43 -04:00
Christopher Di Bella e4ec613083 [libcxx][doc] corrects LWG links in the One Ranges section 2021-06-22 19:00:23 +00:00
Christopher Di Bella e7091da10b [libcxx][docs] updates the ranges status paper
* indicates whether work has been started or completed
* consolidates content that was split for dependency reasons (iff
  everything has been merged)
* makes things a lot more fine-grained
* turns sub-CSVs into lists
* puts links into description section and removes patch column
* adds links to c++draft on occasion

These changes heavily prioritise the the reader of the generated HTML
file, not the source.

Differential Revision: https://reviews.llvm.org/D103295
2021-06-22 18:54:59 +00:00
Louis Dionne 87dbe6c4ef [libc++] NFC: Add missing all.h to the modulemap 2021-06-22 13:47:41 -04:00
Arthur O'Dwyer 317e92a3e8 [libc++] Enable `explicit` conversion operators, even in C++03 mode.
C++03 didn't support `explicit` conversion operators;
but Clang's C++03 mode does, as an extension, so we can use it.
This lets us make the conversion explicit in `std::function` (even in '03),
and remove some silly metaprogramming in `std::basic_ios`.

Drive-by improvements to the tests for these operators, in addition
to making sure all these tests also run in `c++03` mode.

Differential Revision: https://reviews.llvm.org/D104682
2021-06-22 13:35:59 -04:00
zoecarver 40d6d2c49d [libcxx][ranges] Add `ranges::iter_swap`.
Differential Revision: https://reviews.llvm.org/D102809
2021-06-22 09:52:40 -07:00
Hyundeok Park 7adf713a5e [libc++] Change forward_list::swap to use propagate_on_container_swap for noexcept specification
The current implementation of `std::forward_list::swap` uses
`propagate_on_container_move_assignment` for `noexcept` specification.
This patch changes it to use `propagate_on_container_swap`, as it should.

Fixes https://llvm.org/PR50224.

Differential Revision: https://reviews.llvm.org/D101899
2021-06-22 12:42:02 -04:00
Louis Dionne 9b371f5da4 [libc++] NFC: Fix outdated comment about secrets.env
That file (secrets.env) has now been removed, so the comment was
referencing something that didn't exist anymore.
2021-06-21 16:22:26 -04:00
zoecarver 075f2370c7 [libcxx][ranges] Add `indirectly_movable` and `indirectly_movable_storable`.
Differential Revision: https://reviews.llvm.org/D102639
2021-06-21 12:39:25 -07:00
Fanbo Meng c02160c17b [libc++] Remove unused variable
Removing  `__current` as it becomes unused-but-set after 2cf78d4ead.

Reviewed By: ldionne, abhina.sreeskantharajan, #libc

Differential Revision: https://reviews.llvm.org/D104544
2021-06-21 11:39:53 -04:00
Raul Tambre 56aac567ac [libcxx] Implement P0883R2 ("Fixing Atomic Initialization")
Reviewed By: Quuxplusone

Differential Revision: https://reviews.llvm.org/D103769
2021-06-20 17:37:42 +03:00
Louis Dionne 134723edd5 [libcxx] Move all algorithms into their own headers
This is a fairly mechanical change, it just moves each algorithm into
its own header. This is intended to be a NFC.

This commit re-applies 7ed7d4ccb8, which was reverted in 692d7166f7
because the Modules build got broken. The modules build has now been
fixed, so we're re-committing this.

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

Attribution note
----------------
I'm only committing this. This commit is a mix of D103583, D103330 and
D104171 authored by:

Co-authored-by: Christopher Di Bella <cjdb@google.com>
Co-authored-by: zoecarver <z.zoelec2@gmail.com>
2021-06-19 07:49:06 -04:00
Arthur O'Dwyer dd15c2723c [libc++] [P1518R2] Better CTAD behavior for containers with allocators.
P1518 does the following in C++23 but we'll just do it in C++17 as well:
- Stop requiring `Alloc` to be an allocator on some container-adaptor deduction guides
- Stop deducing from `Allocator` on some sequence container constructors
- Stop deducing from `Allocator` on some other container constructors (libc++ already did this)

The affected constructors are the "allocator-extended" versions of
constructors where the non-allocator arguments are already sufficient
to deduce the allocator type. For example,

    std::pmr::vector<int> v1;
    std::vector v2(v1, std::pmr::new_delete_resource());
    std::stack s2(v1, std::pmr::new_delete_resource());

Differential Revision: https://reviews.llvm.org/D97742
2021-06-18 15:54:46 -04:00
Louis Dionne 71e4d434dc [libc++] Make sure std::allocator<void> is always trivial
When we removed the allocator<void> specialization, the triviality of
std::allocator<void> changed because the primary template had a
non-trivial default constructor and the specialization didn't
(so std::allocator<void> went from trivial to non-trivial).

This commit fixes that oversight by giving a trivial constructor to
the primary template when instantiated on cv-void.

This was reported in https://llvm.org/PR50299.

Differential Revision: https://reviews.llvm.org/D104398
2021-06-17 16:11:50 -04:00
Christopher Di Bella d827af03bc [libcxx][module-map] 🎨 updates module map to account for ranges headers
Corresponding module map update for D104414, split out for rollback
reasons.

Differential Revision: https://reviews.llvm.org/D104415
2021-06-17 16:52:35 +00:00
Christopher Di Bella a22c55c69b [libcxx][iwyu] 🎨 adds more headers to IWYU
A few slipped through the cracks because D104175 and D104170 didn't
concern themselves with newer commits.

Differential Revision: https://reviews.llvm.org/D104414
2021-06-17 16:52:34 +00:00
Martin Storsjö d7550e5d10 [libcxx] Fix a case of -Wundef warnings regarding _POSIX_TIMERS
Differential Revision: https://reviews.llvm.org/D104372
2021-06-17 13:02:34 +03:00
Christopher Di Bella c5076d8371 Revert "Revert "[libcxx][module-map] creates submodules for private headers""
This reverts commit d9633f229c as a
workaround was discovered.

Differential Revision: https://reviews.llvm.org/D104170
2021-06-16 16:36:41 +00:00
Louis Dionne 87784cc6fb [libc++] Undeprecate the std::allocator<void> specialization
While the std::allocator<void> specialization was deprecated by
https://wg21.link/p0174#2.2, the *use* of std::allocator<void> by users
was not. The intent was that std::allocator<void> could still be used
in C++17 and C++20, but starting with C++20 (with the removal of the
specialization), std::allocator<void> would use the primary template.
That intent was called out in wg21.link/p0619r4#3.9.

As a result of this patch, _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
will also not control whether the explicit specialization is provided or
not. It shouldn't matter, since in C++20, one can simply use the primary
template.

Fixes http://llvm.org/PR50299

Differential Revision: https://reviews.llvm.org/D104323
2021-06-16 09:54:29 -04:00
Louis Dionne 4f194d0db7 [libc++] Promote GCC 11 to mandatory CI
Also, fix the last issue that prevented GCC 11 from passing the test
suite. Thanks to everyone else who fixed issues.

Differential Revision: https://reviews.llvm.org/D104315
2021-06-15 20:54:58 -04:00
Christopher Di Bella 332da1c283 [libcxx][iwyu] ensures we IWYU as prep for modules
This has been broken out of D104170 since it should be merged whether or
not we go ahead with the module map changes.

Differential Revision: https://reviews.llvm.org/D104175
2021-06-15 19:43:25 +00:00
Arthur O'Dwyer dc066888bd [libc++] [P0619] Add _LIBCPP_ABI_NO_BINDER_BASES and remove binder typedefs in C++20.
Differential Revision: https://reviews.llvm.org/D103753
2021-06-15 15:05:44 -04:00
Jordan Rupprecht 6d33362daf [libcxx][atomic] Fix failure mapping in compare_exchange_{strong,weak}.
https://eel.is/c++draft/atomics.types.operations#23 says: ... the value of failure is order except that a value of `memory_order::acq_rel` shall be replaced by the value `memory_order::acquire` and a value of `memory_order::release` shall be replaced by the value `memory_order::relaxed`.

This failure mapping is only handled for `_LIBCPP_HAS_GCC_ATOMIC_IMP`. We are seeing bad code generation for `compare_exchange_strong(cmp, 1, std::memory_order_acq_rel)` when using libc++ in place of libstdc++: https://godbolt.org/z/v3onrrq4G.

This was caught by tsan tests after D99434, `[TSAN] Honor failure memory orders in AtomicCAS`, but appears to be an issue in non-tsan code.

Reviewed By: ldionne, dvyukov

Differential Revision: https://reviews.llvm.org/D103846
2021-06-15 07:55:23 -07:00
Arthur O'Dwyer 389e749c42 [libc++] [test] Fix some GCC 11 errors/warnings in these tests. NFCI.
Differential Revision: https://reviews.llvm.org/D104228
2021-06-15 08:37:32 -04:00
Louis Dionne 1b87573aaf [libc++][ci] Enable modules in the Runtimes build
The runtimes build has assertions enabled, which is necessary to catch
some of the modules-related issues we've been seeing recently. This
patch enables testing with modules in the runtimes build so as to cover
those cases.

In the future, a better solution would be to systematically use versions
of Clang that have assertions enabled. However, the Clangs we release
currently don't have assertions enabled by default, which causes a
challenge for the CI (we could try to build our own Clang from ToT with
assertions in the CI, but that poses some problems).

Differential Revision: https://reviews.llvm.org/D104252
2021-06-14 23:05:23 -04:00
Louis Dionne d9d20802d0 [libc++] Clean up scripts to setup CI on macOS 2021-06-14 15:55:36 -04:00
zoecarver c820b494d6 [libcxx][ranges] Implement views::all.
Differential Revision: https://reviews.llvm.org/D102028
2021-06-14 10:41:00 -04:00
Arthur O'Dwyer bbd717b9a3 [libc++] [test] No longer rely on std::hash<T>::argument_type.
Differential Revision: https://reviews.llvm.org/D104166
2021-06-14 10:14:42 -04:00
Louis Dionne 9f967eed89 [libc++] NFC: More refactoring in the prev/next/advance tests per review comments 2021-06-14 08:42:44 -04:00
Louis Dionne 8e93aa304b [libc++] Refactor the tests for std::prev, next and advance
This started as an attempt to fix a GCC 11 warning of misplaced parentheses.
I then noticed that trying to fix the parentheses warning actually triggered
errors in the tests, showing that we were incorrectly assuming that the
implementation of ranges::advance was using operator+= or operator-=.

This commit fixes that issue and makes the tests easier to follow by
localizing the assertions it makes.

Differential Revision: https://reviews.llvm.org/D103272
2021-06-14 08:13:14 -04:00
zoecarver 7eba4856c7 [libcxx][ranges] Add class ref_view.
Differential Revision: https://reviews.llvm.org/D102020
2021-06-11 11:02:39 -07:00
Louis Dionne c54d3050f7 [libc++] NFC: Move indirect_concepts.h to __iterator/concepts.h
There's no fundamental reason to separate those from the other iterator
concepts.

Differential Revision: https://reviews.llvm.org/D104048
2021-06-11 12:57:04 -04:00
Louis Dionne f84dbd2f2b [libc++] Enable the synchronization library on Apple platforms
The synchronization library was marked as disabled on Apple platforms
up to now because we were not 100% sure that it was going to be ABI
stable. However, it's been some time since we shipped it in upstream
libc++ now and there's been no changes so far. This patch enables the
synchronization library on Apple platforms, and hence commits the ABI
stability as far as that vendor is concerned.

Differential Revision: https://reviews.llvm.org/D96790
2021-06-11 12:45:18 -04:00