Commit Graph

773 Commits

Author SHA1 Message Date
Arthur O'Dwyer 5c40c994c3 [libc++] s/_LIBCPP_NO_HAS_CHAR8_T/_LIBCPP_HAS_NO_CHAR8_T/g
This was raised in D94511.

Differential Revision: https://reviews.llvm.org/D100736
2021-04-21 12:49:07 -04:00
Sterling Augustine 55b7061116 Tolerate missing debug info in the shared_ptr pretty printer.
Certain fields of shared ptr have virtual functions and therefore
have their debug info homed in libc++. But if libc++ wasn't built
with debug info, the pretty printer would fail.

This patch makes the pretty printer tolerate such conditions and
updates the test harness.

This patch significantly reworks a previous attempt.

This addresses https://bugs.llvm.org/show_bug.cgi?id=48937

Differential Revision: https://reviews.llvm.org/D100610
2021-04-20 09:52:46 -07:00
Louis Dionne 2704d0a701 [libc++][ci] Re-split the CI pipeline to try and reduce load on more builders 2021-04-20 08:37:52 -04:00
Kamlesh Kumar 36c3918ec5 [libc++] [C++20] [P0586] Implement safe integral comparisons
* https://wg21.link/P0586

Reviewed By: #libc, curdeius, Quuxplusone

Differential Revision: https://reviews.llvm.org/D94511
2021-04-20 04:52:59 +05:30
Arthur O'Dwyer e880c19c6a [libc++] [CI] Fail if the headers contain cyclic dependencies.
Since we have a tool to detect cycles now; and since we're entering
a phase where people can easily introduce cycles by accident (D100682)
or by request (D90999), I think it's increasingly important to shift
the burden of detecting these cycles onto the buildbot instead of
the poor human reviewer.

Also, grep for non-ASCII characters (such as U+200B and U+00AD)
and hard tabs; don't let those get checked in.

Differential Review: https://reviews.llvm.org/D100703
2021-04-18 12:58:04 -04:00
Mark de Wever 01ace074fc [libc++] Implements ranges::enable_borrowed_range
This is the initial patch to implement ranges in libc++.

Implements parts of:
- P0896R4 One Ranges Proposal
- P1870 forwarding-range is too subtle
- LWG3379 in several library names is misleading

Reviewed By: ldionne, #libc, cjdb, zoecarver, Quuxplusone

Differential Revision: https://reviews.llvm.org/D90999
2021-04-18 13:35:08 +02:00
Louis Dionne 8508b1c133 [libc++] Divorce the std Lit feature from the -std=XXX compiler flag
After this patch, we can use `--param std=c++20` even if the compiler only
supports -std=c++2a. The test suite will handle that for us. The only Lit
feature that isn't fully baked will always be the "in development" one,
since we don't know exactly what year the standard will be ratified in.

This is another take on https://reviews.llvm.org/D99789.

Differential Revision: https://reviews.llvm.org/D100210
2021-04-12 11:55:39 -04:00
Mark de Wever ae103003b2 [libc++] [CI] Validate the output of the generated scripts.
This adds a CI job validating that the output of
utils/generate_feature_test_macro_components.py,
libcxx/utils/generate_header_inclusion_tests.py, and
utils/generate_header_tests.py are up to date.

The validation method has been copied from the Format job.

Differential Revision: https://reviews.llvm.org/D99862
2021-04-11 15:35:23 +02:00
Christopher Di Bella 920c0f7e09 [libcxx] adds __cpp_lib_concepts feature-test macro
Also adjusts C++20 status paper to indicate full concepts support.

Depends on D96477, D99817.

Differential Revision: https://reviews.llvm.org/D99805
2021-04-07 16:14:45 +00:00
Arthur O'Dwyer 2d0f1fa472 [libc++] Header inclusion tests.
As mandated by the Standard's various synopses, e.g. [iterator.synopsis].
Searching the TeX source for '#include' is a good way to find all of these
mandates.

The new tests are all autogenerated by utils/generate_header_inclusion_tests.py.
I was SHOCKED by how many mandates there are, and how many of them
libc++ wasn't conforming with.

Differential Revision: https://reviews.llvm.org/D99309
2021-04-06 15:31:56 -04:00
Martin Storsjö 740e349762 [libcxx] [ci] Add a Windows CI buildkite configuration
Differential Revision: https://reviews.llvm.org/D99093
2021-04-06 00:09:16 +03:00
Mark de Wever c2c68a5940 [libc++] Improve generate_feature_test_macro_components.py.
This improves the naming of the fields `depends`/`internal_depends`. It
also adds the documentation for this script. The changes are based on
D99290 and its review comments.

Differential Revision: https://reviews.llvm.org/D99615
2021-04-04 20:08:32 +02:00
Martin Storsjö f619783882 [libcxx] [test] Link against msvcprt as C++ ABI library in tests
This matches what we link the library itself against (set in
CMakeLists.txt). When testing a static library version of libc++,
this is needed for essentially every test due to libc++ object files
requiring it.

Also with libc++ built as a DLL, some tests directly call functions that
are provided by msvcprt (such as std::set_new_handler), thus this fixes
a number of tests in that configuration too.

Differential Revision: https://reviews.llvm.org/D99263
2021-04-04 19:18:32 +03:00
Louis Dionne e93c95dea1 [libc++] Print the CMake version before generating CMake 2021-04-01 13:42:22 -04:00
Louis Dionne 232d3a3e47 [libc++] Fix codesigning in run.py
Without this patch, we'd always try to codesign the first argument in
the command line, which in some cases is not something we can codesign
(e.g. `bash` for some .sh.cpp tests).

Note that this "hack" is the same thing we do in `ssh.py` - we might need
to admit that it's not a hack after all in the future, but I'm not ready
for that yet.

Differential Revision: https://reviews.llvm.org/D99726
2021-04-01 13:39:49 -04:00
Marek Kurdej 5c703f0fd8 [libc++] Build and test with -Wundef warning. NFC.
This will avoid typos like `_LIBCPP_STD_VERS` (<future>) or using `#if TEST_STD_VER > 17` without including "test_macros.h".

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D99515
2021-04-01 08:32:56 +02:00
Martin Storsjö 7acfd85756 [libcxx] [test] Don't add dirs from the LIB env var to PATH
The directories in LIB normally only contain import libraries or
static libraries, no runtime DLLs that would need to be found
while running tests.

This code stems from 1cd196e7b4,
which (among other things) tried to do this:

> * [Test] Fix handling of library runtime search paths by correctly adding them
>   to the PATH variable when running the tests.

It's unclear to me exactly what this fixed (or tried to) at the time,
as the LIB var doesn't normally point to runtime libs.

Differential Revision: https://reviews.llvm.org/D99241
2021-03-31 09:05:47 +03:00
Louis Dionne c06a8f9caa [libc++] Include <__config_site> from <__config>
Prior to this patch, we would generate a fancy <__config> header by
concatenating <__config_site> and <__config>. This complexifies the
build system and also increases the difference between what's tested
and what's actually installed.

This patch removes that complexity and instead simply installs <__config_site>
alongside the libc++ headers. <__config_site> is then included by <__config>,
which is much simpler. Doing this also opens the door to having different
<__config_site> headers depending on the target, which was impossible before.

It does change the workflow for testing header-only changes to libc++.
Previously, we would run `lit` against the headers in libcxx/include.
After this patch, we run it against a fake installation root of the
headers (containing a proper <__config_site> header). This makes use
closer to testing what we actually install, which is good, however it
does mean that we have to update that root before testing header changes.
Thus, we now need to run `ninja check-cxx-deps` before running `lit` by
hand.

Differential Revision: https://reviews.llvm.org/D97572
2021-03-30 14:06:11 -07:00
Louis Dionne 180e9e5eab [libc++] Add a CI job to test the Runtimes build
Differential Revision: https://reviews.llvm.org/D97888
2021-03-30 09:00:30 -04:00
Louis Dionne 478d1eded2 [libc++] Re-enable macOS back-deployment testing
Download older roots from Dropbox instead of Green Dragon, which is too
unreliable. Also XFAIL tests that were broken for back-deployment
configurations by D98097.

Differential Revision: https://reviews.llvm.org/D99359
2021-03-29 22:09:23 -04:00
Petr Hosek bc4d3ca7bd [libcxx] Use integer division
In Python 3, math.floor returns int when both arguments are ints.
In Python 2, math.floor returns float. This leads to a failure
because the result of math.floor is used as an array index. While
Python 2 is on its way out, it's still used in some places so use
an integer division instead.

Differential Revision: https://reviews.llvm.org/D99520
2021-03-29 11:59:44 -07:00
Zbigniew Sarbinowski 4d478121f3 [SystemZ][z/OS] exclude nasty_macros.h from check-cxx
Need to exclude nasty_macros.h from check-cxx on z/OS due to conflicts within system headers.

