Commit Graph

7971 Commits

Author SHA1 Message Date
Louis Dionne f599e7a789 [libc++] Refactor __perfect_forward, bind_front and not_fn
This patch fixes the constrains on the __perfect_forward constructor
and its call operators, which were incorrect. In particular, it makes
sure that we closely follow [func.require], which basically says that
we must deliver the bound arguments with the appropriate value category
or make the call ill-formed, but not silently fall back to using a
different value category.

As a fly-by, this patch also:
- Adds types __bind_front_t and __not_fn_t to make the result of
  calling bind_front and not_fn more opaque, and improve diagnostics
  for users.
- Adds a bunch of tests for bind_front and remove some that are now
  redundant.
- Adds some missing _LIBCPP_HIDE_FROM_ABI annotations.

Immense thanks to @tcanens for raising awareness about this issue, and
providing help with the = delete bits.

Differential Revision: https://reviews.llvm.org/D107199
2021-08-09 15:32:00 -04:00
Louis Dionne d232ec3c2a [libc++] Add timeout to BuildKite jobs
We just had a case where a build bot stalled in an infinite loop during
testing, and the whole pipeline got stuck. To avoid that from happening
in the future, use a timeout on BuildKite jobs.

Differential Revision: https://reviews.llvm.org/D107765
2021-08-09 15:31:04 -04:00
Mark de Wever 6f85d9e104 [libc++][doc] Improve contributor documentation.
Shorty before branching  LLVM 13 a new CMake option was added. This
option `LIBCXX_ENABLE_INCOMPLETE_FEATURES` lacks the contributor
documentation. This patch rectifies that issue.

Differential Revision: https://reviews.llvm.org/D107596
2021-08-09 18:26:07 +02:00
Mark de Wever 96ed451f8d [libc++][NFC] Remove MSVC specific code.
Switching `__builtin_clzll`  to `__libcpp_clz` should work on all
platforms and no longer require MSVC specific code.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D107709
2021-08-09 18:13:49 +02:00
Arthur O'Dwyer 3d2d3b3e7a [libc++] [test] IWYU in <concepts> tests. 2021-08-09 09:39:36 -04:00
Arthur O'Dwyer f221d905b1 [libc++] IWYU to fix Modules complaints about _LIBCPP_ASSERT. NFCI.
This fixes all places that used _LIBCPP_ASSERT without including <__debug>.

    git grep -l _LIBCPP_ASSERT | xargs git grep -L __debug
2021-08-06 09:20:59 -04:00
Arthur O'Dwyer ac42f76090 [libc++] s/_VSTD::_IsSame/_IsSame/. NFCI. 2021-08-05 23:29:53 -04:00
Arthur O'Dwyer 892990c56c [libc++] IWYU to fix complaints when compiling with Modules. NFCI.
Differential Revision: https://reviews.llvm.org/D107583
2021-08-05 14:30:08 -04:00
David Spickett e517a2405f Revert "[libcxx][CI] Work around Arm buildkite failures"
This reverts commit f8bef47348.

Buildkite agent 3.32.0 includes a fix for the PATH issue.
https://github.com/buildkite/agent/releases/tag/v3.32.0

Differential Revision: https://reviews.llvm.org/D107172
2021-08-02 09:32:08 +01:00
zoecarver 3df649e619 [libcxx][docs] Take locks on the last three views. 2021-07-30 15:08:01 -07:00
Mark de Wever d618a1cc5c [libc++] Improve LIBCXX_ENABLE_INCOMPLETE_FEATURES.
@tcanens pointed out the current behavior of the macro breaks the usage
pattern described in http://wg21.link/SD6
```
#  if __has_include(<optional>)
#    include <optional>
#    if __cpp_lib_optional >= 201606
#      define have_optional 1
#    endif
```

To support this usage pattern the hard errror is removed. Instead the
header includes nothing but the `<version>` header.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D107134
2021-07-30 14:36:03 -04:00
zoecarver 481ad59b9f [libcxx][ranges] Add `std::ranges::single_view`.
Differential Revision: https://reviews.llvm.org/D106840
2021-07-30 10:53:20 -07:00
Louis Dionne 7b3ada712a [libc++][NFC] Fix copy-paste error in the transform_view tests 2021-07-30 09:52:28 -04:00
Louis Dionne c99f5b2af1 [libc++] Handle arrays in std::destroy_at
Also, improve tests for std::destroy and std::destroy_n so that they
check for array support.

These changes are part of http://wg21.link/p0896 (the One Ranges proposal).

Differential Revision: https://reviews.llvm.org/D106916
2021-07-30 09:39:36 -04:00
Louis Dionne 9efffe8278 [libc++][NFC] Make private header generation CMake comment more consistent 2021-07-29 14:17:04 -04:00
Mark de Wever 92b758cf3d [libcxx][doc] Update the build documentation.
These are the hunks of
  D106770 [libc++][doc] Update the release notes
that are relevant for main.
2021-07-29 07:57:10 +02:00
Arthur O'Dwyer d4840175c9 [libc++] Remove excess whitespace in synopsis comment. NFCI. 2021-07-29 01:34:31 -04:00
Ruslan Arutyunyan 61c35fb0c2 [libc++][modularisation] Split <compare> into internal headers.
Differential Revision: https://reviews.llvm.org/D106107
2021-07-28 22:28:26 -04:00
Arthur O'Dwyer 20c6ddc5bc [libc++] Remove unused variables in generate_private_header_tests.py. NFCI. 2021-07-28 22:28:25 -04:00
Jason Liu 363a8a0598 [libc++] money_get::do_get() set failbit and eofbit if iterator begin equals end
Summary:
Currently, if we pass in the same iterator for begin and end,
the long double version of do_get would throw a runtime error.

