1191 Commits

Author SHA1 Message Date
Mark de Wever
f29f1c7e23 [libc++]{CI] Bumps clang-tidy version used.
The CI can no longer run with clang-tidy 16 increment it to version 17.
Whether permanently moving to the latest development version is being
discussed on Discourse.

Depends on D149455

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D151628
2023-05-31 17:25:42 +02:00
Mark de Wever
cf64668b8c [libc++][test] Prefers the newer clang-tidy version.
Module require Clang 17, since Clang 16 requires the magic # __FILE__
line. Therefore, if available, use clang-tidy 17 too. This change should
be reverted after LLVM 17 is released.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D149455
2023-05-31 17:24:37 +02:00
Mark de Wever
4de9936fe0 [libc++][CI] Escape quoting.
This should fix the Clang CI.
2023-05-31 07:55:05 +02:00
Louis Dionne
19ef02e3f4 [libc++][ci] Use ccache in the jobs that build Clang
This is an attempt to reduce the time taken by the Bootstrapping
build job and the Clang CI job that builds the compiler from scratch.

Differential Revision: https://reviews.llvm.org/D150908
2023-05-30 13:10:03 -07:00
Mark de Wever
d951c6a533 [libc++][CI] Installs libomp.
This is needed to build clang-tidy plugins using clang-tidy 17.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D151488
2023-05-30 18:40:36 +02:00
Louis Dionne
1ee839d0ce [libc++] Use the new .gen tests to implement __verbose_abort tests
This reduces the amount of boilerplate that we need to generate
for each commit. It also resolves a problem where the modular CI
would run extremely slow on this test because we'd define a macro
before including the standard library, defeating the module cache.

Differential Revision: https://reviews.llvm.org/D151156
2023-05-29 12:28:52 -07:00
Louis Dionne
437ec156ef [libc++][ci] Install ccache in the Docker image
This will allow using ccache in the jobs that build Clang, which
should speed up those jobs.

Differential Revision: https://reviews.llvm.org/D150907
2023-05-26 10:42:26 -07:00
Louis Dionne
f039caec33 [libc++] Add support for generated tests in the libc++ test format
A recurring problem recently has been that libc++ has several generated
tests which all need to be re-generated before committing a change. This
creates noise during code reviews and friction for contributors.

Furthermore, the way we generated most of these tests resulted in
extremely bad compilation times when using modules, because we defined
a macro before compiling each file.

This commit introduces a new kind of test called a '.gen' test. These
tests are normal shell tests, however the Lit test format will run the
test to discover the actual Lit tests it should run. This basically
allows generating a Lit test suite on the fly using arbitrary code,
which can be used in the future to generate tests like our __verbose_abort
tests and several others.

Differential Revision: https://reviews.llvm.org/D151258
2023-05-25 14:17:45 -07:00
Tobias Hieta
7bfaa0f09d
[NFC][Py Reformat] Reformat python files in libcxx/libcxxabi
This is an ongoing series of commits that are reformatting our
Python code.

Reformatting is done with `black`.

If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.

If you run into any problems, post to discourse about it and
we will try to help.

RFC Thread below:

https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Reviewed By: #libc, kwk, Mordante

Differential Revision: https://reviews.llvm.org/D150763
2023-05-25 11:15:34 +02:00
Nikolas Klauser
140c375ab1 Revert "[libc++] Apply _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION only in classes that we have instantiated externally"
This reverts commit b3c9150062dc4264afb4a3d2790f071c1ebe0743.

There were unexpected breakages downstream. @EricWF is investigating.
2023-05-24 08:48:18 -07:00
Mark de Wever
dff62f5251 [libc++][format] Removes the experimental status.
The code has been quite ready for a while now and there are no more ABI
breaking papers. So this is a good time to mark the feature as stable.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D150802
2023-05-24 17:16:22 +02:00
Mark de Wever
bea2ff6550 [libc++] Untangles invoke.
The type traits parts are moved to a type_traits detail header.
This was discovered while working on modules.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D150538
2023-05-24 07:51:27 +02:00
Mark de Wever
00c97cbc57 [libc++] Adds C++26 support.
Clang has been updated to support C++26, this adds the same support for
libc++. At the moment C++23 and C++26 are identical. During the next
plenary in June the first C++26 papers will be voted on.

Note like Clang this patch uses C++26 is the internal part and C++2c in
the user visible part.

Depends on D150795

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D151026
2023-05-24 07:49:19 +02:00
Louis Dionne
5b125d0664 [libc++][NFC] Refactor helper method into the Lit test format
Differential Revision: https://reviews.llvm.org/D151238
2023-05-23 21:49:53 -07:00
Nikolas Klauser
b3c9150062 [libc++] Apply _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION only in classes that we have instantiated externally
To make sure all member functions that require it are marked `_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION` I compared the output of `objdump --syms lib/libc++.1.0.dylib` before and after, ignoring addresses.