Sample failure in `random_shuffle.depr_in_cxx14.verify.cpp` libcxx test.
```
error: 'error' diagnostics seen but not expected:
Line 1268: expected ')'
Line 1268: unknown type name 'This'
Line 1268: expected ')'
```

caused by the following  macros in `nasty_macros.h`
```
#define NASTY_MACRO This should not be expanded!!!
#define _E NASTY_MACRO
```
The name collision is observed in the following code snippet whre `_E` is being used as parameter name:
```
inline int iswalnum(wint_t _E) {return __iswalnum(_E);}
```

It is reasonable to exclude `nasty_macros.h` on z/OS similarly as it was done on Windows.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D99378
2021-03-26 15:08:37 +00:00
Marek Kurdej 0324b46cd8 [libc++] [C++2b] [P2162] Allow inheritance from std::variant.
This patch changes the variant even in pre-C++2b.
It should not break anything, only allow use cases that didn't work previously.

Notes:
 `__as_variant` is used in `__visitation::__variant::__visit_alt`, but I haven't used it in `__visitation::__variant::__visit_alt_at`.
That's because it is used only in `__visit_value_at`, which in turn is always used on variant specializations (that's in comparison operators).

* https://wg21.link/P2162

Reviewed By: ldionne, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D97394
2021-03-25 18:20:50 +01:00
Arthur O'Dwyer 06e2b737aa [libc++] [P1032] Misc constexpr bits in <iterator>, <string_view>, <tuple>, <utility>.
This completes the implementation of P1032's changes to <iterator>,
<string_view>, <tuple>, and <utility> in C++20.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1032r1.html

Drive-by fix a couple of unintended rvalues in "*iterators*/*.fail.cpp".

Differential Revision: https://reviews.llvm.org/D96385
2021-03-25 10:34:35 -04:00
Martin Storsjö b8b23aa80e [libcxx] [test] Quote env variables that are set with a shell "export" in ssh.py
This safeguards against cases if some of the env vars contain chars
that are problematic for shells, e.g. if called with --env "X=Y;Z".

(In cases of cross testing for windows, the PATH variable can end up
specified with semicolon separators - even if specifying a PATH when
cross testing in such differing environments might not make sense or
do anything - but this makes ssh.py not break on such a variable.)

Differential Revision: https://reviews.llvm.org/D99242
2021-03-25 09:46:44 +02:00
Louis Dionne c504c68fac [libc++] Add a CI configuration with static libc++/libc++abi
Differential Revision: https://reviews.llvm.org/D99268
2021-03-24 16:30:48 -04:00
Arthur O'Dwyer a644920a02 [libc++] Simpler Python script for generating a graph of libc++'s header dependencies
My attempts to play around with the old graph_header_deps.py were mostly fruitless;
I needed to modify it in various ways to make it work, and then even when I got it
working, it generated pretty ugly graphs.

Old graph_header_deps.py (after my local changes to simplify the usage)
(producing https://i.imgur.com/zATrsaP.jpg )

    mkdir foo
    time ./graph_header_deps.py --libcxx-only -o foo --clang-command ~/llvm-project/build/bin/clang++
    dot -Tpng < foo/all_headers.dot > old.png
    file old.png

    real    0m37.453s
    old.png: PNG image data, 25882 x 3035, 8-bit/color RGBA, non-interlaced

New graph_header_deps.py
(producing https://i.imgur.com/ZU0G52U.png )

    time ./graph_header_deps.py | dot -Tpng > new.png
    file new.png

    real    0m1.063s
    new.png: PNG image data, 6162 x 1344, 8-bit/color RGBA, non-interlaced

Differential Revision: https://reviews.llvm.org/D99124
2021-03-23 14:12:05 -04:00
Louis Dionne 2e033b36bf [libc++] NFC: nodebug => no-debug in the CI configurations 2021-03-23 14:10:27 -04:00
Louis Dionne 116b8525c9 [libc++] Run ninja with --verbose
This makes it easier to see what exact build commands are used.

Differential Revision: https://reviews.llvm.org/D98992
2021-03-22 09:17:52 -04:00
Louis Dionne 976eba51d0 [libc++] NFCI: Remove dead code in the Lit configuration
I was trying to fix something else and I stumbled upon several methods
that are not used anymore in target_info.py.

Differential Revision: https://reviews.llvm.org/D98896
2021-03-19 12:01:30 -07:00
David Spickett 3aa6a4cb39 [libcxx][Arm] Move buildbot flags into cmake files
Reviewed By: #libc, Mordante, curdeius

Differential Revision: https://reviews.llvm.org/D98771
2021-03-19 16:45:09 +00:00
Arthur O'Dwyer eb37d3546c [libc++] Future-proof generate_feature_test_macro_components.py against long names.
`__cpp_lib_default_template_type_for_algorithm_values` is 52 characters long,
which is enough to reduce the multiplier to less-than-zero, producing an empty
string between the name of the macro and its numeric value. Ensure there's
always a space between the name of the macro and its value.

Differential Revision: https://reviews.llvm.org/D98869
2021-03-18 13:35:28 -04:00
Louis Dionne 6a9e7b117b [libc++] Remove the Docker files for BuildBot
We don't use them anymore since we're using the BuildKite setup.

Differential Revision: https://reviews.llvm.org/D97779
2021-03-18 10:24:48 -07:00
Christopher Di Bella 580416d573 [libcxx] updates the feature-test macro generator
D97015 didn't correctly update `generate_feature_test_macro_components.py`.

Reviewed By: ldionne, Quuxplusone, #libc, Mordante

Differential Revision: https://reviews.llvm.org/D97904
2021-03-18 17:08:10 +00:00
David Spickett 44e36fc2b1 [libcxx] Move Linaro 32 bit armv bots to buildkite
Instead of setting mcpu like the previous bots,
set the target triple.

Each config builds either Arm only or Thumb only
code. This gives us some coverage of thumb specific
issues.

The new agents on Linaro's side are running on v8 hardware
so will report arch "armv8l" just like the v8 bots.
(and buildkite can choose any of them for v7/v8 jobs)

Reviewed By: #libc, curdeius, Mordante

Differential Revision: https://reviews.llvm.org/D98019
2021-03-12 09:47:07 +00:00
Martin Storsjö 714644a36c [libcxx] [test] Move the is_<platform> functions down to subclasses
If cross testing (and manually specifying a LIBCXX_TARGET_INFO in the
cmake configuration, as the default is to match the build platform),
we want the accessors for querying the target platform, is_windows,
is_darwin, to return the right value depending on which target info
class is used, not based on what platform is running the build and
driving the tests.

When LIBCXX_TARGET_INFO isn't defined, the right target info class
is chosen automatically based on the platform one is running on, so
this shouldn't make any practical difference for such setups.

Differential Revision: https://reviews.llvm.org/D98045
2021-03-06 08:52:34 +02:00
Jessica Clarke 5d6e0e474e [benchmark] Replace references to M680x0 with M68k
The former was the old unusual name of the out-of-tree backend but it
was renamed to M68k during the code review process to conform with how
almost everything refers to the Motorola 68000 family of processors.
Thus, update the comments to avoid confusion when the backend lands.
2021-03-06 01:04:36 +00:00
Martin Storsjö 9e29852f5c [libcxx] [test] Fix detection of clang-cl when cross compiling
When cross compiling, the compiler tool doesn't have a .exe suffix.

Differential Revision: https://reviews.llvm.org/D98026
2021-03-06 00:49:26 +02:00
Martin Storsjö 232fec941d [libcxx] [test] Add an option to ssh.py for using a different temp path
If cross testing on Windows via WSL (at least with WSL 1), the Windows
executables can't be executed if they are in WSL specific directories
(like /tmp).

Differential Revision: https://reviews.llvm.org/D98028
2021-03-05 19:37:31 +02:00
Marek Kurdej 43e4214173 [libc++] [C++2b] [P1682] Add to_underlying.
* https://wg21.link/P1682

Reviewed By: ldionne, Mordante, #libc

Differential Revision: https://reviews.llvm.org/D97365
2021-03-05 10:31:21 +01:00
Louis Dionne c7f244b897 [libc++] Properly pick up the Ninja from Xcode in the CI script 2021-03-04 16:03:39 -05:00
David Spickett 6e5342a6b0 [libcxx] Move Linaro AArch64 buildbots to buildkite
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D96267
2021-03-04 10:22:17 +00:00
Louis Dionne 460953ad9a [libc++] Temporary hack: disable Apple back-deployment testing
Apple back-deployment testing is currently failing because Green Dragon
is down. To avoid stalling the whole CI pipeline because of that, I am
temporarily disabling those jobs until Green Dragon is back, or even
better we have found a different way to store those small artifacts.
2021-03-03 17:02:48 -05:00
Louis Dionne 3c62198c61 [libc++] NFC: Normalize links to bug reports 2021-03-03 13:45:29 -05:00
zoecarver 84a50f5911 [libc++] Add bind_front function (P0356R5).
Implementes [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0356r5.html | P0356R5 ]]. Adds `bind_front` to `functional`.

Reviewed By: ldionne, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D60368
2021-03-02 16:18:06 -08:00
Martin Storsjö 34ee3d91a8 [libcxx] [test] Pass some windows environment variables through to test processes
Normally, the run.py wrapper script runs the child processes in
a clean environment, with only the environment variables available
that are passed via the --env parameter.

However, the COMSPEC and TEMP variables are kind of necessary when
running some tests; COMSPEC is necessary for finding the interpreter
when executing commands via std::system().

Before f1a96de1bc, tests were executed
via an intermediate shell which implicitly readded the COMSPEC variable.

The TEMP variable allows temp files to be placed in a sensible
location; if unset, they're placed in the default temp fallback of
C:\Windows instead.

Differential Revision: https://reviews.llvm.org/D97452
2021-03-02 22:39:14 +02:00
Louis Dionne c5659dd4cc [libc++] Add a utility script to run the Docker image used by builders
Several contributors have been asking me how to reproduce the CI
environment locally. This is the last step towards making that work
out-of-the-box. Basically, just run `libcxx/utils/ci/run-buildbot-container`
and you're good to go.

Differential Revision: https://reviews.llvm.org/D97782
2021-03-02 13:06:14 -05:00
Louis Dionne 60ba1fefab [libc++/abi] Allow running back-deployment testing against libc++abi
Before this patch, we could only link against the back-deployment libc++abi
dylib. This patch allows linking against the just-built libc++abi, but
running against the back-deployment one -- just like we do for libc++.

Also, add XFAIL markup to flag expected errors.

Differential Revision: https://reviews.llvm.org/D91069
2021-03-01 12:13:03 -05:00
Christopher Di Bella e4dd614ae8 [libcxx] cleans up __cpp_concepts mess
libc++ was previously a bit confused by what the value of __cpp_concepts
should be. Also replaces `__floating_point` with `floating_point` now
that it exists.

Differential Revision: https://reviews.llvm.org/D97015
2021-02-26 18:43:40 +00:00
Louis Dionne f8e810c359 [libc++] Allow running CI on macOS when Ninja isn't installed outside of Xcode
Xcode does bundle Ninja, so we can use that Ninja if there's no system-wide
Ninja installed. This is useful on some CI bots we have that don't come
with Ninja pre-installed.
2021-02-26 12:15:12 -05:00
Louis Dionne cb3de09503 [libc++] Remove the now unused macos-trunk and macos-backdeployment CI scripts
We use the run-buildbot script everywhere now.
2021-02-26 10:29:02 -05:00
Martin Storsjö fb2e4f5401 [libcxx] [test] Add a MinGW target
This can't easily be autodetected (unless LIBCXX_TARGET_TRIPLE is
specified, or unless we query what the compiler's default target is,
which only is supported by clang), but can be chosen manually via
LIBCXX_TARGET_INFO.

