Commit Graph

7771 Commits

Author SHA1 Message Date
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