Reviewed By: #libc, ldionne

Spies: Mordante, libcxx-commits, ldionne, arichardson, mstorsjo

Differential Revision: https://reviews.llvm.org/D150896
2023-05-23 13:32:55 -07:00
Azat Khuzhin
d4d96c4444 [libcxx][tests] Introduce 32-bit feature and use it for stringstream gcount test
This will avoid hardcoding all unsupported targets, since even after one
more follow up fix [1], there is one more failure.

  [1]: https://reviews.llvm.org/D150886

Plus, if you want to run it locally on some target that CI does not
covers, it could also false-positively fail, which is not good.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D151046
2023-05-23 19:29:15 +02:00
Mark de Wever
4ef1393e1b [libc++][doc] Updates the tasks to do for a release.
This is a followup of the review comments in D144499.

Reviewed By: ldionne, philnik, #libc

Differential Revision: https://reviews.llvm.org/D150585
2023-05-23 19:02:17 +02:00
Mark de Wever
71400505ca [libc++] Updates C++2b to C++23.
During the ISO C++ Committee meeting plenary session the C++23 Standard
has been voted as technical complete.

This updates the reference to c++2b to c++23 and updates the __cplusplus
macro.

Note since we use clang-tidy 16 a small work-around is needed. Clang
knows -std=c++23 but clang-tidy not so for now force the lit compiler
flag to use -std=c++2b instead of -std=c++23.

Reviewed By: #libc, philnik, jloser, ldionne

Differential Revision: https://reviews.llvm.org/D150795
2023-05-23 18:44:41 +02:00
Nikolas Klauser
18c4695ded [libc++][NFC] Fix whitespace problems in the files added to ignore_format.txt in D151115
Reviewed By: ldionne, #libc, Mordante

Spies: arichardson, Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D151119
2023-05-23 08:44:10 -07:00
Nikolas Klauser
39cc774708 [libc++] Fix ignore_format.txt list
For some reason the expected ignore_format.txt changed. This patch fixes it in trunk, but the problem is being investigated.

Reviewed By: #libc, Mordante

Spies: Mordante, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D151115
2023-05-22 09:35:06 -07:00
Nikolas Klauser
95715ddb5d [libc++] Install GCC 13 in the docker containers
Reviewed By: ldionne, #libc, Mordante

Spies: Mordante, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D150695
2023-05-19 09:20:54 -07:00
Mark de Wever
5db033e204 [libc++][format] Improves fill character.
The main change is to allow a UCS scalar value as fill character.
Especially for char based formatting this increase the number of valid
characters. Originally this was to be expected ABI breaking, however the
current change does not seem to break the ABI.

Implements
- P2572 std::format() fill character allowances

Depends on D144499

Reviewed By: ldionne, tahonermann, #libc

Differential Revision: https://reviews.llvm.org/D144742
2023-05-19 17:20:50 +02:00
yronglin
acce2a3159 [libc++] Implement P2505R5(Monadic operations for std::expected).
Implement P2505R5(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2505r5.html)

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D140911
2023-05-18 01:05:25 +08:00
yronglin
5ae9098e5c Revert "[libc++] Implement P2505R5(Monadic operations for std::expected)."
This reverts commit ebc111b08bddca55d5f7e560a20bdb2c913d80cb.

Sorry, I forgot to append Phabricator reversion when land D140911, I try to revert this change and reland.

Reviewed By: #libc, ldionne, EricWF

Differential Revision: https://reviews.llvm.org/D150793
2023-05-18 00:55:47 +08:00
Louis Dionne
afbd36f153 [libc++][NFC] Rename the 'noexceptions' CI config to 'no-exceptions' for consistency
Differential Revision: https://reviews.llvm.org/D150672
2023-05-17 09:55:03 -07:00
yronglin
ebc111b08b [libc++] Implement P2505R5(Monadic operations for std::expected).
Signed-off-by: yronglin <yronglin777@gmail.com>
2023-05-17 23:42:01 +08:00
Christian Trott
fcaccf817d [libcxx] Add mdspan/extents
This patch adds std::extents. extents is one of the core classes used by std::mdspan. It describes a multi-dimensional index space with a mix of compile time and runtime sizes. Furthermore, it is templated on the index type used to describe the multi-dimensional index space.

The class is designed to be highly optimizable in performance critical code sections, and is fully useable in constant expressions contexts.