This chooses mingw style lib naming, and uses -nostdlibc++ instead
of -nodefaultlib -nostdlib (as the latter requires specifying a lot of
details manually - this is done in the cmake config though).

Differential Revision: https://reviews.llvm.org/D97294
2021-02-26 00:10:48 +02:00
Martin Storsjö 72fe14d40a [libcxx] [cmake] Add asm to the runtimes build languages
This fixes building libunwind with a new enough version of cmake.

(libunwind treats its asm sources as C depending on the cmake version
on some platforms; this fixes builds when such workarounds aren't used,
when cmake treats asm correctly on its own.)

Differential Revision: https://reviews.llvm.org/D97399
2021-02-26 00:10:48 +02:00
Martin Storsjö 90232b2ecd [libcxx] [test] Don't pass INCLUDE to clang via -isystem
Passing the MSVC include dirs via -isystem makes them included before
clang's own include resource dir (<prefix>/lib/clang/<version>/include).
This causes includes of stddef.h to bypass clang's stddef.h which
defines max_align_t, which libc++ needs defined.

This was added in 4372f06d0f when the
initial windows testing support was added, and has been brought along
since. It's unclear if this was needed back then - now it no longer is
needed at least, and since libc++ started depending on max_align_t, this
became an issue.

Differential Revision: https://reviews.llvm.org/D97167
2021-02-24 11:16:49 +02:00
Martin Storsjö f97ea0d5b3 [libcxx] [test] Define _CRT_STDIO_ISO_WIDE_SPECIFIERS while building tests
This matches how libc++ itself is built. This avoids errors due to
mismatch if linking libc++ statically.

Differential Revision: https://reviews.llvm.org/D97169
2021-02-23 15:57:30 +02:00
Marek Kurdej bcb5a124ae [libc++] Turn off clang-format for auto-generated version header. NFC. 2021-02-19 17:26:16 +01:00
Louis Dionne 5d0d465ad4 [libc++] Mark __cpp_lib_constexpr_memory as being implemented 2021-02-15 15:26:53 -05:00
Louis Dionne 73aa09704a [libc++] Add a wait step in the BuildKite pipeline to shield macOS builders
We don't have many of those and they are rather slow, so we'd rather not run
those jobs if we know other jobs in the pipeline failed anyway.
2021-02-08 10:14:16 -05:00
Sterling Augustine a34b8b879e Various minor fixes for python 3
Switch StdTuple printer from python 2-style "next" to python 3.

Nested iteration changed enough to make the original bitset iteration
code a bit trickier than it needs to be, so unnest.

The end node of a map iterator is sometimes hard to detect in isolation,
don't fail in that case.

Differential Revision: https://reviews.llvm.org/D96167
2021-02-05 13:01:34 -08:00
Marek Kurdej 1361c5e7d7 [libc++] Add format check to CI
Note: contrary to what I said previously, I didn't change .clang-format nor utils/generate_feature_test_macro_components.py script.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D92229
2021-02-04 21:15:37 +01:00
Louis Dionne 76fc35752d [libc++] Make feature-test macros consistent with availability macros
Before this patch, feature-test macros didn't take special availability
markup into account, which means that feature-test macros can sometimes
appear to "lie". For example, if you compile in C++20 mode and target
macOS 10.13, the __cpp_lib_filesystem feature-test macro will be provided
even though the <filesystem> declarations are marked as unavailable.
This patch fixes that.

rdar://68142369

Differential Revision: https://reviews.llvm.org/D94983
2021-02-04 11:40:22 -05:00
Arthur O'Dwyer 493f140792 [libc++] [P0879] constexpr std::sort
This completes libc++'s implementation of
P0879 "Constexpr for swap and swap related functions."
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0879r0.html

For the feature-macro adjustment, see
https://cplusplus.github.io/LWG/issue3256

Differential Revision: https://reviews.llvm.org/D93661
2021-02-03 18:57:05 -05:00
Louis Dionne 3fb8385379 [libc++] Add new queues for specific macOS system versions
This will allow running back-deployment testing on macOS only on systems
running the right version of macOS. For the time being, we're cheating
because we don't have actual machines running older than 10.15.
2021-02-02 15:56:44 -05:00
Mark de Wever 081c1db02d [libc++] Implement format_error.
This is the first step at implementing <format>. It adds the <format> header
and implements the `format_error`. class.

Implemnts parts of:
-P0645 Text Formatting

Reviewed By: ldionne, #libc, miscco, curdeius

Differential Revision: https://reviews.llvm.org/D92214
2021-01-28 18:02:53 +01:00
Louis Dionne 4210b87020 [libc++] Fix oss-fuzz build 2021-01-26 15:30:50 -05:00
Arthur O'Dwyer 3fbd3eaf28 [libc++] Implement [P0769] "Add shift to algorithm" (shift_left, shift_right)
I believe this is a complete implementation of std::shift_left and std::shift_right from
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0769r2.pdf

Some test cases copied-with-modification from D60027.

Differential Revision: https://reviews.llvm.org/D93819
2021-01-25 12:57:04 -05:00
Alex Richardson 537d90db82 [libc++] Split re.alg tests into locale-dependent and independent tests
Currently all these tests are XFAILED on Linux even though the problem
only seems to be with the few checks that look at collation. To retain
test coverage this splits the locale-dependent tests into a separate
.pass.cpp that is XFAILed as before.
This commit also XFAILs the locale-dependent tests on FreeBSD since the
[=M=] and [.ch.] behaviour for cs_CZ also doesn't seem to match the
behaviour that is expected by these tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D94969
2021-01-20 15:48:50 +00:00
Wim Leflere 6ac9cb2a7c [libc++][P1679] add string contains
C++23 string contains implementation and tests

