Commit Graph

7756 Commits

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