Testing of this class tends to be somewhat combinatorical, due to the large number of possible corner cases involved in situations where we have both runtime and compile time extents. To add to this, the class is designed to be interoperable (in particular constructible) from arguments which only need to be convertible to the index_type, but are otherwise arbitrary user types. For a larger discussion on the design of this class refer to: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html

Co-authored-by: Damien L-G <dalg24@gmail.com>

Reviewed By: ldionne, #libc

Spies: libcxx-commits, H-G-Hristov, tschuett, philnik, arichardson, Mordante, crtrott

Differential Revision: https://reviews.llvm.org/D148067
2023-05-16 14:30:36 -07:00
Martin Storsjö
391b51b18f [libcxx] [test] Improve error reporting around invoked commands
This was requested in the review of D145807, but I had missed to
apply it before landing the patch.

Differential Revision: https://reviews.llvm.org/D150444
2023-05-16 21:27:54 +03:00
Mark de Wever
b7932803de [libc++] Moves unwrap_reference to type_traits.
This was discovered while working on modules.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D149351
2023-05-14 20:03:55 +02:00
Nikolas Klauser
b97859b674 [libc++][PSTL] Move the already implemented functions to the new dispatching scheme
Reviewed By: ldionne, #libc

Spies: arichardson, pcwang-thead, libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D150277
2023-05-12 13:11:16 -07:00
Mark de Wever
b51e8acd82 [NFC][libc++][format] Uses uniform member signatures.
The newer formatters for (tuple, vector<bool>::reference) specify the
formatter's parse and format member function. This signature is slightly
different from the signature for existing formatters. Adapt the existing
formatters to the new style.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D150034
2023-05-12 17:48:23 +02:00
Mark de Wever
f271df0e79 [clang][ci] Improves buildkite artifacts.
The financial cost of the network I/O for the Clang install artifacts is
quite significant. afd3478f37c8 improved this by creating tarballs. This
commit improves the tarball by using xz compression instead of gzip. This
option is the slowest, but gives the smallest size.

      size  time           time
            (compression)  (decompression)