Paper: https://wg21.link/P1679R3
Standard (string): https://eel.is/c++draft/string.contains
Standard (string_view): https://eel.is/c++draft/string.view.ops#lib:contains,basic_string_view

Differential Revision: https://reviews.llvm.org/D93912
2021-01-19 14:35:07 -05:00
Louis Dionne 933518fff8 [libc++] Make LIBCXX_ENABLE_FILESYSTEM fully consistent
Previously, LIBCXX_ENABLE_FILESYSTEM controlled only whether the filesystem
support was compiled into libc++'s library. This commit promotes the
setting to a first-class option like LIBCXX_ENABLE_LOCALIZATION, where
the whole library is aware of the setting and features that depend on
<filesystem> won't be provided at all. The test suite is also properly
annotated such that tests that depend on <filesystem> are disabled when
the library doesn't support it.

This is an alternative to https://llvm.org/D94824, but also an improvement
along the lines of LIBCXX_ENABLE_LOCALIZATION that I had been wanting to
make for a while.

Differential Revision: https://reviews.llvm.org/D94921
2021-01-19 14:15:48 -05:00
Raul Tambre 480643a95c [CMake] Remove dead code setting policies to NEW
cmake_minimum_required(VERSION) calls cmake_policy(VERSION),
which sets all policies up to VERSION to NEW.
LLVM started requiring CMake 3.13 last year, so we can remove
a bunch of code setting policies prior to 3.13 to NEW as it
no longer has any effect.

Reviewed By: phosek, #libunwind, #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D94374
2021-01-19 17:19:36 +02:00
Wim Leflere 2776be43f0 [libc++] improve feature test macro script
I've been playing a bit with the `generate_feature_test_macro_components.py` script and replaced some hardcoded values with extra code generation (generate ALL the things).
The output is the same and it makes updating the script less work for the coming 25 C++ standards (until 2 digit number overflow).

Feel free to 'veto' if you think it's overkill.

Differential Revision: https://reviews.llvm.org/D94530
2021-01-18 15:19:21 -05:00
Marek Kurdej 1f1250151f [libc++] [C++2b] [P1048] Add is_scoped_enum and is_scoped_enum_v.
* https://wg21.link/p1048

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D94409
2021-01-12 17:08:20 +01:00
Marek Kurdej 30a7d430e8 [libc++] Turn off auto-formatting of generated files. NFC.
This adds `// clang-format off` in the auto-generated file to avoid lint warnings.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D94410
2021-01-11 20:49:26 +01:00
Arthur O'Dwyer ca1694b9d0 Re-enable __cpp_lib_constexpr_functional.
I accidentally disabled this feature-test macro in my D93830,
due to a rebasing conflict. It had been enabled by my D93815,
and should have remained enabled.
2021-01-08 17:30:04 -05:00
Marek Kurdej 95729f95d8 [libc++] Add basic support for -std=c++2b.
* Add feature test macros.
* Add buildbot configuration generic-cxx2b that uses clang-tot.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D94227
2021-01-08 19:02:41 +01:00
Arthur O'Dwyer 466df1718e [libc++] Update generate_feature_test_macro_components.py to match SD-6.
It's still a little confusing because in many cases C++17 and C++20
have different values, and libc++ implements the C++17 behavior but
not the C++20 behavior; 'unimplemented' can't represent that scenario.
Ultimately we probably ought to completely redesign the script to be
in terms of paper numbers, rather than language revisions, and make
it generate the CSV files like "Cxx2aStatusPaperStatus.csv" as well.

Most newly added macros are unimplemented. I've marked a few as implemented,
though, based on my reading of the code; for example I was pretty sure
`__cpp_lib_latch` is implemented since we have `<latch>`.

Differential Revision: https://reviews.llvm.org/D93830
2021-01-08 11:44:39 -05:00
Arthur O'Dwyer ff1b6f9ff2 [libc++] Alphabetize generate_feature_test_macro_components.py. NFCI.
For ease of comparing our list with the official SD-6 list, which is alphabetized.
https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#library-feature-test-macros
This also alphabetizes the lists of headers in which the macros are
defined, which harmlessly alters many comments in <version>.
Also drive-by-fix some trivial flake8 warnings.
2021-01-07 18:11:46 -05:00
Louis Dionne c01202a7ef [libc++] Fix typo in run-buildbot
The installation directory was never meant to contain a brace.
2021-01-07 17:37:09 -05:00
Marek Kurdej 044b892c79 [libc++] Use c++20 instead of c++2a consistently.
* The only exception is that the flag -std=c++2a is still used not to break compatibility with older compilers (clang <= 9, gcc <= 9).
* Bump _LIBCPP_STD_VER for C++20 to 20 and use 21 for the future standard (C++2b).

That's a preparation step to add c++2b support to libc++.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D93383
2021-01-07 13:11:33 +01:00
Marek Kurdej b6fb0209b6 [libc++] [CI] Install Tip-of-Trunk clang.
* Check created symlinks.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D93520
2021-01-07 12:04:09 +01:00
Arthur O'Dwyer 7b00e9fae3 [libc++] [P1065] Constexpr invoke, reference_wrapper, mem_fn, not_fn, default_searcher.
This completes the implementation of P1065 "constexpr INVOKE":
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1065r2.html

This doesn't yet complete the implementation of P1032 "Misc constexpr bits,"
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1032r1.html
but it does complete all of the <functional> bits, which means
that we can now set `__cpp_lib_constexpr_functional` for C++20.

This could use more constexpr tests for `std::reference_wrapper<T>`,
but the existing tests are extremely non-constexpr-friendly and
so I don't want to get into that rabbit-hole today.

Differential Revision: https://reviews.llvm.org/D93815
2020-12-28 13:24:07 -05:00
Alex Richardson 0f81598cc1 [libc++] Add a 'is-lockfree-runtime-function' lit feature
On macOS 10.14 /usr/lib/system/libcompiler_rt.dylib contains all the
`__atomic_load*`, etc. functions but does not include the `__atomic_is_lock_free`
function. The lack of this function causes the non-lockfree-atomics feature
to be set to false even though large atomic operations are actually
supported, it's just the is_lock_free() function that is missing.

This is required so that the !non-lockfree-atomics feature can be used
to XFAIL tests that require runtime library support (D88818).

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D91911
2020-12-22 11:56:20 +00:00
Louis Dionne 46ae360452 [libc++] Fix CI Dockerfile
Installing clang-format-11 doesn't seem to work if it's done before
we've installed LLVM. I must admit I didn't try to get to the bottom
of the issue, since installing it after seems to work.
2020-12-16 17:01:21 -05:00
Marek Kurdej d69fc6629d [libc++] Install git-clang-format on CI nodes.
Two problems fixed:
* an old version of clang-format get installed by default (6.0).
* git-clang-format is not present, only git-clang-format-<version> (e.g. git-clang-format-6.0).

Solution:
* install clang-format-11 with explicit version
* make symlink git-clang-format to the latest version of git-clang-format-<version>

Differential Revision: https://reviews.llvm.org/D93201
2020-12-16 16:36:34 -05:00
Arthur O'Dwyer 2664f5d436 generate_header_tests.py: Sort the header files ASCIIbetically.
Otherwise they come out in random (inode?) order.

Also `chmod +x` the generator, and re-run it. Somehow on Marek's
machine it produced \r\n line endings?! Open all files with
`newline='\n'` so that (if the Python3 docs are correct)
that won't happen again.

Differential Revision: https://reviews.llvm.org/D93137
2020-12-14 09:56:07 -05:00
Louis Dionne d02eac0c00 [libc++] Fix Docker image build after installing clang-format 2020-12-11 14:13:13 -05:00
Louis Dionne 202df6870e [libc++] Install clang-format on CI nodes 2020-12-11 14:06:42 -05:00
Marek Kurdej 6fd5a94eeb [libc++] Add a script to automatize updating test for a new header.
Idea from D92525.
This script globs include/ directory and updates the tests in test/libcxx.
This patch does not generate module.modulemap nor CMakeLists.txt.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D92656
2020-12-10 08:37:50 +01:00
Louis Dionne 717b0da7a6 [libc++] Run back-deployment CI on macOS 10.15 instead of 10.14
The goal was to add coverage for back-deployment over the filesystem
library, but it was added in macOS 10.15, not 10.14.