However, according to standard (https://eel.is/c++draft/locale.money.get#virtuals-1),
we should set the failbit and eofbit when no more characters are available.

Differential Revision: https://reviews.llvm.org/D100510
2021-07-28 22:23:09 -04:00
Arthur O'Dwyer 3894a8a476 [libc++] Implement the resolutions of LWG3506 and LWG3522.
Implement the changes in all language modes.

LWG3506 "Missing allocator-extended constructors for priority_queue"
makes the following changes:
- New allocator-extended constructors for priority_queue.
- New deduction guides targeting those constructors.

LWG3522: "Missing requirement on InputIterator template parameter
for priority_queue constructors". The iterator parameter should be
constrained to actually be an iterator type. `priority_queue{1,2}`
should be SFINAE-friendly ill-formed.

Also, do a drive-by fix in the allocator-extended move constructor:
there's no need to do a `make_heap` after moving from `__q.c` into
our own `c`, because that container was already heapified when it
was part of `__q`. [priqueue.cons.alloc] actually specifies the
behavior and does *not* mention calling `make_heap`. I think this
was just a copy-paste thinko. It dates back to the initial import
of libc++.

Differential Revision: https://reviews.llvm.org/D106824
Differential Revision: https://reviews.llvm.org/D106827
2021-07-28 21:15:20 -04:00
Louis Dionne 6929bd6d00 [libc++] Add UNSUPPORTED for clang-14 since the underlying bug hasn't been fixed yet
This started breaking in the CI because we bumped the Clang version to 14,
which requires adjusting the markup in the test suite. I think it's actually
nice the we need to do that and that it doesn't happen automatically, since
it serves as a reminder that this is broken in Clang.
2021-07-28 16:41:22 -04:00
zoecarver 0f4b41e038 [libcxx][ranges] Add ranges::take_view.
Differential Revision: https://reviews.llvm.org/D106507
2021-07-28 12:14:21 -07:00
Mark de Wever 4e65688571 [libc++][nfc] Improve error diagnostics.
The error message for disabled filesystem and locale support is now done
in the same fashion as ranges and format in D106763.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D106935
2021-07-28 17:57:23 +02:00
David Spickett 4fd42e2e80 [libcxx] Bump __libcpp_version to 14 after branch
This was missed in 08c766a731
and caused test failures in the buildkite bots:
libcpp_version.pass.cpp:22:1:
error: static_assert failed due to requirement '14000 == libcpp_version'
"_LIBCPP_VERSION doesn't match __libcpp_version
2021-07-28 11:07:06 +00:00
Tom Stellard 08c766a731 Bump the trunk major version to 14
and clear the release notes.
2021-07-27 21:58:25 -07:00
Louis Dionne 2e4755ff60 [libc++] Fix a few warnings in system headers with GCC
This isn't fixing all of them, but at least it's making some progress.

Differential Revision: https://reviews.llvm.org/D106283
2021-07-27 20:09:01 -04:00
zoecarver 8a48e6dda9 [libcxx][ranges] Add `counted_iterator`.
Differential Revision: https://reviews.llvm.org/D106205
2021-07-27 15:50:11 -07:00
zoecarver b187e0389d [libcxx][nfc] Delete `cpp20_input_iterator`'s default constructor.
This will make it conform only to the minimum requirements for an `input_iterator`.
2021-07-27 15:50:11 -07:00
Mark de Wever 71909de374 [libc++] Disable incomplete library features.
Adds a new CMake option to disable the usage of incomplete headers.
These incomplete headers are not guaranteed to be ABI stable. This
option is intended to be used by vendors so they can avoid their users
from code that's not ready for production usage.

The option is enabled by default.

Differential Revision: https://reviews.llvm.org/D106763
2021-07-27 22:37:35 +02:00
Nancy Wang 3dc39f2829 [SystemZ][z/OS][libcxx]: Disable align_val_t test cases on z/OS
align_val_t is not supported on z/OS, it causes failure on z/OS. similar to https://reviews.llvm.org/rGd0fe294729a2ac45625ed45a5619c8405a14db49 , we will need to disable those test cases on z/OS platform.

Differential Revision: https://reviews.llvm.org/D106810
2021-07-27 15:22:30 -04:00
Louis Dionne 21c24ae902 [runtimes] Always build libc++, libc++abi and libunwind with -fPIC
Building the libraries with -fPIC ensures that we can link an executable
against the static libraries with -fPIE. Furthermore, there is apparently
basically no downside to building the libraries with position independent
code, since modern toolchains are sufficiently clever.

This commit enforces that we always build the runtime libraries with -fPIC.
This is another take on D104327, which instead makes the decision of whether
to build with -fPIC or not to the build script that drives the runtimes'
build.

Fixes http://llvm.org/PR43604.

Differential Revision: https://reviews.llvm.org/D104328
2021-07-27 14:19:05 -04:00
Louis Dionne 45478619e3 [libc++] CI: Run -std=c++03 on Clang ToT
Differential Revision: https://reviews.llvm.org/D106104
2021-07-27 14:13:28 -04:00
Marek Kurdej 775caa58fc [libc++] [c++2b] [P2166] Prohibit string and string_view construction from nullptr.
* https://wg21.link/P2166

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D106801
2021-07-27 16:20:21 +02:00
Louis Dionne 496a3815f4 [libc++] NFC: Try to trigger Docker image rebuild on CI nodes 2021-07-27 10:02:00 -04:00
Christopher Di Bella 9563f3b571 [libcxx][NFC] adjusts 41b17c44 so it meets requested feedback
Feedback requested in D106735 applied in Diff 3 seem to have
reverted in Diff 4. This patch fixes that up.

Differential Revision: https://reviews.llvm.org/D106829
2021-07-27 01:11:04 +00:00
Arthur O'Dwyer 1e1b5706c3 [libc++] Fix spacing in <vector>. NFCI.
Thanks to gAlfonso-bit for the patch!

Differential Revision: https://reviews.llvm.org/D106691
2021-07-26 18:23:50 -04:00
Arthur O'Dwyer 41b17c444d [libc++] Fix signed overflow inside ranges::advance.
See LWG reflector thread of 2021-07-23 titled
'Question on ranges::advance and "past-the-sentinel iterators"'.
Test case heavily based on one graciously provided by Casey Carter.

Differential Revision: https://reviews.llvm.org/D106735
2021-07-26 16:41:21 -04:00
Arthur O'Dwyer 25666a74c5 [libc++] Remove "pass by const value" in <random>. NFCI. 2021-07-26 16:41:20 -04:00
Louis Dionne 7b28c5d376 [libc++] Implement the output_iterator and output_range concepts
Differential Revision: https://reviews.llvm.org/D106704
2021-07-26 15:05:17 -04:00
Louis Dionne 069428b6f7 [libc++] Set the target triple by default in the standalone build
Even though the standalone build is deprecated, some people are still
relying on it (including libc++ itself for some configurations). Setting
the target triple will ensure that the build and the test suite behaves
consistently in the standalone and normal builds.

Differential Revision: https://reviews.llvm.org/D106800
2021-07-26 15:04:45 -04:00
Louis Dionne fbaf7f0bc7 [libc++] Add range_size_t
Differential Revision: https://reviews.llvm.org/D106708
2021-07-26 12:19:26 -04:00
Louis Dionne 3ca6dea05d [libc++][NFC] Change a few instances of > > to >> in C++20 code 2021-07-26 11:22:47 -04:00
Mark de Wever 1139fd4270 [libc++][ci] Detect not committed generated files.
The Generated output CI job only tests for modified files. This job
should also fail the generated output contains new files.

It would be possible to test modified and untracked files in one
execution of `git ls-files`. However the diff is stored as an artifact
so the execution of `git diff` would still be required.

Discussion: Would it be better to do `git ls-files -om` and remove the
excution of
`! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false` ?
(Obviously then the name `generated_output.untracked` should change to
something like `generated_output.status`)

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D106534
2021-07-26 16:41:57 +02:00
Mark de Wever d990852327 [libcxx][nfc] Cleanup libc++ specific tests.
Move the tests to libcxx so they no longer need `REQUIRES: libc++`.
Verify tests don't need `REQUIRES: libc++`.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D106673
2021-07-23 18:42:23 +02:00
zoecarver 1e4ba7eba6 [libcxx][nfc] Global `constexpr friend` -> `friend constexpr`. 2021-07-23 09:08:50 -07:00
zoecarver e5d8b93e5a [libcxx][ranges] Add `ranges::common_view`.
Differential Revision: https://reviews.llvm.org/D105753
2021-07-23 09:08:49 -07:00
Louis Dionne f86570cd52 [libc++] Avoid triggering warnings for implicit conversion
This started as fixing a typo in a ADDITIONAL_COMPILE_FLAGS directive
which turned out to uncover a few places where we warned about signedness
changes.

As a fly-by fix, this updates the various __advance overloads
for style consistency.

Differential Revision: https://reviews.llvm.org/D106372
2021-07-23 10:53:10 -04:00
Mark de Wever 678601ecb5 [libc++][doc] Update the LWG issues.
Updates the status pages with the LWG issues accepted in the Standard
during the June 2021 plenary session. The LWG papers for this meeting
have been added in D105103.

Differential Revision: https://reviews.llvm.org/D106529
2021-07-23 10:08:44 +02:00
Christopher Di Bella 0cf65382ad [libcxx][modularisation] properly modularises advance, next, and prev
`__function_like` wasn't being exported, so certain properties of the
`ranges` functions weren't being propagated in modules land.

Differential Revision: https://reviews.llvm.org/D105078
2021-07-22 23:30:02 +00:00
Louis Dionne 3959c95deb [libc++] Add helper type non-propagating-cache
Differential Revision: https://reviews.llvm.org/D102121
2021-07-22 14:30:16 -04:00
zoecarver 6f5064cd0c [libc++][docs] Take lock for range.single.view.
Mark this item as in progress and assigned to me.
2021-07-22 11:15:24 -07:00
Christopher Di Bella 74fd3cb8cd [libcxx][ranges] implements dangling, borrowed_iterator_t, borrowed_subrange_t
* Implements part of P0896 'The One Ranges Proposal'
* Implements http://wg21.link/range.dangling

Reviewed By: zoecarver

Differential Revision: https://reviews.llvm.org/D105205
2021-07-21 21:34:13 +00:00
Nancy Wang 6ba493d81b [SystemZ][z/OS][libcxx]: add the missing comment for patch D106153 and D106151
This patch is to add the missing comments in https://reviews.llvm.org/D106153 and https://reviews.llvm.org/D106151 to address comments.

Differential Revision: https://reviews.llvm.org/D106404
2021-07-21 13:49:04 -04:00
Marek Kurdej 1daf0e2256 [libc++] Add `__libcpp_copysign` conditionally constexpr overloads.
This is a spin-off from D79555 review, that with this patch will be able to use `__libcpp_copysign` instead of adhoc `__copysign_constexpr` helper.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D106364
2021-07-21 16:57:43 +02:00
Mark de Wever 9226e6f7d2 [libc++][nfc] Adds a missing generated file.
The file was created by libcxx/utils/generate_private_header_tests.py.
2021-07-21 08:06:03 +02:00
Mark de Wever b49961987f [lbc++][nfc] Use _LIBCPP_HIDE_FROM_ABI.
This replaces _LIBCPP_INLINE_VISIBILITY with _LIBCPP_HIDE_FROM_ABI. It's
not intended to do for other parts of libc++. This change makes it easy
to search and replace all occurrences of the patches in review.
2021-07-21 08:02:15 +02:00
Mark de Wever a08554bcdd [libc++][doc] Fixes a broken link. 2021-07-20 19:49:45 +02:00
Nancy Wang 7704fedfff [SystemZ][z/OS][libcxx]: fix libcxx test cases related to codecvt class UTF8
This PR to fix a few test cases related to class https://en.cppreference.com/w/cpp/locale/codecvt , as mentioned in document, class is converting UTF16 and UTF8 or UTF32 and UTF8, character type is deprecated in c++20 and it needs explicitly specify it is UTF8 string literal. Current test cases assume 1 byte character is ASCII or Unicode character which is not true on z/OS platform. UTF8/16/32 information can be found in https://naveenr.net/unicode-character-set-and-utf-8-utf-16-utf-32-encoding/ and EBCDIC and ASCII character value can be found in http://www.simotime.com/asc2ebc1.htm

Differential Revision: https://reviews.llvm.org/D106153
2021-07-20 13:02:59 -04:00
Nancy Wang f3cb8d6e25 [SystemZ][z/OS][libcxx]: fix libcxx test cases related to codecvt class UTF16/32
This PR is to fix a few UTF16 and UTF32 related test cases that are testing member functions for https://en.cppreference.com/w/cpp/locale/codecvt class , functions are converting from UTF16, UTF32 to UTF8 or vise visa. Test cases need to explicitly specify it is UNICODE character for UTF16/32 type in order to be valid tests to match type in documentation. it assumes it will be ASCII or UTF8 type for 1 byte character ( value range from 1 to 127 ), which is not true on z/OS in EBCDIC mode. For information related to UTF16/32 , please see https://naveenr.net/unicode-character-set-and-utf-8-utf-16-utf-32-encoding/ , and EBCDIC/ASCII character value can be found in http://www.simotime.com/asc2ebc1.htm

Differential Revision: https://reviews.llvm.org/D106151
2021-07-20 12:57:32 -04:00
zoecarver 1a29403d2f [libcxx][ranges] Add common_iterator.
Differential Revision: https://reviews.llvm.org/D103335
2021-07-20 08:12:44 -07:00
Louis Dionne ec2bdf86f0 [libc++][NFC] Add missing commits to the ABI changelog 2021-07-20 09:19:52 -04:00
Louis Dionne 15bf66d2f8 [libc++] Tidy-up instances of __STDCPP_DEFAULT_NEW_ALIGNMENT__ in the tests
See https://reviews.llvm.org/D105905 for context.

Differential Revision: https://reviews.llvm.org/D106182
2021-07-19 19:37:07 -04:00
Louis Dionne d153e7d0a5 [libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI in <ranges>
We've been forgetting to add those to most of the <ranges> review.
To avoid forgetting in the future, I added an item in the pre-commit
checklist.

Differential Revision: https://reviews.llvm.org/D106287
2021-07-19 19:33:28 -04:00
Louis Dionne 9333d34b8a [libc++] Disable #pragma system_header in the new testing configuration
The new testing configuration did not turn off #pragma system_header,
which means we were not seeing warnings in system headers.

Differential Revision: https://reviews.llvm.org/D106187
2021-07-19 14:38:24 -04:00
Vy Nguyen f44fc35149 [libcxx] Updated test and seemingly incorrect comment from it.
Background: https://reviews.llvm.org/D82490#inline-1007741

Differential Revision: https://reviews.llvm.org/D106092
2021-07-17 13:46:28 -04:00
Christopher Di Bella 182ba8ab1b [libcxx][ranges] makes `ranges::subrange` a borrowed range
Differential Revision: https://reviews.llvm.org/D106207
2021-07-17 17:25:56 +00:00
Christopher Di Bella e37bbfe59c [libcxx][modules] protects users from relying on libc++ detail headers (1/n)
libc++ has started splicing standard library headers into much more
fine-grained content for maintainability. It's very likely that outdated
and naive tooling (some of which is outside of LLVM's scope) will
suggest users include things such as `<__algorithm/find.h>` instead of
`<algorithm>`, and Hyrum's law suggests that users will eventually begin
to rely on this without the help of tooling. As such, this commit
intends to protect users from themselves, by making it a hard error for
anyone outside of the standard library to include libc++ detail headers.

This is the first of four patches. Patch #2 will solve the problem for
pre-processor `#include`s; patches #3 and #4 will solve the problem for
`<__tree>` and `<__hash_table>` (since I've never touched the test cases
that are failing for these two, I want to split them out into their own
commits to be extra careful). Patch #5 will concern itself with
`<__threading_support>`, which intersects with libcxxabi (which I know
even less about).

Differential Revision: https://reviews.llvm.org/D105932
2021-07-16 22:39:18 +00:00
Martin Storsjö f23f299c04 [libcxx] [test] Fix experimental/memory.resource.adaptor.mem/db_deallocate on Windows
The checks within the libc++experimental memory_resource class uses this
limit:

     _MaxAlign = _LIBCPP_ALIGNOF(max_align_t);

Therefore, only use max_align_t for this limit instead of using
`__STDCPP_DEFAULT_NEW_ALIGNMENT__` if available.

Differential Revision: https://reviews.llvm.org/D105905
2021-07-16 23:02:47 +03:00
Christopher Di Bella 6cb05ca392 [libcxx][modularisation] adds several headers to the module map
* <__algorithm/iter_swap.h>
* <__algorithm/swap_ranges.h>
* <__functional/is_transparent.h>
* <__memory/uses_allocator.h>
* <__ranges/drop_view.h>
* <__ranges/transform_view.h>
* <shared_mutex>
* <span>

Also updates header inclusions that were affected.

**NOTE:** This is a proper subset of D105932. Since the content has
already been LGTM'd, I intend to merge this patch without review,
pending green CI. I decided it would be better to move these changes
into their own commit since the former patch has undergone further
changes and will need yet another light review. In the event any of
that gets rolled back (for whatever reason), the changes in this patch
won't be affected.

Differential Revision: https://reviews.llvm.org/D106040
2021-07-16 16:06:54 +00:00
Louis Dionne fbc3e69f58 [libc++] ci: Create ~/Library/LaunchAgents if it does not exist yet 2021-07-16 11:48:10 -04:00
Louis Dionne 18e21e6832 [libc++] CI: Setup BuildKite agents through launchd
This makes sure that even if a node goes down, the BuildKite agent will
be started again when it goes back up.
2021-07-16 11:40:08 -04:00
Louis Dionne 395271ad11 [runtimes] Simplify how we set the target triple
Instead of using TARGET_TRIPLE, which is always set to LLVM_DEFAULT_TARGET_TRIPLE,
use that variable directly to populate the various XXXX_TARGET_TRIPLE
variables in the runtimes.

This re-applies 77396bbc98 and 5099e01568, which were reverted in
850b57c5fb because they broke the build.

Differential Revision: https://reviews.llvm.org/D106009
2021-07-16 10:33:39 -04:00
Louis Dionne 851a335b1e [libc++] Add a job running GCC with C++11
This configuration is interesting because GCC has a different level of
strictness for some C++ rules. In particular, it implements the older
standards more stringently than Clang, which can help find places where
we are non-conforming (especially in the test suite).

Differential Revision: https://reviews.llvm.org/D105936
2021-07-15 22:13:03 -04:00
Louis Dionne a59165b017 [runtimes] Don't try passing --target flags to GCC
When a target triple is specified in CMake via XXX_TARGET_TRIPLE, we tried
passing the --target=<...> flag to the compiler. However, not all compilers
support that flag (e.g. GCC, which is not a cross-compiler). As a result,
setting e.g. LIBCXX_TARGET_TRIPLE=<host-triple> would end up trying to
pass --target=<host-triple> to GCC, which breaks everything because the
flag isn't even supported.

This commit only adds `--target=<...>` & friends to the flags if it is
supported by the compiler.

One could argue that it's confusing to pass LIBCXX_TARGET_TRIPLE=<...>
and have it be ignored. That's correct, and one possibility would be
to assert that the requested triple is the same as the host triple when
we know the compiler is unable to cross-compile. However, note that this
is a pre-existing issue (setting the TARGET_TRIPLE variable never had an
influence on the flags passed to the compiler), and also fixing that is
starting to look like reimplementing a lot of CMake logic that is already
handled with CMAKE_CXX_COMPILER_TARGET.

Differential Revision: https://reviews.llvm.org/D106082
2021-07-15 16:52:02 -04:00
Martin Storsjö 6596778b46 [libcxx] [test] Fix mismatches between aligned operator new and std::free
The XFAIL comments about VCRuntime not providing aligned operator new
are outdated; these days VCRuntime does provide them.

However, the tests used to fail on Windows, as the pointers allocated
with an aligned operator new (which is implemented with _aligned_malloc
on Windows) can't be freed using std::free() on Windows (but they need
to be freed with the corresponding function _aligned_free instead).

Instead override the aligned operator new to return a dummy suitably
aligned pointer instead, like other tests that override aligned operator
new.

Also override `operator delete[]` instead of plain `operator delete`
in the array testcase; the fallback from `operator delete[]` to
user defined `operator delete` doesn't work in all DLL build
configurations on Windows.

Also expand the TEST_NOEXCEPT macros, as these tests only are built
in C++17 mode.

By providing the aligned operator new within the tests, this also makes
these test cases pass when testing back deployment on macOS 10.9.

Differential Revision: https://reviews.llvm.org/D105962
2021-07-15 23:37:56 +03:00
Louis Dionne 8fb47456a3 [libc++/abi] Fix broken Lit feature no-noexcept-function-type
The feature was always defined, which means that the two test cases
guarded by it were never run.

Differential Revision: https://reviews.llvm.org/D106062
2021-07-15 14:42:07 -04:00
Louis Dionne 4628ff4c31 [libc++] NFC: Reindent the run-buildbot script 2021-07-15 13:29:58 -04:00
Louis Dionne 1f8e286cdc [libc++] Add a CMake target to re-generate files and revamp CONTRIBUTING.rst
As we automate more and more things in the library, it becomes useful for
contributors to have a single target for running all the automation as
part of their workflow. This commit adds a new `libcxx-generate-files`
target that should re-generate all the auto-generated files in the library.

As a fly-by, I also revamped the documentation on Contributing to account
for this new target and present it as a bullet list of things to check
before committing. I also added a few things that are often overlooked
to that list, such as updating the synopsis and the status files.

Differential Revision: https://reviews.llvm.org/D106067
2021-07-15 12:07:26 -04:00
Louis Dionne 5024fe9306 [libc++] Mark failing rel_ops test as XFAIL in back-deployment
The test triggers availability errors.
2021-07-15 08:04:33 -04:00
Louis Dionne 3001b48d76 [libc++] Implement views::all_t and ranges::viewable_range
Differential Revision: https://reviews.llvm.org/D105816
2021-07-15 07:54:33 -04:00
Louis Dionne 0c3401c86e [runtimes] Serialize all Lit params instead of passing them to add_lit_testsuite
add_lit_testsuite() takes Lit parameters passed to it and adds them
to the parameters used globally when running all test suites. That
means that a target like `check-all`, which ends up calling Lit on
the whole monorepo, will see the test parameters for all the individual
project's test suites.

So, for example, it would see `--param std=c++03` (from libc++abi), and
`--param std=c++03` (from libc++), and `--param whatever` (from another
project being tested at the same time). While always unclean, that works
when the parameters all agree. However, if the parameters share the same
name but have different values, only one of those two values will be used
and it will be incredibly confusing to understand why one of the test
suites is being run with the incorrect parameter value.

For that reason, this commit moves away from using add_lit_testsuite()'s
PARAM functionality, and serializes the parameter values for the runtimes
in the generated config.py file instead, which is local to the specific
test suite.

Differential Revision: https://reviews.llvm.org/D105991
2021-07-15 07:53:15 -04:00
Arthur O'Dwyer 4118858b4e [libc++] NFCI: Restore code duplication in wrap_iter, with test.
It turns out that D105040 broke `std::rel_ops`; we actually do need
both a one-template-parameter and a two-template-parameter version of
all the comparison operators, because if we have only the heterogeneous
two-parameter version, then `x > x` is ambiguous:

    template<class T, class U> int f(S<T>, S<U>) { return 1; }
    template<class T> int f(T, T) { return 2; }  // rel_ops
    S<int> s; f(s,s);  // ambiguous between #1 and #2

Adding the one-template-parameter version fixes the ambiguity:

    template<class T, class U> int f(S<T>, S<U>) { return 1; }
    template<class T> int f(T, T) { return 2; }  // rel_ops
    template<class T> int f(S<T>, S<T>) { return 3; }
    S<int> s; f(s,s);  // #3 beats both #1 and #2

We have the same problem with `reverse_iterator` as with `__wrap_iter`.
But so do libstdc++ and Microsoft, so we're not going to worry about it.

Differential Revision: https://reviews.llvm.org/D105894
2021-07-14 20:10:52 -04:00
Martin Storsjö d37689e9ab [libcxx] [test] Remove a LIBCXX-WINDOWS-FIXME in trivial_abi/unique_ptr_ret
This is the same thing that was clarified in D105906 for weak_ptr_ret.

Differential Revision: https://reviews.llvm.org/D105965
2021-07-14 23:20:11 +03:00
Louis Dionne 850b57c5fb [runtimes] Bring back TARGET_TRIPLE
This commit reverts 5099e01568 and 77396bbc98, which broke the build
in various ways. I'm reverting until I can investigate, since that
change appears to be way more subtle than it seemed.
2021-07-14 15:15:22 -04:00
Louis Dionne 5099e01568 [runtimes] Inherit the TARGET_TRIPLE that may be set by LLVM 2021-07-14 14:29:29 -04:00
Louis Dionne 77396bbc98 [runtimes] NFCI: Drop intermediate CMake variable TARGET_TRIPLE
We might as well use the various XXX_TARGET_TRIPLE variables directly.
2021-07-14 10:49:28 -04:00
Martin Storsjö 2c425c17e6 [libcxx] [test] Clarify weak_ptr_ret on Windows, remove a LIBCXX-WINDOWS-FIXME
On Windows, structs with a destructor are always returned indirectly;
add this to the list of known exceptions in the test where the class
isn't returned in registers as expected.

Differential Revision: https://reviews.llvm.org/D105906
2021-07-14 09:08:06 +03:00
Martin Storsjö 1c69005c2e [libcxx] [docs] Acknowledge that the library is known to work in some configs outside of what's tested in CI
Differential Revision: https://reviews.llvm.org/D105888
2021-07-13 23:18:55 +03:00
Arthur O'Dwyer 7efe388785 [libc++] [test] Add a missing `()` in TestEachIntegralType. 2021-07-13 15:57:43 -04:00
Louis Dionne 2a399e60b6 [libc++] Add a CI job for macOS on arm64 hardware 🥳
Differential Revision: https://reviews.llvm.org/D105848
2021-07-13 13:49:05 -04:00
Louis Dionne 04942a7ffc [libc++] NFC: Add comment for running macOS CI setup script remotely 2021-07-13 13:35:29 -04:00
John Ericson 1e03c37b97 Prepare Compiler-RT for GnuInstallDirs, matching libcxx, document all
This is a second attempt at D101497, which landed as
9a9bc76c0e but had to be reverted in
8cf7ddbdd4.

This issue was that in the case that `COMPILER_RT_INSTALL_PATH` is
empty, expressions like "${COMPILER_RT_INSTALL_PATH}/bin" evaluated to
"/bin" not "bin" as intended and as was originally.

One solution is to make `COMPILER_RT_INSTALL_PATH` always non-empty,
defaulting it to `CMAKE_INSTALL_PREFIX`. D99636 adopted that approach.
But, I think it is more ergonomic to allow those project-specific paths
to be relative the global ones. Also, making install paths absolute by
default inhibits the proper behavior of functions like
`GNUInstallDirs_get_absolute_install_dir` which make relative install
paths absolute in a more complicated way.

Given all this, I will define a function like the one asked for in
https://gitlab.kitware.com/cmake/cmake/-/issues/19568 (and needed for a
similar use-case).

---

Original message:

Instead of using `COMPILER_RT_INSTALL_PATH` through the CMake for
complier-rt, just use it to define variables for the subdirs which
themselves are used.

This preserves compatibility, but later on we might consider getting rid
of `COMPILER_RT_INSTALL_PATH` and just changing the defaults for the
subdir variables directly.

---

There was a seaming bug where the (non-Apple) per-target libdir was
`${target}` not `lib/${target}`. I suspect that has to do with the docs
on `COMPILER_RT_INSTALL_PATH` saying was the library dir when that's no
longer true, so I just went ahead and fixed it, allowing me to define
fewer and more sensible variables.

That last part should be the only behavior changes; everything else
should be a pure refactoring.

---

I added some documentation of these variables too. In particular, I
wanted to highlight the gotcha where `-DSomeCachePath=...` without the
`:PATH` will lead CMake to make the path absolute. See [1] for
discussion of the problem, and [2] for the brief official documentation
they added as a result.

[1]: https://cmake.org/pipermail/cmake/2015-March/060204.html

[2]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#options

In 38b2dec37e the problem was somewhat
misidentified and so `:STRING` was used, but `:PATH` is better as it
sets the correct type from the get-go.

---

D99484 is the main thrust of the `GnuInstallDirs` work. Once this lands,
it should be feasible to follow both of these up with a simple patch for
compiler-rt analogous to the one for libcxx.

Reviewed By: phosek, #libc_abi, #libunwind

Differential Revision: https://reviews.llvm.org/D105765
2021-07-13 15:21:41 +00:00
Louis Dionne 0da95a5cf2 [libc++] Workaround non-constexpr std::exchange pre C++20
std::exchange is only constexpr in C++20 and later. We were using it
in a constructor marked unconditionally constexpr, which caused issues
when building with -std=c++17.

The weird part is that the issue only showed up when building on the
arm64 macs, but that must be caused by the specific version of Clang
used on those. Since the code is clearly wrong and the fix is obvious,
I'm not going to investigate this further.
2021-07-13 10:51:03 -04:00
Louis Dionne c5ad8bb8d4 [libc++] Target x86_64 only for the backdeployment jobs
Differential Revision: https://reviews.llvm.org/D105846
2021-07-13 10:29:08 -04:00
Louis Dionne 2a9366c0e5 [libc++] Generate ABI list for macOS arm64 2021-07-13 10:16:50 -04:00
Louis Dionne e47444e216 [libc++] ci: Properly target macOS nodes per-os 2021-07-12 17:26:16 -04:00
Louis Dionne cb30d597c4 [libc++] Add the 'os=macos' tag to macOS nodes to workaround lack of wildcard matching 2021-07-12 17:22:34 -04:00
Louis Dionne 15df9c9881 [libc++][ci] Clean up the Docker image
- Remove symlinks that are not used anymore
- Stop installing GCC 10, which isn't tested anymore
2021-07-12 17:04:25 -04:00
Louis Dionne 877e97a954 [libc++] Use 'os' tags to target Linux libc++ builders 2021-07-12 17:01:54 -04:00
Martin Storsjö d5d477780c [libcxx] [test] Fix spurious failures in the thread join test on Windows
Make sure that the detached thread has started up before exiting
the process.

This is exactly the same fix as D105592, with the same pattern
being present in a different test case.

Differential Revision: https://reviews.llvm.org/D105736
2021-07-12 23:31:53 +03:00
zoecarver e5e291e135 [libcxx][docs] Update the ranges status document to reflect the current state of the world.
Marks a few things as done. Marks a few things as in progress. Assigns a few things to me.
2021-07-12 13:11:17 -07:00
Louis Dionne 0a9afaf736 [libc++] Encode the arch and OS in buildkite agent tags 2021-07-12 16:01:38 -04:00
Louis Dionne 1ca748608d [libc++] Exit from macos-ci-setup upon error 2021-07-12 15:44:35 -04:00
Louis Dionne 87bfc49db5 [libc++][ci] Add arch and os tags to the macOS CI builders 2021-07-12 15:34:57 -04:00
Louis Dionne 5208ec5c66 [libc++] Update Google benchmark to v 1.5.5 2021-07-12 13:59:03 -04:00
Louis Dionne 88b73a980f [libc++] Remove random [[nodiscard]] in the test suite 2021-07-12 12:45:21 -04:00
Louis Dionne 85cce4d485 [libc++] Test on Clang ToT by default
This is what ffccf96e90 should have enabled, however the symlink
in the Docker image was not pointing to the right compiler, so we were
testing with Clang 12 instead of ToT.
2021-07-12 11:13:43 -04:00
Louis Dionne f192616ce9 [libc++] NFC: Fix synopsis comments and sort includes in ranges 2021-07-12 09:56:09 -04:00
David Spickett f8bef47348 [libcxx][CI] Work around Arm buildkite failures
For reasons unknown, the build is now using compilers
from /usr/bin instead of /usr/local/bin which is where
we have our clang-12 aliases placed.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D105704
2021-07-09 15:29:49 -04:00
zoecarver 0e09a41b41 [libcxx][ranges] Add `ranges::transform_view`.
Reviewed By: cjdb, ldionne, #libc

Differential Revision: https://reviews.llvm.org/D103056
2021-07-09 10:13:57 -07:00
zoecarver 0849427fae [libcxx][nfc] Remove <variant>'s dependence on <array>.
This will allow us to use variant in common_iterator. We do this by introducing a new `__light_array` type that variant uses instead of `std::array`.

Differential Revision: https://reviews.llvm.org/D105597
2021-07-09 10:13:57 -07:00
Louis Dionne 7a372c4ce1 [libc++][ci] Keep the C++03 build job on Clang 12
Because of https://reviews.llvm.org/D104500, libc++ is broken with
recent Clangs in C++03 mode.
2021-07-09 12:22:48 -04:00
Louis Dionne ffccf96e90 [libc++][ci] Test Clang ToT by default, and add jobs on Clang 11 and 12
It makes the most sense to test with Clang ToT by default since that's
exactly what we're trying to QA: that libc++ works with whatever compiler
we're going to release next.
2021-07-09 10:17:12 -04:00
Louis Dionne 74fb868942 [libc++] Add XFAIL for Clang ToT with modules
This is what I should have done instead of 6afd6e96ce.
2021-07-08 14:40:18 -04:00
Louis Dionne 8ea2b951c6 [libc++][ci] Install Clang 11, Clang 12 and Clang ToT in the Docker image
The compiler support policy mentions that we support Clang 11 and 12, so
we should test those. We already test on Clang 12, but I'll add testers
for Clang 11 once the new Docker image is in use on all the builders.
2021-07-08 14:14:17 -04:00
Louis Dionne d2a8d362c5 [libc++][ci] Stop testing on GCC previous, since we don't support it anymore
This is the first of a few commits that update the CI to match the
recently officialized compiler support policy. I'm staging those
changes to try and keep the CI green at all times, accounting how
builders refresh their Docker image.
2021-07-08 12:33:26 -04:00
Louis Dionne a276f45180 [libc++][docs] Update documentation to reflect libc++'s compiler support policy
In https://lists.llvm.org/pipermail/llvm-dev/2021-March/148881.html, we
discussed updating the compiler support policy for libc++ to match more
closely what we do actually support.

This commit enshrines that policy decision in libc++'s documentation.

Differential Revision: https://reviews.llvm.org/D105563
2021-07-08 11:56:50 -04:00
Louis Dionne 6afd6e96ce [libc++] Workaround failures with modules on Clang ToT 2021-07-08 11:50:54 -04:00
Mark de Wever 321c2ea91c [libc++][NFC] Move monostate to its own header.
The format library uses `std::monostate`, but not a `std::variant`.
Moving `std::monostate` to its own header allows the format library to
reduce the amount of included code.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D105582
2021-07-08 17:35:26 +02:00
Mark de Wever 4947ecf4e9 [libc++] Guard testing implementation details.
The unit tests test some implementation details. As @Quuxplusone pointed
out in D96664 this should only be tested when the tests use libc++. This
addresses the issue for code already in main.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D105568
2021-07-08 17:34:58 +02:00
Martin Storsjö 715ca752ac [libcxx] [test] Fix spurious failures in the thread detach test on Windows
Make sure that the detached thread has started up before exiting
the process.

If the detached thread hasn't started up at all, and the main thread
exits, global data structures in the process are torn down, which
then can cause crashes when the thread starts up late after required
mutexes have been destroyed. (In particular, the mutex used internally
in _Init_thread_header, which is used in the initialization of
__thread_local_data()::__p, can cause crashes if the main thread already
has finished and progressed far with destruction.)

Differential Revision: https://reviews.llvm.org/D105592
2021-07-08 12:36:03 +03:00
Daniel McIntosh d0fe294729 [SystemZ][z/OS][libcxx] mark aligned allocation tests UNSUPPORTED on z/OS
zOS doesn't support aligned allocation, so these tests are failing.
For more details on aligned allocation in zOS, see
https://reviews.llvm.org/D87611 and https://reviews.llvm.org/D90178

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D102798
2021-07-07 10:54:38 -04:00
Louis Dionne feef171f76 [libc++] NFC: Fix incorrect comments in CMake 2021-07-07 09:45:32 -04:00
Louis Dionne 6829db727e [libc++] Implement copyable-box from Ranges
Differential Revision: https://reviews.llvm.org/D102135
2021-07-07 06:14:24 -04:00
Louis Dionne 6e43f3fc14 [libc++] Do not set CMAKE_BUILD_WITH_INSTALL_NAME_DIR
I'm not sure what that gains us, and it creates a problem when
trying to run the tests against libc++ with a custom install name
dir (e.g. /usr/lib), since the library that we link against (in
the build tree) will advertise itself as /usr/lib/libc++.dylib,
so we end up linking against the system dylib at runtime.

Differential Revision: https://reviews.llvm.org/D105499
2021-07-06 14:46:47 -04:00
Louis Dionne 5d2511c389 [libc++] NFC: Sort header lists and remove outdated comments in modulemap 2021-07-06 14:45:52 -04:00
Louis Dionne 2ce0df4dfb [libc++][docs] Overhaul the documentation for building and using libc++
This patch overhauls the documentation around building libc++
for vendors, and using libc++ for end-users. It also:

- Removes mention of the standalone build, which we've been trying to
  get rid of for a long time.
- Removes mention of using a local ABI installation, which we don't do
  and is documented as "not recommended".
- Removes mention of the separate libc++filesystem.a library, which isn't
  relevant anymore since filesystem support is in the main library.
- Adds mention of the GDB pretty printers and how to use them.
2021-07-06 14:09:14 -04:00
Christopher Di Bella 8517a26d44 [libcxx][modularisation] splices `<iterator>` into individual headers
Differential Revision: https://reviews.llvm.org/D105076
2021-07-06 17:59:21 +00:00
Louis Dionne 5ffa051447 [libc++] NFC: Remove outdated link to TS status 2021-07-06 10:04:54 -04:00
Louis Dionne cf005c4c50 [libc++] NFC: Move the status docs to their own subdirectory
This cleans up the libcxx/doc directory quite a bit and will avoid the
proliferation of status files in that directory as new standards are voted.
2021-07-06 09:48:34 -04:00
Louis Dionne f7d8754312 [runtimes] Move enable_32bit to the DSL
This is necessary for from-scratch configurations to support the 32-bit
mode of the test suite.

Differential Revision: https://reviews.llvm.org/D105435
2021-07-06 08:42:07 -04:00
Louis Dionne 0f31f68e26 [libc++] NFC: Sort header lists in test scripts 2021-07-05 14:58:32 -04:00
Louis Dionne 0724c0e4fb [libc++] NFC: Add note about how the libcxx website gets updated 2021-07-05 10:25:33 -04:00
Louis Dionne 681aa574c0 [libc++] NFC: Sort headers in CMakeLists.txt 2021-07-05 09:25:15 -04:00
wmbat 2ff5a56e1a [libcxx][type_traits] remove `std::is_literal_type` and `std::result_of` for C++20
C++17 deprecated `std::is_literal_type` and `std::result_of`, C++20 removed them.

Implements parts of:
    * P0174R2 'Deprecating Vestigial Library Parts in C++17'.
    * P0619R4 'Reviewing Deprecated Facilities of C++17 for C++20'.

Reviewed By: ldionne, Mordante, Quuxplusone, #libc

Differential Revision: https://reviews.llvm.org/D102992
2021-07-02 17:10:19 +00:00
Arthur O'Dwyer 64a0241d64 [libc++] IWYU <__utility/pair.h> in <__functional/hash.h>. NFCI.
This was the only thing preventing any one of our detail headers from
compiling on its own.
2021-07-01 18:12:30 -04:00
zoecarver edc1f0c12c [libcxx][ranges] Implement indirectly_swappable.
Differential Revision: https://reviews.llvm.org/D105304
2021-07-01 15:08:23 -07:00
Louis Dionne c360553c15 [runtimes] Simplify how we specify XFAIL & friends based on the triple
Now that Lit supports regular expressions inside XFAIL & friends, it is
much easier to write Lit annotations based on the triple.

Differential Revision: https://reviews.llvm.org/D104747
2021-07-01 14:03:30 -04:00
jasonliu a319eafd16 [libc++] Provide c++03 alternative for va_copy if available in xlocale.h
Summary:
If we are on c++03 mode for some reason, and __builtin_va_copy is
available, then use it instead of error out on not having va_copy
in 03 mode.

Reviewed by: ldionne

Differential Revision: https://reviews.llvm.org/D100336
2021-07-01 18:02:38 +00:00
Christopher Di Bella 050b064f15 [libcxx][functional][modular] splices <functional> into modular headers
Differential Revision: https://reviews.llvm.org/D104942
2021-07-01 14:01:49 -04:00
zoecarver 000444214f [libcxx] Update optional star operator to be noexcept.
Differential Revision: https://reviews.llvm.org/D105296
2021-07-01 10:42:46 -07:00
Louis Dionne f83654982b [libc++] Migrate the additional_features parameter to the DSL
This is required to run the tests under any configuration that uses
additional_features using a from-scratch config. That is the case of
e.g. the Debug mode (which uses LIBCXX-DEBUG-FIXME) and the tests on
Windows.
2021-07-01 13:38:09 -04:00
Louis Dionne c475efe916 [libc++] Fix incorrect shell expansion in macos-ci-setup 2021-07-01 10:09:20 -04:00
Corentin Jabot b9c24257c7 Add list of LWG papers accepted by WG21 during the June 2021 plenary
Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D105103
2021-07-01 04:27:23 +00:00
Arthur O'Dwyer e5fbe9f315 [libc++] graph_header_deps.py: Detect files that include themselves.
This wasn't happening before, which led to one slipping in.
2021-06-30 17:37:43 -04:00
Louis Dionne c69cfbfd71 [libc++] Remove broken links and outdated information in the docs
The various design docs have been moved to RST, and the linked blog post
does not apply anymore since libc++ is the default library used by Clang
on Apple platforms.
2021-06-30 11:12:37 -04:00
Louis Dionne a562853a51 [libc++] NFC: Fix return-by-const-value and pass-by-const-value typos
While we can debate on the value of passing by const value, there is no
arguing that it's confusing to do so in some circumstances, such as when
marking a pointer parameter as being const (did you mean a pointer-to-const?).
This commit fixes a few issues along those lines.
2021-06-29 13:57:04 -04:00
Arthur O'Dwyer 287847dace [libc++] Update ABI docs. NFCI.
Differential Revision: https://reviews.llvm.org/D103160
2021-06-29 12:39:23 -04:00
Louis Dionne d03aa7d6b6 [libc++] NFCI: Remove __functional/search.h
The __search helper function was once split into __functional for circular
dependency reasons, however this is not an issue anymore now that we have
finer grained headers.
2021-06-29 11:40:47 -04:00
Louis Dionne 58a230455b [libc++] Serialize Lit parameters to make them available to from-scratch configs
Before this patch, Lit parameters that were set as a result of CMake
options were not made available to from-scratch configs. This patch
serializes those parameters into the generated lit config file so that
they are available to all configs.

Differential Revision: https://reviews.llvm.org/D105047
2021-06-29 10:51:42 -04:00
Louis Dionne 7756216547 [libc++] NFCI: Remove code duplication and obsolete declarations in wrap_iter
Differential Revision: https://reviews.llvm.org/D105040
2021-06-29 10:51:07 -04:00
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