gzip  51 M  7  s           1.2 s
bz2   44 M  17 s           5.8 s
xz    33 M  76 s           3.1 s

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D150062
2023-05-12 17:44:26 +02:00
John Brawn
4d9c936a3e [libc++] Adjust tests using ext/* headers that undefine __DEPRECATED
Several tests undefined __DEPRECATED to avoid warnings as they're
testing the deprecated ext/hash_map. A better way to do this is to use
-Wno-deprecated so it isn't defined in the first place. This prevents
these tests from failing when we give a warning when undefining the
__DEPRECATED macro, as D144654 will do.

For the generated tests however just remove the testing of these
header files, so we don't disable the warning when testing the other
header files.

Differential Revision: https://reviews.llvm.org/D145691
2023-05-11 11:47:11 +01:00
Nikolas Klauser
f041b3472a [libc++][PSTL] Move the remaining configuration into __config
Reviewed By: ldionne, #libc

Spies: sstefan1, jplehr, arichardson, libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D150217
2023-05-10 09:23:13 -07:00
Louis Dionne
9fca0313f8 [libc++] Fix mistake in documentation of libcxx-lit script 2023-05-08 08:59:01 -04:00
Mark de Wever
fbc6a2a3f6 Revert "[libc++] Soft-fail the two sanitizer jobs that have been failing in CI for a while"
This reverts commit 3e44aa659b98674a1220da235bc2cbafcb311a78.

The CI has been fixed so this band aid is no longer needed.
2023-05-07 12:39:18 +02:00
Nikolas Klauser
e7e3711885 [libc++][PSTL] Make the PSTL available by default under -fexperimental-library
This removes the need for a custom libc++ build to have a basic set of PSTL algorithms.

Reviewed By: ldionne, #libc

Spies: miyuki, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D149624
2023-05-05 13:53:17 -07:00
Louis Dionne
afd3478f37 [clang][ci] Upload artifacts in a tarball to reduce size and avoid symlink issues 2023-05-05 15:45:52 -04:00
Louis Dionne
3b6bc87520 [libc++] Remove Solaris related code
This was contributed ~10 years ago, but we don't officially support it
and I am not aware of any bot testing it, so this has likely rotten to
the point where it is unusable.

Differential Revision: https://reviews.llvm.org/D138680
2023-05-05 08:39:51 -04:00
Mark de Wever
bd7da23c66 [libc++] Formats the forwarded ios headers.
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D149350
2023-05-03 18:34:42 +02:00
Louis Dionne
3e44aa659b [libc++] Soft-fail the two sanitizer jobs that have been failing in CI for a while
They are not failing on local Docker images, so something must be wrong
with our GCE instances.
2023-05-03 12:25:53 -04:00
Louis Dionne
c64f10bfe2 [clang] Build the ToT Clang in Release mode in the Clang/libcxx CI pipeline
This is an attempt to reduce the insane amount of network we use when
uploading Clang binaries to Buildkite for other jobs to use. We think
that removing debug information will result in much smaller binaries.
2023-05-02 17:15:14 -04:00
Ian Anderson
a595b931f1 [libc++] cuchar redeclares ::mbstate_t when it's in its own clang module
When cuchar is compiled independently on platforms that don't have <uchar.h>, it doesn't get a declaration of mbstate_t, and so makes an empty declaration for ::mbstate_t. That conflicts with the declarations in __mbstate_t.h and cwchar since both of those headers do get mbstate_t before making ::mbstate_t.

Change `__mbstate_t.h` to just get the underlying declaration for mbstate_t and not make a declaration for ::mbstate_t. Include __mbstate_t.h in uchar.h and wchar.h when their next headers aren't available so that at least mbstate_t gets defined.

Add __std_mbstate_t.h to declare ::mbstate_t for headers that need that when cuchar or cwchar aren't available (because either _LIBCPP_HAS_NO_WIDE_CHARACTERS or _LIBCPP_CXX03_LANG).

Reviewed By: ldionne, Mordante, #libc, philnik

Differential Revision: https://reviews.llvm.org/D148542
2023-05-01 13:48:20 -05:00
Louis Dionne
faa78ecd27 [clang] Temporarily enable debug output when uploading artifacts during CI jobs
This is an attempt to troubleshoot our excessive usage of network in
Clang jobs on Buildkite.
2023-05-01 09:48:14 -04:00
Nikolas Klauser
8af259e8d9 [libc++][PSTL] Implement std::{any, all, none}_of
Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D143161
2023-04-29 20:41:42 -07:00
Nikolas Klauser
bf199576f9 [libc++][PSTL][NFC] Rename to pstl/ to __pstl/
Reviewed By: ldionne, #libc

Spies: sstefan1, pcwang-thead, jplehr, libcxx-commits, arichardson, mgrang, miyuki

Differential Revision: https://reviews.llvm.org/D149275
2023-04-27 13:33:03 -07:00
Nikolas Klauser
1e9f7079de [libc++][PSTL][NFC] clang-format files
Reviewed By: ldionne, #libc

Spies: sstefan1, pcwang-thead, jplehr, libcxx-commits, arichardson, mgrang

Differential Revision: https://reviews.llvm.org/D141781
2023-04-27 09:28:57 -07:00
Martin Storsjö
ba3bddb6f4 [libcxx] [test] Prepend to PATH instead of overriding it
On Windows, the PATH env variable is used for locating dynamically
linked librarys, akin to LD_LIBRARY_PATH on Linux.

The tests that run with a dynamically linked libc++ used "--env
PATH=%{lib}" in the test config. This had the unfortunate side effect
of making other tools from PATH unavailable during the runtime of the
tests; in particular, it caused the "executor-has-no-bash" flag to be
set for all those Windows test configs (with the clang-cl static config
being the only one lacking it).

Thus, this increases the number of tests actually included in the
clang-cl dll and all mingw test configs by 9 tests.

The clang-cl static test configuration has been executing those tests
since the "--env PATH=%{lib}" was removed from that test config in
e78223e79efc886ef6f0ea5413deab3737d6d63b. (For mingw we haven't had a
need to split the test config between shared and static, which means
that the mingw static test config previously ran with --env PATH
needlessly.)

This increases the test coverage for patches like D146398 which
can't be executed in the executor-has-no-bash configs.

Change the default value of the arg.env to an empty array; when we do
pass values to the option, they get passed as an array of strings,
so make sure the variable behaves consistently when no arguments
have been passed.

Differential Revision: https://reviews.llvm.org/D148324
2023-04-27 19:25:59 +03:00
Martin Storsjö
eb5f9a5a52 [libcxx] [test] Unbreak passing multiple env variables in ssh.py
No test actually does this, but this makes the option behave like
the corresponding one in run.py.

This was broken by commit b8b23aa80eefe84187d6ba364d06496c90c53bdb
(https://reviews.llvm.org/D99242) which introduced quoting; instead
of quoting the whole space separated list, quote each individual
argument.

Differential Revision: https://reviews.llvm.org/D149319
2023-04-27 19:25:59 +03:00
Martin Storsjö
1ec4e139ef [libcxx] [test] Print the failing commands in Configuration{Compilation,Runtime}Error
This allows for easier debugging of the test environment when something
fails.

Differential Revision: https://reviews.llvm.org/D145807
2023-04-27 19:24:35 +03:00