Differential Revision: https://reviews.llvm.org/D92937
2020-12-09 11:35:15 -05:00
Louis Dionne a65dc08d10 [libc++] Implement missing feature-test macro __cpp_lib_shared_ptr_arrays
This was forgotten when we implemented support for arrays in std::shared_ptr
in https://reviews.llvm.org/D62259.
2020-12-08 15:46:45 -05:00
Louis Dionne 3e46b3a188 [libc++] NFC: Indent feature-test macro script consistently 2020-12-08 15:42:57 -05:00
Louis Dionne 8726f94cc7 [libc++] Add a CI job to backdeploy to macOS 10.14
It adds coverage for back-deploying to a system that contains the
filesystem library, which 10.9 (currently our only back-deployment
target in the CI) does not have.

Differential Revision: https://reviews.llvm.org/D92794
2020-12-08 11:07:56 -05:00
Louis Dionne 4277adda1d [libc++] Install missing packages to cross-compile to 32 bits during CI 2020-12-02 16:45:53 -05:00
Marek Kurdej a984dcaf7c [libc++] [P0482] [C++20] Implement missing bits for codecvt and codecvt_byname.
Add codecvt*<char16_t, char8_t> and codecvt*<char32_t, char8_t>.
Deprecate codecvt<char(16|32)_t, char>.
Enable disabled tests.
Update _LIBCPP_STD_VER to use 20 for C++20. Add _LIBCPP_DEPRECATED_IN_CXX20 macro.

Reviewed By: ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D91517
2020-12-02 09:01:58 +01:00
Mark de Wever 67c88e47bd [libc++] P1645 constexpr for <numeric>
Implements P1645: constexpr for <numeric> algorithms

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D90569
2020-11-28 17:02:54 +01:00
Louis Dionne da1b50d7df [libc++] Formalize what configurations are covered by the ABI lists
By encoding ABI-affecting properties in the name of the ABI list, it
makes it clear when an ABI list test should or should not be available,
and what results we should expect.

Note that we clearly don't encode all ABI-affecting parameters in the
name right now -- I just ported over what we supported in the code that
was there previously. As we encounter configurations that we wish to
support but produce different ABI lists, we can add those to the ABI
identifier and start supporting them.

This commit also starts checking the ABI list in the CI jobs that run
a supported configuration. Eventually, all configurations should have
a generated ABI list and the test should even run implicitly as part of
the Lit test suite.

Differential Revision: https://reviews.llvm.org/D92194
2020-11-27 10:01:07 -05:00
Louis Dionne 76667c768e [libc++] Install missing package in the Dockerfile
python3-distutils is required to use `import distutils.spawn`, which is
required by the ABI list targets.
2020-11-26 15:14:48 -05:00
Louis Dionne e9f7dc4f1c [libc++] Fix the Homebrew tap to install Buildkite on macOS hosts 2020-11-26 14:40:53 -05:00
Louis Dionne d7ca140c01 [libc++] Attempt to fix spurious modules-related failures in the CI
I'm not 100% sure what the issue actually is since I can't reproduce it
locally, however what I explain in the comment is my best attempt to
explain what's going on.

Differential Revision: https://reviews.llvm.org/D92131
2020-11-26 12:00:11 -05:00
Louis Dionne e5cc7baf67 [libc++] NFC: Reindent non-lockfree-atomics feature 2020-11-25 16:14:34 -05:00
Mark de Wever ecabb39ca1 Revert "[libc++] P1645 constexpr for <numeric>"
This reverts commit eb9b063539.

The commit fails to build on build bots using LLVM 8.
2020-11-25 13:46:08 +01:00
Mark de Wever eb9b063539 [libc++] P1645 constexpr for <numeric>
Implements P1645: constexpr for <numeric> algorithms

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D90569
2020-11-25 13:19:32 +01:00
Mark de Wever 1a036e9cc8 [libcxx] Implement P1956 rename low-level bit functions
Implements P1956: On the names of low-level bit manipulation functions.

Users may use older versions of libc++ or other standard libraries with the old names. In order to keep compatibility the old functions are kept, but marked as deprecated.

The patch also adds a new config macro `_LIBCPP_DEPRECATED_MSG`. Do you prefer a this is a separate patch?

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D90551
2020-11-24 17:37:06 +01:00
Louis Dionne 7ad8e19958 [libc++] Move the GDB pretty printer tests to the DSL
Also, enable them whenever we detect that gdb is available. Previously,
these tests would basically never run because they relied on a CMake
configuration option that defaulted to OFF.

Differential Revision: https://reviews.llvm.org/D91434
2020-11-16 16:16:39 -05:00
Louis Dionne e56eea26ca [libc++] Install GDB in the Docker images
This will allow running the GDB pretty printer tests.
2020-11-13 11:57:54 -05:00
Ruslan Arutyunyan e5ec94a1a0 [libc++] Implement P0919R3: heterogenous lookup for unordered containers
Implement heterogenous lookup for unordered containers, including the
refinement from P1690R1.

Differential Revision: https://reviews.llvm.org/D87171
2020-11-11 17:44:42 -05:00
Louis Dionne c1887e3f15 Revert "Allow running back-deployment testing against libc++abi"
This reverts commit 4d79ef814a, which broke a few build bots.
I'm reverting until I have time to investigate.
2020-11-06 17:26:42 -05:00
Louis Dionne 1d53b55e18 [libc++] Try fixing the oss-fuzz build
See https://github.com/google/oss-fuzz/issues/4586.
2020-11-06 10:06:44 -05:00
Louis Dionne 4d79ef814a Allow running back-deployment testing against libc++abi
Summary:
Before this patch, we could only link against the back-deployment libc++abi
dylib. This patch allows linking against the just-built libc++abi, but
running against the back-deployment one -- just like we do for libc++.

Also, add XFAIL markup to flag expected errors.
2020-11-06 08:12:46 -05:00
Louis Dionne 75b6726b57 [libc++] Also allow customizing the build directory when running CI 2020-11-05 19:10:08 -05:00
Louis Dionne 3790e17f46 [libc++] Allow customizing a few paths when running build bots
This allows reusing run-buildbot for downstream testing as well.
2020-11-05 19:02:32 -05:00
Louis Dionne bb43a0cd4a [libc++] Add a Buildkite job that tests back-deployment on Apple
The current way we test this is pretty cheap, i.e. we download previously
released macOS dylibs and run against that. Ideally, we would require a
full host running the appropriate version of macOS, and we'd execute the
tests using SSH on that host. But since we don't have such hosts available
easily for now, this is better than nothing.

At the same time, also fix some tests that were failing when back
deploying.

Differential Revision: https://reviews.llvm.org/D90869
2020-11-05 18:26:08 -05:00
Louis Dionne f7e4f041d6 [libc++] Add a CI job to build the documentation
At the same time, fix an issue that broke the documentation since 2eadbc8614.
2020-11-05 15:33:09 -05:00
Louis Dionne 738d981eb6 [libc++] Update the CI Dockerfile
Remove Phabricator, which isn't needed anymore since we don't report
the job results ourselves. Also, install python3-sphinx instead of
sphinx-doc, since the latter doesn't provide the sphinx-build binary.
2020-11-05 15:33:09 -05:00
Louis Dionne 2eadbc8614 [libc++] Rework the whole availability markup implementation
Currently, vendor-specific availability markup is enabled by default.
This means that even when building against trunk libc++, the headers
will by default prevent you from using some features that were not
released in the dylib on your target platform. This is a source of
frustration since people building libc++ from sources are usually not
trying to use some vendor's released dylib.

For that reason, I've been thinking for a long time that availability
annotations should be off by default, which is the primary change that
this commit enables.

In addition, it reworks the implementation to make it easier for new
vendors to add availability annotations for their platform, and it
refreshes the documentation to reflect the current state of the codebase.

Finally, a CMake configuration option is added to control whether
availability annotations should be turned on for the flavor of libc++
being created. The intent is for vendors like Apple to turn it on, and
for the upstream libc++ to leave it off (the default).

Differential Revision: https://reviews.llvm.org/D90843
2020-11-05 12:28:52 -05:00
Louis Dionne 8e01749bb1 [libc++] Remove stray setting of use_system_cxx_lib left behind 2020-11-04 15:01:59 -05:00
Louis Dionne 70eb30cc81 [libc++] Move availability-related Lit configuration to the DSL
The implementation is not really satisfactory, but it's better than
being in the legacy config, which causes other issues.
2020-11-04 14:56:08 -05:00
Steven Wan 09f2c92e5b Add info about the cherry-picked commit and contributor 2020-11-04 14:23:27 -05:00
Steven Wan 296c2f31f0 [PowerPC] Rename mftbl to mftb
`mftb` and `mftbl` are equivalent, there is no need to have two names for doing the same thing, rename `mftbl` to only have `mftb`.

Differential Revision: https://reviews.llvm.org/D89506
2020-11-04 14:23:27 -05:00
Louis Dionne f1a96de1bc [libc++] Don't run tests in a shell in the default executor 2020-11-04 08:29:05 -05:00
Louis Dionne 5369d8cca7 [libc++] Remove support for .run.fail.cpp tests
Unfortunately, executing these tests correctly on platforms that do not
support a shell is very challenging. Since the executor can't just negate
the result of the command, we'd have to ship a portable program capable
of running the actual test executable, and negating its result.

Doing this portably is challenging. Since we do not currently have strong
use cases for tests that fail at runtime (we effectively have no tests
using that capability right now), it is difficult to justify making them
work portably. Instead, it makes more sense to remove this feature until
we can implement it properly (i.e. without requiring shell support).
2020-11-03 15:40:24 -05:00
Louis Dionne d1217be43f [libc++] NFC: Simplify how we run config tests
We can use the convenience substitutions provided by the format instead
of bootstrapping our own.
2020-11-03 14:59:41 -05:00
Louis Dionne d6e2bac195 [libc++] Migrate warning flags to the DSL
This makes us closer to running the test suite on platforms where the
legacy test suite configuration doesn't work.

One notable change after this commit is that the tests will be run with
warnings enabled on GCC too, which wasn't the case before. However,
previous commits should have tweaked the test suite to make sure it
passes with warnings enabled on GCC.

Note that warnings can still be disabled with `--param enable_warnings=False`,
as before.

Differential Revision: https://reviews.llvm.org/D90432
2020-11-02 12:25:05 -05:00
Louis Dionne 6b2de7c53a [libc++][CI] Allow retries in case an agent is lost
We see this fairly often on our Linux bots, which appear to be killed
by GCE from time to time.
2020-11-02 11:58:45 -05:00
Louis Dionne b128373eb8 [libc++] Make it easier to re-generate the ABI lists
Instead of having to remember the command-line to use every time, this
commit adds a CMake target to generate the ABI list in the current
configuration, if it is supported.

As a fly-by change, remove scripts that are now unused (sym_match.py
and sym_extract.py).
2020-11-02 11:36:35 -05:00
Louis Dionne 1b2fa6e46e [libc++/libc++abi] Use Python3_EXECUTABLE consistently to run utilities 2020-11-02 11:07:31 -05:00
Louis Dionne 4dfe014a12 [libc++] Add -Wno-sized-deallocation to avoid spurious GCC warnings
GCC tries to be nice and tell us that we probably want to also implement
sized deallocation functions when we override the normal ones. However,
we know what we're doing in the test suite and don't want to override
them.
2020-10-30 12:51:07 -04:00
Louis Dionne d085697013 [libc++] Add a new concept of ConfigAction, and use it in the DSL
This will allow adding bare compiler flags through the new
configuration DSL. Previously, this would have required adding
a Lit feature for each such flag.

Differential Revision: https://reviews.llvm.org/D90429
2020-10-30 09:27:15 -04:00
Daniel Kiss fd1c064845 [libcxx] Add targets to available features.
This patch add the target-* (x86_64-*) as used elsewhere in llvm.

Reviewed By: #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D88027
2020-10-29 14:04:11 +01:00
Louis Dionne c56bbb3961 [libc++] Make sure we include a header when checking compiler macros
Otherwise, it's possible for some __config_site macros not to be
picked up.
2020-10-27 15:58:43 -04:00
Louis Dionne 88ffc72717 [libc++] Add a libc++ configuration that does not support localization
When porting libc++ to embedded systems, it can be useful to drop support
for localization, which these systems don't implement or care about.

Differential Revision: https://reviews.llvm.org/D90072
2020-10-27 14:56:30 -04:00
Louis Dionne 87d3a5365e [libc++] Remove references to CONDUIT_TOKEN
It's not required anymore, since we rely on another job to report
the results back to Phabricator.
2020-10-27 12:26:44 -04:00
Louis Dionne 8cd7786e48 [libc++] NFC: Consistent indentation for buildkite-pipeline.yml 2020-10-26 14:54:13 -04:00
Louis Dionne b888463f8d [libc++abi] Make sure we can run the tests in Standalone mode
The tests would previously fail if the `python` executable wasn't found,
because we were missing the mandatory find_package.
2020-10-26 14:26:44 -04:00
Louis Dionne 88374f76ee [libc++] Fix indentation of buildkite-pipeline.yml 2020-10-26 12:58:37 -04:00
Louis Dionne d3024a074b [libc++] Add a CI jobs to test the Standalone builds 2020-10-26 12:13:19 -04:00
Louis Dionne cb9f6c4c8c [libc++] Clean up unused CI files
Those were useful during CI experimentation, but are not used anymore.
2020-10-23 15:21:04 -04:00
Louis Dionne 2f8dd2687f [libc++] Refactor the run-buildbot script to make it more modular, and run the benchmarks
As a fly-by fix, unbreak the benchmarks on Apple platforms.

Differential Revision: https://reviews.llvm.org/D90043
2020-10-23 15:11:41 -04:00
Louis Dionne 48e4b0fd3a [runtimes] Revert the libc++ __config_site change
This is a massive revert of the following commits (from most revent to oldest):

	2b9b7b5775.
	529ac33197
	28270234f1
	69c2087283
	b5aa67446e
	5d796645d6

After checking-in the __config_site change, a lot of things started breaking
due to widespread reliance on various aspects of libc++'s build, notably the
fact that we can include the headers from the source tree, but also reliance
on various "internal" CMake variables used by the runtimes build and compiler-rt.

These were unintended consequences of the change, and after two days, we
still haven't restored all the bots to being green. Instead, now that I
understand what specific areas this will blow up in, I should be able to
chop up the patch into smaller ones that are easier to digest.

See https://reviews.llvm.org/D89041 for more details on this adventure.
2020-10-23 09:41:48 -04:00
Louis Dionne d098bb39aa [libc++] Allow running the tests in the experimental runtimes-only build 2020-10-22 17:04:22 -04:00
Mikhail Goncharov 40f360c2e9 [libc++] Update continous integration scripts
Now libc++ pipeline will be triggered from the "premerge-checks" and the
combined result are going to be returned to Harbormaster.

Reviewed-by: ldionne

Differential Revision: https://reviews.llvm.org/D89113
2020-10-22 10:49:40 +02:00
Louis Dionne 1913bb622c [libc++][ci] Also install the library in the CI scripts
It's good to run the installation step to make sure it works properly,
as build system changes can break that.
2020-10-21 17:34:58 -04:00
Louis Dionne 5d796645d6 [take 2] [libc++] Include <__config_site> from <__config>
Prior to this patch, we would generate a fancy <__config> header by
concatenating <__config_site> and <__config>. This complexifies the
build system and also increases the difference between what's tested
and what's actually installed.

This patch removes that complexity and instead simply installs <__config_site>
alongside the libc++ headers. <__config_site> is then included by <__config>,
which is much simpler. Doing this also opens the door to having different
<__config_site> headers depending on the target, which was impossible before.

It does change the workflow for testing header-only changes to libc++.
Previously, we would run `lit` against the headers in libcxx/include.
After this patch, we run it against a fake installation root of the
headers (containing a proper <__config_site> header). This makes use
closer to testing what we actually install, which is good, however it
does mean that we have to update that root before testing header changes.
Thus, we now need to run `ninja check-cxx-deps` before running `lit` by
hand.

This commit was originally applied in 1e46d1aa3 and reverted in eb60c487
because it broke the libc++abi and libunwind test suites. This has now
been fixed.

Differential Revision: https://reviews.llvm.org/D89041
2020-10-21 10:40:33 -04:00
Louis Dionne eb60c48744 [libc++] Revert "Include <__config_site> from <__config>"
This temporarily reverts commit 1e46d1aa until I find a solution to fix
the libc++abi and libunwind test suites with that change.
2020-10-21 09:18:29 -04:00
Louis Dionne 1e46d1aa3f [libc++] Include <__config_site> from <__config>
Prior to this patch, we would generate a fancy <__config> header by
concatenating <__config_site> and <__config>. This complexifies the
build system and also increases the difference between what's tested
and what's actually installed.

This patch removes that complexity and instead simply installs <__config_site>
alongside the libc++ headers. <__config_site> is then included by <__config>,
which is much simpler. Doing this also opens the door to having different
<__config_site> headers depending on the target, which was impossible before.

It does change the workflow for testing header-only changes to libc++.
Previously, we would run `lit` against the headers in libcxx/include.
After this patch, we run it against a fake installation root of the
headers (containing a proper <__config_site> header). This makes use
closer to testing what we actually install, which is good, however it
does mean that we have to update that root before testing header changes.
Thus, we now need to run `ninja check-cxx-deps` before running `lit` by
hand.

Differential Revision: https://reviews.llvm.org/D89041
2020-10-21 08:46:57 -04:00
Louis Dionne c2279b262f [libc++] Make it easier to add new restrictions for feature-test macro tests 2020-10-20 15:52:57 -04:00
Martin Storsjö b30e42922a [libcxx] [test] Avoid conflicting definitions of _CRT_SECURE_NO_WARNINGS
This is defined both by libcxx/utils/libcxx/test/config.py (for
any windows target) and msvc_stdlib_force_include.h (when testing
specifically the MSVC C++ library).

The command line define (-D_CRT_SECURE_NO_WARNINGS) defines it to the
value 1; change the header define to match that.

Keeping both instances, to keep the fix for cases when not building
in cases that don't use config.py.

Also remove a comment about whether this can be removed; it can't at
least be removed altogether - doing that breaks a number of tests that
otherwise succeed.

Differential Revision: https://reviews.llvm.org/D89588
2020-10-20 19:44:21 +03:00
Martin Storsjö 5c39eebc12 [libcxx] [test] Fix filesystem_test_helper.h to compile for windows
Use .string() instead of .native() in places where we want to combine
paths with std::string.

Convert some methods to take a fs::path as parameter instead of
std::string, for cases where they are called with paths as
parameters (which can't be implicitly converted to std::string if
the path's string_type is wstring).

Differential Revision: https://reviews.llvm.org/D89530
2020-10-20 00:07:02 +03:00
Louis Dionne b4bd194378 [libc++] Refactor the fuzzing tests
Define all the fuzzing tests in libcxx/test/libcxx/fuzzing, and get
rid of the ad-hoc libcxx/fuzzing directory, which wasn't properly
integrated with the build system or test suite.

As a fly-by change, this also reduces the dependencies of fuzzing tests
on large library components like <iostream>, to make them work on more
platforms.
2020-10-19 12:11:50 -04:00
Alex Richardson 7928d40c6b [libc++][dsl] Run checks for locale names aliases using a single %exec
This changes the checking for available locales to use one program that
iterates over argv to test multiple locale names instead of checking each
name with a separate executable.

This massively speeds up running individual tests using an SSH executor
(it can take up to 10 seconds to compile and run a single test in some
emulated environments) in case no locales are installed since then all
fallback names are tested idividually. But even on a native machine
this reduces the libc++ lit startup time by ~1-2 second for me on a machine
that does not have locale data installed.

Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D88884
2020-10-18 18:17:50 +01:00
Louis Dionne 2408fc2a1e [libc++] Avoid relying on `realpath` being installed on the system
It doesn't appear to be a standard utility.
2020-10-16 13:07:18 -04:00
Louis Dionne 880fc4d581 [libc++] Move the oss-fuzz script to libcxx/utils/ci 2020-10-16 12:40:43 -04:00
Louis Dionne e0d01294bc [libc++] Allow building libc++ on platforms without a random device
Some platforms, like several embedded platforms, do not provide a source
of randomness through a random device. This commit makes it possible to
build and test libc++ for such platforms, i.e. without std::random_device.

Surprisingly, the only functionality that doesn't work on such platforms
is std::random_device itself -- everything else in <random> still works,
one just has to find alternative ways to seed the PRNGs.
2020-10-15 12:20:29 -04:00
Louis Dionne ab55897817 [libc++] Allow passing relative paths to the Apple install script 2020-10-13 12:27:47 -04:00
Louis Dionne 647fb6b374 [libc++] Update the <version> header in-place from generate_feature_test_macro_components
This simplifies the workflow for adding new feature-test macros for
contributors. Previously, they would have to move the generated <version>
header from a temporary directory to libc++'s include directory by hand.
This makes the behavior for the <version> header consistent with what's
done for the tests and the documentation.
2020-10-13 09:18:35 -04:00
Louis Dionne ddb2baf9fb [libc++] Make sure we don't cache DSL functions too aggressively
To make sure we don't store a mutable object (which could be modified by
outside code without us noticing) as the cache key, we pickle the cache
key to get a byte stream. If two keys are unequal, we know for sure they
will not have the same pickling. And if they are equal, there's a large
chance they will have the same pickling. If they don't, we might end up
not reusing a cached entry when we could have, but at least the behavior
we'll have is semantically correct.
2020-10-09 10:22:46 -04:00
Louis Dionne 5390c5a96e [libc++] Add caching for feature-detection Lit tests
This significantly speeds up the configuration of libc++'s test suite
by making sure that we don't perform the same operations over and over
again.

Differential Revision: https://reviews.llvm.org/D89003
2020-10-08 21:08:53 -04:00
Min-Yih Hsu bd5fe7b010 [M680x0] Add google/benchmark's CycleTimer support for M68K
This is a cherrypick of the upstream fix commit ffe1342 onto
`llvm/utils/benchmark` and `libcxx/utils/google-benchmark`.
This adds CycleTimer implementation for M680x0, which simply
uses `gettimeofday` same as MIPS.

Differential Review: https://reviews.llvm.org/D88868
2020-10-07 14:58:36 -07:00
Louis Dionne 62d4ee5b7a [libc++] Use the existing CMake caches when running build bots 2020-10-07 09:30:11 -04:00
Louis Dionne ce1365f8f7 [libc++] Add a CMake option to control whether the debug mode is supported
Some libc++ builds may want to disable support for the debug mode,
for example to reduce code size or because the current implementation
of the debug mode requires a global map. This commit adds the
LIBCXX_ENABLE_DEBUG_MODE CMake option and ties it into the test
suite.

It also adds a CI job to test this configuration going forward.

Differential Revision: https://reviews.llvm.org/D88923
2020-10-07 09:20:59 -04:00
Louis Dionne 370b7887e5 [libc++] Add a script to setup CI on macOS nodes 2020-10-06 15:34:09 -04:00
Alex Richardson 04f908b9f0 [libcxx][lit] Add support for custom ssh/scp flags in ssh.py
In our CHERI Jenkins CI we need to pass `-F <custom_config_file>` to each
ssh/scp command to set various arguments such as the localhost port, usage
of controlmaster, etc. to speed up connections to our emulated QEMU systems.

For our specific use-case I could have also added a single --ssh-config-file
argument that can be used for both the scp and ssh commands, but being able
to pass arbitrary extra flags for both commands seems more flexible.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D84097
2020-10-06 11:38:52 +01:00
Alex Richardson e426ae2bd5 [libcxx][dsl] Fix mutable default argument warning
This is flagged by PyCharm and can cause subtle bugs. While changing this
also re-sort the imports and add missing ones.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D88816
2020-10-05 23:23:30 +01:00
Louis Dionne ba9b15072c [libc++][ci] Add a job to run the vanilla configuration on Apple
Previously, we'd only have jobs testing the Apple cache on Apple platforms,
but libc++ should also work out-of-the-box.
2020-10-01 13:56:58 -04:00
Louis Dionne 79410ddb96 [libc++][ci] Add a configuration testing Apple's system library build
Differential Revision: https://reviews.llvm.org/D88650
2020-10-01 10:37:36 -04:00
Louis Dionne f9e70fa546 [libc++] Rename the -fno-rtti Lit feature to just no-rtti
This is consistent to the way we name other Lit features, and it removes
the possibility for confusing the Lit feature with the actual compiler
flag.
2020-09-29 16:29:44 -04:00
Louis Dionne d94253b52e [libc++][ci] Turn on Phabricator reporting by default 2020-09-29 15:57:07 -04:00
Louis Dionne b1e7850967 [libc++][ci] Improve the phabricator-report script
- Detect whether a build has passed more accurately
- Retry pushing the status to Phabricator
- Allow running on a non-review branch
2020-09-29 15:32:27 -04:00
Louis Dionne d689a64edd [libc++][ci] Add a script to describe when to trigger libc++ CI builds 2020-09-29 15:32:26 -04:00
Louis Dionne 2159ed811f [libc++][ci] Update how we build the Docker image
This fixes a couple of issues, such as failing filesystem tests (due to
running the tests as root), and not running with the GCC we downloaded.
2020-09-29 12:50:57 -04:00
Louis Dionne 3e5f9dacb0 [libc++] Fix tests on GCC 10
Also, remove workarounds for ancient Clangs from is_constructible tests.
2020-09-29 12:08:33 -04:00
Petr Hosek 2d657d1bd7 [libcxx] Don't pass -s to libtool
This flag is the default in libtool on Darwin, and it's not supported
by llvm-libtool-darwin causing a build failure.

Differential Revision: https://reviews.llvm.org/D88449
2020-09-28 14:50:09 -07:00
Louis Dionne 2a11a197af [libc++][ci] Don't require passing --token to phabricator-report
The CONDUIT_TOKEN is already taken from the environment. Also, disable
reporting back to Phabricator for now until we're ready to start spamming
the results back. This still needs a bit of testing.
2020-09-25 11:19:19 -04:00
Louis Dionne 9f21d341e8 [libc++] Initial support for pre-commit CI with Buildkite
This commit adds basic files and scripts that are used for the Buildkite
pre-commit CI setup. This was tested to mostly work on a fork of llvm-project,
however some adjustments will have to be made as we complete the real
setup.
2020-09-25 09:51:10 -04:00
Louis Dionne 7656dd33d9 [libc++] NFC: Reindent the feature test macro generation script
Each feature-test macro is now a clear block indentation-wise.
2020-09-22 17:40:14 -04:00
Louis Dionne 0724f8bf47 [libc++] Implement C++20's P0784 (More constexpr containers)
This commit adds std::construct_at, and marks various members of
std::allocator_traits and std::allocator as constexpr. It also adds
tests and turns the existing tests into hybrid constexpr/runtime tests.

Thanks to Richard Smith for initial work on this, and to Michael Park
for D69803, D69132 and D69134, which are superseded by this patch.

Differential Revision: https://reviews.llvm.org/D68364
2020-09-22 11:20:33 -04:00
Louis Dionne 0451ed9619 [libc++] NFC: Remove trailing whitespace from the feature test macro table 2020-09-22 08:45:48 -04:00
Louis Dionne 43270c65cf [libc++] Verify base substitutions earlier in the testing format
This allows diagnosing missing substitution issues even when doing
availability feature detection in the DSL.
2020-09-21 15:30:29 -04:00
Louis Dionne f06090243d [libc++] Use LLVM 11 instead of trunk on build bots
Somehow the snapshot of LLVM trunk we use was seeing failures.
2020-09-14 15:12:13 -04:00
Louis Dionne 7235326fb2 [libc++] Upgrade the Clang on build bots 2020-09-14 13:52:01 -04:00
Louis Dionne f980ed4184 [libcxx] Remove the 'availability' Lit feature
Instead, use with_system_cxx_lib with various compile-only tests to ensure
that we're getting compile-time errors, as expected. This follows the
lead of ec46cfefe8.
2020-09-11 11:34:49 -04:00
Mikhail Maltsev 6af8758ba4 [libcxx] Handle target triples with dashes in platform name
Target triples may contain a dash in the platform name (e.g.
"aarch64-arm-none-eabi"). Account for it when splitting the triple
into components.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D87508
2020-09-11 14:42:05 +01:00
Louis Dionne b0ae5332dc [libcxx] Make sure we pass -isysroot when linking AND when compiling 2020-09-10 12:24:11 -04:00
Louis Dionne ec46cfefe8 [libcxx] Simplify back-deployment testing
The needs of back-deployment testing currently require two different
ways of running the test suite: one based on the deployment target,
and one based on the target triple. Since the triple includes all the
information we need, it's better to have just one way of doing things.

Furthermore, `--param platform=XXX` is also supersedded by using the
target triple. Previously, this parameter would serve the purpose of
controling XFAILs for availability markup errors, however it is possible
to achieve the same thing by using with_system_cxx_lib only and using
.verify.cpp tests instead, as explained in the documentation changes.

The motivation for this change is twofold:
1. This part of the Lit config has always been really confusing and
   complicated, and it has been a source of bugs in the past. I have
   simplified it iteratively in the past, but the complexity is still
   there.
2. The deployment-target detection started failing in weird ways in
   recent Clangs, breaking our CI. Instead of band-aid patching the
   issue, I decided to remove the complexity altogether by using target
   triples even on Apple platforms.

A follow-up to this commit will bring the test suite in line with
the recommended way of handling availability markup tests.
2020-09-10 08:17:26 -04:00
Olivier Giroux fc4bff0cd3 Update atomic feature macros, synopsis, signatures to match C++20. Improve test coverage for non-lock-free atomics. 2020-09-09 10:00:09 -07:00
Louis Dionne 6454140ab3 [libc++] Make sure we always print all available features
Previously, we'd only print the features added through the new config,
however printing all the features is important for debugging purposes.
2020-09-08 11:18:02 -04:00
Michael Schellenberger Costa afe8ca8673 [libcxx] Fix whitespace error 2020-09-02 21:44:15 +02:00
Michael Schellenberger Costa 737a4501e8 Add constexpr to pair
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D80558
2020-09-02 21:21:24 +02:00
Louis Dionne 49644cd941 [libc++] Install a more recent CMake on libc++ builders 2020-08-27 11:26:27 -04:00
Louis Dionne f1a987366f [libc++] Use xcrun to find Ninja in the macOS backdeployment CI too 2020-08-26 11:33:05 -04:00
Louis Dionne 3d120b6f7b [libc++] Always run Ninja through xcrun in the macOS CI scripts
Ninja isn't installed by default on OSX, so run it through xcrun to find
the one in the developer tools if needed.
2020-08-26 10:49:26 -04:00
Louis Dionne 1ffc299628 [libc++] Ensure the CI scripts can find Ninja
Ninja isn't necessarily installed on macOS out of the box, so make sure
we use the SDK Ninja instead of relying on one being available on the
system.
2020-08-13 11:11:10 -04:00
Louis Dionne 82b6dec0ed [libc++] Remove c++98 from the possible Standards of the test suite
Clang treats C++98 and C++03 as the same anyway, so it's no use having
two different settings for the same standard.
2020-07-29 14:18:37 -04:00
Alex Richardson 19e472fd84 [libcxx][lit] Fix running testsuite with python2.7 after 9020d28688
Python 2.7 fails with TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
if you pass None as the prefix argument to NamedTemporaryFile.

Reviewed By: ldionne, bjope, #libc

Differential Revision: https://reviews.llvm.org/D84595
2020-07-27 10:15:18 +01:00
Alex Richardson 9020d28688 [libcxx][lit] Fix incorrect lambda capture in hasLocale checks
The lambda being used to check whether locales are supported was always
passing the value of alts from the last loop iteration due to the way that
python lambda captures work. Fix this by using a default argument capture.

To help debug future similar issues I also added a prefix to the config
test binary indicating which locale is being tested.
I originally found this issue when implementing a new executor that simply
collects test binaries in a given directory and was surprised to see many
additional executables other than the expected test binaries. I therefore
added the locale prefix to the test binaries and noticed that they were all
checking for cs_CZ.ISO8859-2.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D84040
2020-07-23 11:19:18 +01:00
Louis Dionne afa1afd410 [CMake] Bump CMake minimum version to 3.13.4
This upgrade should be friction-less because we've already been ensuring
that CMake >= 3.13.4 is used.

This is part of the effort discussed on llvm-dev here:

  http://lists.llvm.org/pipermail/llvm-dev/2020-April/140578.html

Differential Revision: https://reviews.llvm.org/D78648
2020-07-22 14:25:07 -04:00
Alex Richardson e59778a66a [libcxx] Fix default argument for merge_archives.py -L flag
If we use the default of None, we get a python exception in
find_and_diagnose_missing() instead of printing a sensible error message.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D84342
2020-07-22 18:32:34 +01:00
Alex Richardson 3980e8956b [libcxx][lit] Simplify parsing of trailing executor arguments
Adding a positional argparse.ONE_OR_MORE arguments will correctly remove
the "--" separator after --env and parse only the command. This also has
the advantage that misspelled flags raise an argparse error rather than
silently being added to the command to be executed.

I discovered this while adding a new commandline option to ssh.py to allow
passing additional arguments to the scp/ssh commands since this is required
for our CHERI CI where we need to pass `-F <custom_config_file>` to each
ssh/scp command to set various arguments such as the localhost port, usage
of controlmaster, etc. to speed up connections to our emulated QEMU systems.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D84096
2020-07-21 09:03:45 +01:00
serge-sans-paille 515bc8c155 Harmonize Python shebang
Differential Revision: https://reviews.llvm.org/D83857
2020-07-16 21:53:45 +02:00
Louis Dionne 2659663ee3 [libc++] Remove shortcut Lit features for Apple backdeployment
Some time ago, I introduced shortcut features like dylib-has-no-shared_mutex
to encode whether the deployment target supported shared_mutex (say). This
made the test suite annotations cleaner.

However, the problem with building Lit features on top of other Lit
features is that it's easier for them to become stale, especially when
they are generated programmatically. Furthermore, it makes the bar for
defining configurations from scratch higher, since more features have
to be defined. Instead, I think it's better to put the XFAILs in the
tests directly, which allows cleaning them up with a simple grep.
2020-07-16 15:39:08 -04:00