Commit Graph

6540 Commits

Author SHA1 Message Date
David Zarzycki 3f66bb2017 [libcxx testing] Remove ALLOW_RETRIES from last futures test
Like other uses of ALLOW_RETRIES, this test tried to verify that an API
returned "quickly" but quick is not safe to define given slow and/or
busy machines.

Instead, we now verify that these "wait" APIs actually wait, which the
old test did not.
2020-05-16 07:11:49 -04:00
Casey Carter 634a0acb30 Cleanup some test issues:
* improve coverage in `span`'s "conversion from `std::array`" test, while eliminating MSVC diagnostics about `testConstructorArray<T>() && testConstructorArray<const T, T>()` being redundant when `T` is already `const`.

* Remove use of `is_assignable` that triggers UB due to an insufficiently-complete type argument in `std::function`'s assignment operator test.

* Don't test that `shared_ptr` initialization from an rvalue triggers the lvalue aliasing constructor on non-libc++; this is not the case for Standard Libraries that implement LWG-2996. (Ditto, I'd simply remove this but it's your library ;).)

Differential Revision: https://reviews.llvm.org/D80030
2020-05-15 15:15:47 -07:00
Louis Dionne 16f5ce5a74 [libc++] Remove -ftemplate-depth when running tests
It doesn't appear to be needed anymore with the Clang on our build bots.
2020-05-15 14:21:29 -04:00
Louis Dionne ddacd370c5 [libc++] Do not set the runtime library path with DYLD_LIBRARY_PATH
We already set it using -rpath when linking test executables, and using
DYLD_LIBRARY_PATH causes problems when running other commands that
shouldn't run against the just-built libc++ (e.g. `ls` in a ShTest).

rdar://63241847
2020-05-15 14:09:40 -04:00
Louis Dionne 93e8164546 [libc++] Remove workaround for DYLD_LIBRARY_PATH being passed to the compiler
Since we're using the new testing format, DYLD_LIBRARY_PATH is not passed
to the compiler -- it's only passed to the programs we run as an argument
to the %{exec} substitution.
2020-05-15 13:53:45 -04:00
Louis Dionne 21b0ec2fc6 [libc++] Do not rely on use_system_cxx_lib to specify the path of the library to run against
This is already handled by setting cxx_runtime_root instead -- I don't
see a reason to have two ways of setting the runtime path of the library
we're running against.
2020-05-15 13:01:37 -04:00
Louis Dionne 1a68b5f048 [libc++] Fix broken Lit features based on __config_site macros
Because of Python's funny scoping rules with lambdas, we were always
using the value of `macro` as set in the last iteration of the loop.
This problem was introduced by e7bdfba4f0.
2020-05-15 12:25:19 -04:00
Louis Dionne bb7191aa81 [libc++] Segregate back-deployment dylibs into their own subdirectory
Otherwise, specifying (for example) the libc++.dylib from macos10.13
but the libc++abi.dylib from macos10.12 would end up adding library
paths for both the 10.12 and 10.13 dylibs, which would each contain
a copy of both libc++abi.dylib and libc++.dylib. By using a separate
directory for libc++.dylib and libc++abi.dylib, those do not conflict
anymore.

The back-deployment roots were updated to match this change.
2020-05-15 12:16:02 -04:00
Louis Dionne 04c89c7fca [libc++] Centralize where we set the libc++ and libc++abi paths in config.py
It's just confusing to have them all over the place.
2020-05-15 11:45:26 -04:00
Marek Kurdej 182adf120c [libc++] [span] [P1976] Update status page. NFC
It was implemented by commit 6d2599e4f7 "[libcxx][span] Implement P1976R2".
2020-05-15 14:35:15 +02:00
Michael Schellenberger Costa f58e78f992 [libcxx][span] trivial whitespace fix to test commit rights
Reviewers: #libc!, miscco

Reviewed By: miscco

Subscribers: broadwaylamb, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D79986
2020-05-15 09:54:41 +02:00
zoecarver 8f2cc889b0 [libcxx] [NFC] Add more reinterpret_pointer_cast tests.
* Add test for inheritance.
 * Test value is preserved through cast.
2020-05-14 12:04:05 -07:00
Michael Schellenberger Costa ab9f11168f [libcxx][span] Implement solution to LWG-3255
This implements the relaxed requirements on the std::array constructors of span,
where the type only needs to be convertible to the element type of the span.

Note that the previous tests were not sufficient, as the const array<T, n> constructor
was only tested for compile time and the array<T, N> only during runtime.

Restructure the tests so that we can test conversions as well as both constructors.

Differential Revision: https://reviews.llvm.org/D75706
2020-05-14 10:50:44 -04:00
Michael Schellenberger Costa 79941086fb [libc++][span] SFINAE span default constructor on Extent == 0
The default constructor of a static span requires _Extent == 0 so
SFINAE it out rather than using a static_assert

Differential Revision: https://reviews.llvm.org/D71994
2020-05-14 09:35:07 -04:00
Michael Schellenberger Costa c5ff4031c6 [libcxx][span] Remove const_iterator from std::span
This implements the resolution to LWG-3320.

Differential Revision: https://reviews.llvm.org/D75642
2020-05-14 08:34:32 -04:00
Michael Schellenberger Costa c73a491d10 [libcxx][span] Remove tuple interface
This implements P2116 by removing the tuple interface from std::span.

Differential Revision: https://reviews.llvm.org/D75640
2020-05-14 08:25:49 -04:00
John Brawn 4d25f4453d [libc++] Adjust how we guard the inclusion of unistd.h
unistd.h isn't guaranteed to exist when the target isn't Windows, in
particular if the target is bare-metal (i.e. no operating system).
Handle this by using __has_include instead, though in
filesystem/operations.cpp we already unconditionally include it so
just remove the extra include.

Differential Revision: https://reviews.llvm.org/D79784
2020-05-14 11:53:12 +01:00
David Zarzycki 1858953395 [libcxx testing] Remove ALLOW_RETRIES from two futures tests
These two tests do not use the "thread sleeps X milliseconds" pattern
that other libcxx tests use, so all we can do in order to remove
ALLOW_RETRIES workaround is remove the assumption that measuring the
"quick" return of `wait()` is possible (it is not). Let the test harness
verify overall that `wait()` does not hang.

As a bonus, have the spin-waiting threads `yield()`, which is what well
behaved code should do.
2020-05-14 06:18:23 -04:00
Louis Dionne e7bdfba4f0 [libc++] Explicitly list Lit features from the config_site header
When grepping for unused features in the test suite, we will now find
those features and where they are defined, as opposed to thinking they
are dead features.
2020-05-13 16:17:22 -04:00
Michael Schellenberger Costa 6d2599e4f7 [libcxx][span] Implement P1976R2
This resolves the NB comment about the construction of a fixed-size span
from a dynamic range.

Differential Revision: https://reviews.llvm.org/D74577
2020-05-13 09:52:47 -04:00
Marek Kurdej ab61fe4150 Revert "[libc++] [LWG3321] Mark "year_month_day_last::day() specification does not cover !ok() values" issue as "Nothing to do", but add assertion."
This reverts commit e25a2601aa.
It was failing due to _LIBCPP_ASSERT throwing in a method marked noexcept.
2020-05-13 13:16:43 +02:00
David Zarzycki 1febe28982 [libcxx testing] Remove ALLOW_RETRIES from wait_for futures test
This test tried to verify that "wait()" returned quickly but "quick" is
impossible to define given a busy and/or slow system.

Instead, I've refactored the test to verify that `wait()` actually
waits which the old test did not verify.
2020-05-13 06:47:29 -04:00
Marek Kurdej e25a2601aa [libc++] [LWG3321] Mark "year_month_day_last::day() specification does not cover !ok() values" issue as "Nothing to do", but add assertion.
Summary:
This LWG issue states that the result of `year_month_day_last::day()` is implementation defined if `ok()` is `false`.
However, from user perspective, calling `day()` in this situation will lead to a (possibly difficult to find) crash.
Hence, I have added an assertion to warn user at least when assertions are enabled.
I am however not aware of the libc++ stand on the desired behaviour.

Reviewers: ldionne, mclow.lists, EricWF, #libc

Reviewed By: ldionne, #libc

Subscribers: christof, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D70346
2020-05-13 11:45:55 +02:00
zoecarver 8aa2266fd8 [libcxx] Constrain function assignment operator (2574).
This patch fixes LWG issue 2574.

Differential Review: https://reviews.llvm.org/D62928
2020-05-12 18:57:50 -07:00
Casey Carter 2c861e8a12 [libc++][test] Properly mark libc++-only XFAILs
These tests PASS on libstdc++ and MSVC.
2020-05-12 16:11:22 -07:00
zoecarver ce195fb22b [libcxx] Re-commit: shared_ptr changes from library fundamentals (P0414R2).
Implements P0414R2:
  * Adds support for array types in std::shared_ptr.
  * Adds reinterpret_pointer_cast for shared_ptr.

Re-committing now that the leaking tests are fixed.

Differential Revision: https://reviews.llvm.org/D62259
2020-05-12 11:23:18 -07:00
David Zarzycki 9e32bf550d [libcxx testing] Remove ALLOW_RETRIES from sleep_for.pass.cpp
Operating systems are best effort by default, so we cannot assume that
sleep-like APIs return as soon as we'd like.

Even if a sleep-like API returns when we want it to, the potential for
preemption means that attempts to measure time are subject to delays.
2020-05-12 06:55:11 -04:00
zoecarver 5eb55483eb Revert "[libcxx] shared_ptr changes from library fundamentals (P0414R2)."
This reverts commit e8c13c182a.
2020-05-11 22:43:17 -07:00
zoecarver e8c13c182a [libcxx] shared_ptr changes from library fundamentals (P0414R2).
Implements P0414R2:
  * Adds support for array types in std::shared_ptr.
  * Adds reinterpret_pointer_cast for shared_ptr.

Differential Revision: https://reviews.llvm.org/D62259
2020-05-11 18:46:29 -07:00
David Zarzycki 4f4d6c81f8 [libcxx testing] Remove ALLOW_RETRIES from sleep_until.pass.cpp
Operating systems are best effort by default, so we cannot assume that
sleep-like APIs return as soon as we'd like.

Even if a sleep-like API returns when we want it to, the potential for
preemption means that attempts to measure time are subject to delays.
2020-05-10 05:59:09 -04:00
David Zarzycki 4f4ce13944 [libcxx testing] Make three locking tests more reliable
The challenge with measuring time in tests is that slow and/or busy
machines can cause tests to fail in unexpected ways. After this change,
three tests should be much more robust. The only remaining and tiny race
that I can think of is preemption after `--countDown`. That being said,
the race isn't fixable because the standard library doesn't provide a
way to count threads that are waiting to acquire a lock.

Reviewers: ldionne, EricWF, howard.hinnant, mclow.lists, #libc

Reviewed By: ldionne, #libc

Subscribers: dexonsmith, jfb, broadwaylamb, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D79406
2020-05-09 11:11:26 -04:00
Eric Fiselier c490c5e81a Reland [libc++] Move abs and div into stdlib.h to fix header cycle.
This commit should will break libc++ without local submodule visibility, but
the LLVM+modules bots are now all using this mode. Before the Green Dragon
LLDB bot was failing to compile with a libc++ built with this commit as LSV
was disabled on macOS.

Original summary:

libc++ is careful to not fracture overload sets. When one overload
is visible to a user, all of them should be. Anything less causes
subtle bugs and ODR violations.

Previously, in order to support ::abs and ::div being supplied by
both <cmath> and <cstdlib> we had to do awful things that make
<math.h> and <stdlib.h> have header cycles and be non-modular.
This really breaks with modules.

Specifically the problem was that in C++ ::abs introduces overloads
for floating point numbers, these overloads forward to ::fabs,
which are defined in math.h. Therefore ::abs needed to be in math.h
too. But this required stdlib.h to include math.h and math.h to
include stdlib.h.

To avoid these problems the definitions have been moved to stddef.h
(which math includes), and the floating point overloads of ::abs
have been changed to call __builtin_fabs, which both Clang and GCC
support.
2020-05-08 21:52:27 +02:00
zoecarver afc8b49782 [libcxx] Delete pointer in shared_ptr deduction test.
Updates the dummy deleter in deduction.pass.cpp to delete the pointer argument. This will fix the asan bots.
2020-05-08 12:19:38 -07:00
zoecarver 26466efe08 Revert "[libc++] ECMAScript IdentityEscape is ambiguous (2584)"
This reverts commit 6d2a66b10d.

The regex expressions in some lld tests need to be fixed. Reverting
until those are fixed.
2020-05-08 10:37:04 -07:00
Casey Carter 197f185274 [libc++][test] Add test coverage for codecvt<char(16|32)_t, char8_t, mbstate_t>
This change adds test coverage for the `codecvt<char16_t, char8_t, mbstate_t>` and `codecvt<char32_t, char8_t, mbstate_t>` ctype facets added to the C++20 WD by [P0482R6](https://wg21.link/P0428R6). Note that libc++ does not implement these facets despite implementing the remainder of P0482, presumably for ABI reasons, so these tests are marked `UNSUPPORTED: libc++`.
2020-05-08 06:14:25 -07:00
zoecarver 6d2a66b10d [libc++] ECMAScript IdentityEscape is ambiguous (2584)
This patch fixes [[ https://cplusplus.github.io/LWG/issue2584 | 2584 ]]. Now the following works:
    const std::regex r1("\\z");
    assert(std::regex_match("z", r1));

Differential Revision: https://reviews.llvm.org/D66610
2020-05-07 14:26:25 -07:00
zoecarver df73e36dc6 [libcxx] [NFC] fpos Requirements (p0759r1).
Implements p0759r1. Test-only change. Adds explicit test for table 106 and type checking.

Differential Review: https://reviews.llvm.org/D60491
2020-05-07 14:02:42 -07:00
Marcel Hlopko c9e6519d15 Remove unused _LIBCPP_RAW_ITERATORS
Summary: This change removes seemingly unused _LIBCPP_RAW_ITERATORS.

Reviewers: #libc, EricWF, ldionne

Reviewed By: #libc, EricWF, ldionne

Subscribers: dexonsmith, ldionne, gribozavr2, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D79323
2020-05-07 22:26:15 +02:00
Antonio Sanchez aa0b991dcf [libc++] Fix ostream for complex numbers with fixed field width
The ostream operator<< is currently broken for std::complex with
specified field widths.

This patch a partial revert of c3478eff7a (reviewed as D71214),
restoring the correct behavior.

Differential Revision: https://reviews.llvm.org/D78816
2020-05-07 13:51:07 -04:00
Louis Dionne eb252b328c [libc++] NFC: Port type_info tests to C++03 2020-05-07 13:41:51 -04:00
Mara Sophie Grosch 59b3102739 [libc++] chrono: check _POSIX_TIMERS before using clock_gettime
clock_gettime is documented to be available when _POSIX_TIMERS is
defined. Add a check for this.

Differential Revision: https://reviews.llvm.org/D79305
2020-05-07 13:15:10 -04:00
Casey Carter 8615ce246d [libc++][test] Adjust move_iterator tests to allow C++20
These tests fail due to a couple of changes to `move_iterator` for C++20:

* `move_iterator<I>::operator++(int)` returns `void` in C++20 if `I` doesn't model `forward_iterator`.

* `move_iterator<I>::reference` is calculated in C++20, so `I` must actually have an `operator*() const`.

Differential Revision: https://reviews.llvm.org/D79343
2020-05-07 09:58:13 -07:00
Louis Dionne 31d41e3879 [libc++] Add tests for _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
The issue on Apple platforms was fixed in 2464d8135e, but this commit
adds some tests to make sure we don't regress.

See https://llvm.org/PR45549.

Differential Revision: https://reviews.llvm.org/D78963
2020-05-07 12:40:02 -04:00
Logan Smith 83564056d4 [libcxx] Add deduction guides for shared_ptr and weak_ptr
This patch adds deduction guides to <memory> to allow deducing
construction of shared_ptrs from unique_ptrs, and from weak_ptrs
and vice versa, as specified by C++17.

Differential Revision: https://reviews.llvm.org/D69603
2020-05-07 12:07:48 -04:00
Logan Smith 5b4a98eb58 [libcxx] Qualify make_pair in searcher implementations to prevent ADL
This patch adds `_VSTD::` to some calls to `make_pair` inside the
implementations of searchers, to prevent things exploding if there is
a make_pair in an associated namespace of a user-defined type.
https://godbolt.org/z/xAFG98

Differential Revision: https://reviews.llvm.org/D72640
2020-05-07 11:57:10 -04:00
Sergej Jaskiewicz 5e3ab8f229 Revert "[libc++] [test] Generate static_test_env on the fly"
This reverts commit 52cc8bac77.

As the discussion in https://reviews.llvm.org/D78200 continues, I will
revert this until we figure out what to do.
2020-05-06 23:13:24 +03:00
Louis Dionne 89bb9f8d78 [libc++] Make sure the cin/wcin tests run on remote hosts
When running on remote hosts, we need the whole `echo 123 | %t.exe` command
to run on the remote host. Thus, we need to escape the pipe to make sure
the command is treated as `{ echo 123 | %t.exe } > %t.out` instead of
`{ echo 123 } | %t.exe > %t.out`m where only `echo 123` is run on the
remote host.
2020-05-06 11:33:13 -04:00
Louis Dionne d98b9a4157 [libc++] NFC: Do not print the environment on remote hosts
Running `export` when there is no environment variable to export will
cause the environment on the remote host to be printed. We don't want
that, so don't run any `export` command on the host when there's no env.
2020-05-06 11:33:13 -04:00
Louis Dionne c82f9eba4a [libc++] Fix broken modules tests on single-threaded systems
Since c0cd106fcc, we add __config_site macro defines to the compiler
command line whether we are building with modules or not. This means
that the modules tests are expected to fail on single-threaded systems
whether we build with modules or not.
2020-05-06 09:59:50 -04:00
Sergej Jaskiewicz 52cc8bac77 [libc++] [test] Generate static_test_env on the fly
Summary:
Instead of storing `static_test_env` (with all the symlinks) in the repo, we create it on the fly to be cross-toolchain-friendly. The primary use case for this are Windows-hosted cross-toolchains. Windows doesn't really have a concept of symlinks. So, when the monorepo is cloned, those symlinks turn to ordinary text files. Previously, if we cross-compiled libc++ for some symlink-friendly system (e. g. Linux) and ran tests on the target system, some tests would fail. This patch makes them pass.

Reviewers: ldionne, #libc

Reviewed By: ldionne, #libc

Subscribers: EricWF, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D78200
2020-05-06 01:23:50 +03:00
Sergej Jaskiewicz 718a2927ad Revert "[libc++] Generate symlinks in static_test_env on the fly"
This reverts commit 645ad5badb.

This commit did not incorporate all the changes intended.
2020-05-06 01:21:53 +03:00
Sergej Jaskiewicz 645ad5badb [libc++] Generate symlinks in static_test_env on the fly
Instead of storing static_test_env (with all the symlinks) in the repo,
we create it on the fly to be cross-toolchain-friendly. The primary
use case for this are Windows-hosted cross-toolchains. Windows doesn't
really have a concept of symlinks. So, when the monorepo is cloned,
those symlinks turn to ordinary text files. Previously, if we
cross-compiled libc++ for some symlink-friendly system (e. g. Linux) and
ran tests on the target system, some tests would fail. This patch makes
them pass.

Differential Revision: https://reviews.llvm.org/D78200
2020-05-06 01:13:18 +03:00
Louis Dionne 50cd964e61 [libc++] Rewrite the tests for cin, cout, clog, cerr and friends
The tests were disabled with `#if 0`, most likely because there was no
way of writing shell tests when they were first written.
2020-05-05 13:27:17 -04:00
Louis Dionne 7e6221da10 [libc++] Remove unused functions and minor features of the test suite
This commit removes minor features of the test suite that I've never
seen used and that are basically just a maintenance burden:

- color_diagnostics: Diagnostics are colored by default when running
  from a terminal, and not colored otherwise. This is the right behavior.
  Being able to tweak this has minor value, and could be achieved by
  modifying the %{compile_flags} instead if absolutely needed.

- ccache: This can be achieved by using a wrapper for the %{cxx}
  substitution.

- _dump_macros_verbose is just a dead function now.
2020-05-05 09:58:36 -04:00
Louis Dionne 17a53a14fc [libc++] Allow <__config_site> not being included
Otherwise, we can't test other standard libraries.
2020-05-05 09:45:30 -04:00
Louis Dionne c0cd106fcc [libc++] Move parsing of <__config_site> macros to the DSL 2020-05-05 09:31:42 -04:00
Louis Dionne 94361ddd93 [libc++] Always enable local submodule visibility in the test suite
When building with modules, always enable local submodule visibility.
It used to be disabled on Apple platforms, but it seems like we want
to use the same flags on Apple and Linux now (see https://reviews.llvm.org/D74892).
2020-05-04 13:29:24 -04:00
Louis Dionne 09e4e9ff7b [libc++] NFC: Remove unnecessary scope
The double-braces were initially to escape Python string formatting, but
that string isn't sent through Python string formatting.
2020-05-04 12:32:45 -04:00
Louis Dionne 0b722a8dba [libc++] Translate the modules-support Lit feature to the DSL 2020-05-04 12:14:19 -04:00
Louis Dionne d28f69d923 [libc++] NFC: Remove outdated #if comment 2020-05-04 11:39:28 -04:00
Louis Dionne db015fdd20 [libc++] Translate compiler-identification Lit features to the new DSL 2020-05-04 11:02:38 -04:00
Louis Dionne 9ae23bd0a3 [libc++] NFC: Print Lit available features in sorted order
This makes it easier to diff them between bot runs.
2020-05-04 10:12:07 -04:00
Louis Dionne ff4a3ee49c [libc++] Define a few Lit features using the new DSL
This commit migrates some of the Lit features from config.py to the new
DSL. This simplifies config.py and is a first step towards defining all
the features using the DSL instead of the complex logic in config.py.

Differential Revision: https://reviews.llvm.org/D78382
2020-05-04 08:54:07 -04:00
Casey Carter 7e3ef299cb [libc++][test] Use a non-narrowing conversion in assign_pair.pass.cpp
...to avoid warnings, e.g., from MSVC.
2020-05-03 10:59:10 -07:00
Marek Kurdej 3e895085de [libc++][P1115][C++20] Improving the Return Value of Erase-Like Algorithms II: Free erase/erase if.
Summary:
This patch adds return type to std::erase and std::erase_if functions.

Also:
* Update __cpp_lib_erase_if to 202002L.
* Fix synopsis in unordered_map.
* Fix generate_feature_test_macro_components.py script.

Reviewers: EricWF, mclow.lists, ldionne, #libc

Reviewed By: ldionne, #libc

Subscribers: broadwaylamb, zoecarver, dexonsmith, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D75905
2020-05-02 14:04:50 +02:00
Louis Dionne cd05707d08 [libc++] Try re-enabling DSL test on Windows
The issues we were seeing before should have been fixed, but it's hard
to say for sure without running through the bots again.
2020-05-01 14:29:37 -04:00
Louis Dionne b420a09959 [libc++] Re-enable some tests under ASAN and MSAN
The tests were disabled under ASAN/MSAN because old Clangs were very
slow to build the test cases. However, I checked with the Clang used
on our build bots and the tests are not slow to build anymore, so the
tests can be re-enabled.
2020-05-01 14:03:51 -04:00
Louis Dionne 68fb8051d0 [libc++] Turn on warnings in the test suite in C++03 for Clang-based compilers 2020-05-01 13:34:11 -04:00
Louis Dionne 566b52da8b [libc++] Disable test that we use -Werror in C++03 2020-05-01 13:12:07 -04:00
Louis Dionne 9ff51bf92e [libc++] NFC: fix typos 2020-05-01 13:10:30 -04:00
Diogo Sampaio 081dbd61db [NFC] Try to fix test due asan failure 2020-05-01 17:18:25 +01:00
Louis Dionne 9295f356bb [libc++] Avoid using GNU extension in test, which triggers a warning 2020-05-01 11:10:06 -04:00
Louis Dionne 0c91e134e6 [libc++] Make sure -Werror is enabled all the time, except in verify tests 2020-05-01 10:45:39 -04:00
Shoaib Meenai cc259638cb [libcxx][libcxxabi][libunwind] Use libgcc on Android
Android doesn't have a libgcc_s and uses libgcc instead, so adjust the
build accordingly. This matches compiler-rt's build setup. libc++abi and
libunwind were already checking for libgcc but in a different context.
This change makes them search only for libgcc on Android now, but the
code to link against libgcc if it were present was already there.

Reviewed By: #libc, #libc_abi, #libunwind, rprichard, srhines

Differential Revision: https://reviews.llvm.org/D78787
2020-04-30 15:42:32 -07:00
Diogo Sampaio c14ac8043e [FIX][libc++][Regex] Using regex_constants match_prev_avail | match_not_bol | match_not_bow
Summary:
pr42199
When using regex_constants::match_prev_avail, it is defined that
--first is valid, and match_not_bol and match_not_bow should be
ignored. At the moment these flags are not ignored. This fixis that.

Reviewers: ldionne, miyuki, EricWF, mclow.lists, #libc

Reviewed By: ldionne, miyuki, #libc

Subscribers: broadwaylamb, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D75622
2020-04-30 23:36:25 +01:00
Louis Dionne 75a815a28c [libc++] Use Lit utilities instead of old libcxx utilities for str/bytes conversions
The libcxx.util utilities don't work properly, and we should remove them
when we get rid of compiler.py. In particular, libcxx.util.to_string
appears to be completely broken.
2020-04-30 15:49:40 -04:00
Louis Dionne ecd3ce0e5a [libc++] Make sure platform detection works in both Python 2 and 3
19123a3e08 was too naive -- we really want to handle both Python 2 and
Python 3, not only Python 3.
2020-04-30 15:32:08 -04:00
Louis Dionne 5d46e4b0da [libc++] Don't over-quote arguments to DSL tests
On Windows, quoting with single-quotes is both unnecessary and incorrect.
If the arguments are properly handled by Lit (which they are), quoting
should not be necessary.
2020-04-30 14:23:24 -04:00
Louis Dionne d789ef1608 [libc++] Make sure we create the working directory for running config check commands
The internal Lit shell requires the current working directory to exist.
This didn't show up locally because the directories were already created
by previous runs of the tests.
2020-04-30 14:10:56 -04:00
Louis Dionne cfedd7d5e3 [libc++] Use the internal Lit shell parser to run config tests
This makes the config tests portable across platforms.
2020-04-30 13:26:57 -04:00
Louis Dionne dfec13fcf2 [libc++] Do not allow customizing the arch in the trunk and back-deployment scripts
We should eventually be able to pass an arbitrary target triple, however
for the time being, just being able to pass 64/32 is not really that
useful.
2020-04-30 12:58:51 -04:00
Louis Dionne 2fd7d364cd [libc++] Make the verify-support feature implicit
Tests that require support for Clang-verify are already marked as such
explicitly by their extension, which is .verify.cpp. Requiring the use
of an explicit Lit feature is, after thought, not really helpful.

This is a change in design: we have been bitten in the past by tests not
being enabled when we thought they were. However, the issue was mostly
with file extensions being ignored. The fix for that is not to blindly
require explicit features all the time, but instead to report all files
that are in the suite but that don't match any known test format. This
can be implemented in a follow-up patch.
2020-04-30 11:47:12 -04:00
Dan Albert 2e090e4884 Reset another globalMemCounter. 2020-04-29 17:15:04 -07:00
Louis Dionne ae3e58517e [libc++] Re-disable DSL test on Windows
This reverts commit 51a60ed14c, since the test still doesn't pass on
Windows. Marking the test as UNSUPORTED	on Windows again until I've
figured out the problem.
2020-04-29 14:21:04 -04:00
Louis Dionne 43a1d0d963 [libc++] NFC: Properly indent nested #ifs in platform_support.h 2020-04-29 12:53:16 -04:00
Louis Dionne 5b97aa14f4 [libc++] Re-disable parts of the failing RU locale tests on Apple
Instead of completely disabling the tests on Apple, which makes them
disabled on all platforms we test (and hence useless), this commit
disables only the assertions that actually fail. I also created a
bug report to track re-enabling them (https://llvm.org/PR45739).
2020-04-29 12:50:58 -04:00
Louis Dionne 5e37cf0adc [libc++] Try re-enabling long-disabled locale tests on Apple platforms
These two locale tests are disabled because they were said to "pass in
an uncontrolled manner on Apple platforms". This commit re-enables them
to see what that means, and whether that is still relevant on the
platforms we test.

Before this commit, the tests were either XFAILed or UNSUPPORTED on
Apple and Linux, which is pretty much all the systems we support. If
the tests truly don't work anywhere, they should be removed instead.
2020-04-29 12:03:05 -04:00
Louis Dionne d7da36c6e0 [libc++] Mark two timed_mutex tests as flaky 2020-04-29 11:52:17 -04:00
Louis Dionne 51a60ed14c [libc++] Try re-enabling DSL test on Windows
The issue we were seeing before should have been fixed by 178a0c80ba.
2020-04-29 11:32:27 -04:00
Louis Dionne 19123a3e08 [libc++] Fix MacOS platform detection broken in Python 3
Since 88af3ddb1e, libc++ will prefer Python 3 when available. It is
available on Apple platforms, so subprocess.check_output will return
bytes instead of str. This lead to comparisons against str to be false,
and the MacOS platform not being detected properly.
2020-04-29 10:00:56 -04:00
Saleem Abdulrasool 216833b32b Revert "Temporarily revert "build: use `find_package(Python3)` if available""
This reverts commit 35edd704e0.

Revert the revert and extend the patch further to account for the use of
the `PYTHONINTERP_FOUND`.
2020-04-29 01:38:08 +00:00
Casey Carter 68b30bc02b [NFC] Correct spelling of "ambiguous" 2020-04-28 14:51:37 -07:00
Louis Dionne 178a0c80ba [libc++] Make sure temporary config files are closed
Otherwise, trying to remove the file triggers an error on Windows.
2020-04-28 17:13:03 -04:00
Saleem Abdulrasool 88af3ddb1e build: update libc++ as there are some bots with integrated build
Some of the builders are building with C++ in the unified build.  Merge
this without review to try to restore the builder.
2020-04-28 20:07:28 +00:00
Raphael Isemann bd2965c9db Revert "Recommit [libc++] Move abs and div into stdlib.h to fix header cycle."
It seems that D74892 still hasn't fixed the issue on the bot. Currently
investigating the bot breakage and meanwhile (again) reverting this...
2020-04-28 20:23:22 +02:00
Louis Dionne 14f07bcab0 [libc++] Avoid using distutils.util in the DSL
Some bots apparently don't have that package.
2020-04-28 13:33:04 -04:00
Louis Dionne 707df4acdc [libc++] Temporarily disable test that fails on Windows 2020-04-28 13:10:12 -04:00
Louis Dionne e82f0a598f [libc++][Take 2] Create a small DSL for defining Lit features and parameters
This allows defining Lit features that can be enabled or disabled based
on compiler support, and parameters that are passed on the command line.

The main benefits are:
- Feature detection is entirely based on the substitutions provided in
  the TestingConfig object, which is simpler and decouples it from the
  complicated compiler emulation infrastructure.
- The syntax is declarative, which makes it easy to see what features
  and parameters are accepted by the test suite. This is significantly
  less entangled than the current config.py logic.
- Since feature detection is based on substitutions, it works really
  well on top of the new format, and custom Lit configurations can be
  created easily without being based on `config.py`.

This commit is a reapplication of 6d58030c8c, which was reverted in
8f24c4b72f because it broke Python 3 support. This re-application
supports Python 3.

Differential Revision: https://reviews.llvm.org/D78381
2020-04-28 10:02:40 -04:00
Eric Fiselier d0846b432c Recommit [libc++] Move abs and div into stdlib.h to fix header cycle.
This relands this commit as it broke the LLDB bot the first time it landed.
See also the discussion on https://reviews.llvm.org/rG82b47b2978405f802a33b00d046e6f18ef6a47be

Since D74892 this code should now also work on macOS.

Original description:

libc++ is careful to not fracture overload sets. When one overload
is visible to a user, all of them should be. Anything less causes
subtle bugs and ODR violations.

Previously, in order to support ::abs and ::div being supplied by
both <cmath> and <cstdlib> we had to do awful things that make
<math.h> and <stdlib.h> have header cycles and be non-modular.
This really breaks with modules.

Specifically the problem was that in C++ ::abs introduces overloads
for floating point numbers, these overloads forward to ::fabs,
which are defined in math.h. Therefore ::abs needed to be in math.h
too. But this required stdlib.h to include math.h and math.h to
include stdlib.h.

To avoid these problems the definitions have been moved to stddef.h
(which math includes), and the floating point overloads of ::abs
have been changed to call __builtin_fabs, which both Clang and GCC
support.
2020-04-28 15:42:36 +02:00
David Zarzycki 8f24c4b72f Revert: [libc++] Create a small DSL for defining Lit features and parameters
This reverts commit 6d58030c8c due to lack
of Python 3 support. As a reminder, the Python community ended their
support for 2.x at the start of 2020.
2020-04-28 08:12:19 -04:00
Casey Carter b4437992ec [libc++][test] Disable test for extension that's unsupportable in C++20
Defining the nested types `reference` and `iterator_concept` of `reverse_iterator<I>` necessarily requires `I` to be complete in C++20. These tests that verify that `std::map<int, X>::reverse_iterator` can be instantiated when `X` is incomplete are going to have a bad time.

Differential Revision: https://reviews.llvm.org/D78944
2020-04-27 13:06:31 -07:00
Louis Dionne 05ef484df5 [libc++] Properly handle --no-execute in the new format
If --no-execute is passed, we shouldn't report XFAIL tests as passing,
or they will be considered to XPASS.
2020-04-27 13:37:39 -04:00
Louis Dionne b640ec007f [libc++] Quote path to the Python executable in ShTest
This is an attempt to unbreak this test on Windows, where paths contain
backslashes that are interpreted as escape characters unless quoted.
2020-04-27 13:07:29 -04:00
Louis Dionne a486edd03a [libc++abi] Assume that libcxx is checked out in the Apple build script
Instead of using the libc++ headers provided alongside the toolchain,
use those in the sibling libcxx directory that we know is checked out.
Before the days of the monorepo, we couldn't assume that the libc++
repository was present when building libcxxabi. Since we can now make
that assumption, it's always better to use the version of libc++ that
is in lockstep with libc++abi, to avoid subtle bugs.
2020-04-27 11:20:11 -04:00
Louis Dionne 6d58030c8c [libc++] Create a small DSL for defining Lit features and parameters
This allows defining Lit features that can be enabled or disabled based
on compiler support, and parameters that are passed on the command line.

The main benefits are:
- Feature detection is entirely based on the substitutions provided in
  the TestingConfig object, which is simpler and decouples it from the
  complicated compiler emulation infrastructure.
- The syntax is declarative, which makes it easy to see what features
  and parameters are accepted by the test suite. This is significantly
  less entangled than the current config.py logic.
- Since feature detection is based on substitutions, it works really
  well on top of the new format, and custom Lit configurations can be
  created easily without being based on `config.py`.

Differential Revision: https://reviews.llvm.org/D78381
2020-04-27 09:56:04 -04:00
Louis Dionne f17eb4ec20 [libc++] Add UNSUPPORTED markup for shared_mutex and shared_timed_mutex tests
The tests were previously disabled entirely whenever availability markup
was enabled. Instead, enable the tests but add the proper UNSUPPORTED
markup.
2020-04-27 04:23:58 -04:00
Louis Dionne e0ae2cc894 [libc++] Mark C++20 Synchronization Library tests as unsupported in C++11
The various headers comprising the C++20 Synchronization Library only
contain something in C++ >= 14, not C++ >= 11.
2020-04-27 03:38:31 -04:00
Louis Dionne 38a9528ca2 [libc++] NFC: Expose a top-level parseScript function in the new format 2020-04-24 16:55:38 -04:00
Louis Dionne a9104f89b1 [libc++] Properly import lit.formats from the new format 2020-04-24 15:47:48 -04:00
Louis Dionne 4de60d955a [libc++] NFC: Refactor the new format substitutions into its own method
This way, we can reuse the substitution logic in the new DSL.
2020-04-24 15:35:57 -04:00
Louis Dionne 4fd92cc475 [libc++] Get rid of pipe in command to check whether verify is supported 2020-04-24 15:30:25 -04:00
Louis Dionne 7f48246175 [libc++] Quietly scp tarballs over with the remote executor
Otherwise, the progress-meter is printed.
2020-04-24 14:47:56 -04:00
Louis Dionne a2fc2207eb [libc++] NFC: Remove unused parameters in the new test format 2020-04-24 11:05:11 -04:00
Louis Dionne f76c42416c [libc++] Improve the detection of whether the blocks runtime is available
The runtime for Blocks may not be available even though the Blocks
language extension _is_ available. Instead of potentially failing,
this commit is much more conservative and assumes the runtime for
Blocks is only provided on Apple platforms.

Differential Revision: https://reviews.llvm.org/D78757
2020-04-24 07:02:21 -04:00
Sergej Jaskiewicz abe827be9e [libcxx] Add FILE_DEPENDENCIES line to the func.blocks.sh.cpp test
This should fix the bots that use ssh.py to execute tests
2020-04-23 23:17:57 +03:00
Louis Dionne d6c95ae6ff [libc++] Update scripts to build libc++/libc++abi for Apple
Also, make sure we test them.
2020-04-23 14:31:04 -04:00
Louis Dionne 2464d8135e [libc++] Make sure we assume merged typeinfo names on Apple
The introduction of LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT changed
the default from =1 (assuming merged typeinfos) to =0 (not assuming
merged typeinfos) on all platforms where at least one other __config_site
macro is defined.

This commit explicitly enables the assumption of merged typeinfo names
on Apple platform to restore the previous behavior, at least until the
underlying issue has been fixed.
2020-04-22 17:35:30 -04:00
Louis Dionne e5291c4ae3 [libc++/abi] Provide an option to turn on forgiving dynamic_cast when building libc++abi
Instead of the ad-hoc #define _LIBCXX_DYNAMIC_FALLBACK, provide an option
to enable the setting when building libc++abi. Also use the occasion to
rename the option to something slightly more descriptive.

Note that in the future, it would be great to simply remove this option
altogether. However, in the meantime, it seems better to have it be an
official option than something ad-hoc.
2020-04-22 16:24:26 -04:00
Louis Dionne cd66970b37 [libc++] Don't try to include <Block.h> when not available 2020-04-22 15:22:12 -04:00
Louis Dionne 430b00954c [libc++] Add support for blocks in std::function
rdar://14390808
2020-04-22 14:58:02 -04:00
Louis Dionne 2d0c9bf55e [libc++] Update the cache for building libc++/libc++abi on Apple 2020-04-22 14:04:50 -04:00
Louis Dionne 8c61114c53 [libc++/abi/unwind] Rename Lit features for no exceptions to 'no-exceptions'
Instead of having different names for the same Lit feature accross code
bases, use the same name everywhere. This NFC commit is in preparation
for a refactor where all three projects will be using the same Lit
feature detection logic, and hence it won't be convenient to use
different names for the feature.

Differential Revision: https://reviews.llvm.org/D78370
2020-04-22 08:25:27 -04:00
David Zarzycki b2f06bd20b [libc++ testing] Fix unused variable warning turned error 2020-04-22 08:05:31 -04:00
Louis Dionne d632587664 [libc++] Do not enable assertions in the dylib in the Apple cache
It turns out that all this time, we've actually been building without
assertions enabled in the dylib. This commit updates the Apple CMake
cache to make it consistent with reality.
2020-04-21 13:12:03 -04:00
Louis Dionne fccc4af658 [libc++] Re-enable warnings in the new format
When the new libc++ test format was enabled, warnings were accidentally
dropped cause they were not part of the %{compile_flags} substitution.
This commit adds them back, however `-Werror` is only used for non-verify
tests (cause it doesn't make sense for verify tests).

This commit is a re-application of 20fd624380, which was reverted in
5ec6fdb058 because it broke the C++03 bot. This failure should have
been fixed in b4fb705e77.
2020-04-21 13:01:08 -04:00
Louis Dionne b4fb705e77 [libc++] Fix warnings with Clang in C++03 2020-04-21 11:03:05 -04:00
Louis Dionne 5ec6fdb058 Revert "[libc++] Re-enable warnings in the new format"
This reverts commit 20fd624380, which broke the C++03 build bot.
I'll have another stab at this after fixing those failures.
2020-04-20 16:42:53 -04:00
Louis Dionne 20fd624380 [libc++] Re-enable warnings in the new format
When the new libc++ test format was enabled, warnings were accidentally
dropped cause they were not part of the %{compile_flags} substitution.
This commit adds them back, however `-Werror` is only used for non-verify
tests (cause it doesn't make sense for verify tests).
2020-04-20 16:02:49 -04:00
Louis Dionne 1cac82cf38 [libc++] Fix a few warnings when running the test suite with GCC 2020-04-20 13:48:50 -04:00
Zola Bridges 0f12480bd1 [dfsan] Add "DataFlow" option to LLVM_USE_SANITIZER
Summary:
This patch add the dataflow option to LLVM_USE_SANITIZER and documents
it.

Tested via check-cxx (wip to fix the errors).

Reviewers: morehouse, #libc!

Subscribers: mgorny, cfe-commits, libcxx-commits

Tags: #clang, #libc

Differential Revision: https://reviews.llvm.org/D78390
2020-04-20 10:30:52 -07:00
Zola Bridges 33ad38a925 [libcxx][docs] Clearer mark up for --param
Summary:
When I read this on the website it looks like the `--` in the used font turns
into an em dash. I updated this with inline literal mark up so the `--` will
remain obvious.

Reviewers: EricWF, #libc!

Subscribers: libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D78405
2020-04-20 09:15:04 -07:00
Louis Dionne ecf313c01d [libc++] Fix the no-exceptions build of libc++ on Apple
We previously tried re-exporting symbols that didn't exist when
exceptions were disabled. Note that building libc++abi without
exceptions still doesn't work when linking against the default-provided
libSystem.dylib, because it transitively depends on libobjc.dylib,
and that requires __gxx_personality_v0. But building libc++abi
with exceptions and libc++ without exceptions does work.
2020-04-20 10:45:14 -04:00
Louis Dionne 5eb8d45ab5 [libc++] Use proper shell escaping in the executors
This was originally committed as f8452ddfcc and reverted in 7cb1aa9d93.
The issue was that shell builtins were being escaped too, and apparently
Bash won't execute a builtin when it is quoted e.g. '!'. Instead, it
thinks it's a command and it can't find it.

Re-committing the change with that issue fixed.
2020-04-18 11:22:42 -04:00
Luís Marques 60ce987bf3 [RISCV][PowerPC] Fix google/benchmark benchmark::cycleclock::Now
Cherrypick the upstream fix commit a77d5f7 onto llvm/utils/benchmark
and libcxx/utils/google-benchmark.
This fixes LLVM's 32-bit RISC-V compilation, and the issues
mentioned in https://github.com/google/benchmark/pull/955
An additional cherrypick of ecc1685 fixes some minor formatting
issues introduced by the preceding commit.

Differential Revision: https://reviews.llvm.org/D78084
2020-04-18 09:32:19 +01:00
Louis Dionne 7cb1aa9d93 Revert "[libc++] Use proper shell escaping in the executors"
This reverts f8452ddfcc, which broke some bots. I'll figure out what's
wrong and commit it again.
2020-04-17 17:06:52 -04:00
Louis Dionne f8452ddfcc [libc++] Use proper shell escaping in the executors 2020-04-17 16:46:43 -04:00
Louis Dionne 7d4546e3cf [libc++] Split features for platform detection into its own function
This will allow refactoring how the locales are figured out more easily.
2020-04-17 14:46:36 -04:00
Louis Dionne a7e15b0626 [libc++] List the set of __config_site macros used for features
Instead of creating Lit features for all __config_site macros automatically,
only do so for macros that generate features actually used in the test
suite. This makes it easier to know which ones are supported by the test
suite at a glance.

Note that the `libcpp-abi-version-vN` is dropped altogether, but it
wasn't used anywhere.
2020-04-17 12:23:17 -04:00
Louis Dionne a8e4b7a550 [libc++] NFC: Rename Lit feature for no RTTI to -fno-rtti 2020-04-17 10:37:14 -04:00
Louis Dionne 9a39d5a2ec [libc++] Move .fail.cpp tests with verify-support to .verify.cpp 2020-04-17 09:05:28 -04:00
Louis Dionne 68587af9ad [libc++] Move handling of convenience substitutions outside of config.py
These substitutions are strongly tied to the operation of the test
format, so it makes sense to have them defined by the test format
instead of the Lit configuration. They should be defined regardless
of which configuration is in use.
2020-04-16 17:30:09 -04:00
Dan Albert 75c4408653 Reland: Don't expose unavailable cstdio functions.
Marked unsupported for C++03 and C++11 since this test uses alias
declarations, and at least one C++03 bot was failing with
-Wc++11-extensions.

Change-Id: I8c3a579edd7eb83e0bc74e85d116b68f22400161
2020-04-16 12:51:08 -07:00
Louis Dionne 548d501082 [libc++] NFC: Reindent impossible to read conditional in __config 2020-04-16 15:02:03 -04:00
Louis Dionne 8079f8a7e8 [libc++] Simplify conditional in __config for _LIBCPP_NO_RTTI
We don't support GCC's older than 5.x anymore.
2020-04-16 12:51:30 -04:00
Louis Dionne ebd90232fb [libc++] Support arbitrary .sh.X extensions in the new format
This allows writing all kinds of ShTests, for example .sh.py tests for
testing Python code.
2020-04-16 09:55:03 -04:00
Louis Dionne e98c2733d2 [libc++] Remove the ability to run using the internal Lit shell
The new format requires using an external shell, and as we transition
and we can simplify config.py as we transition to the new format. Also,
frankly, I'd be quite surprised if that setting was still working anyway
because we have several .sh.cpp tests that likely don't work in Lit's
internal shell.
2020-04-15 15:37:41 -04:00
Louis Dionne 3fbc9c7b51 [libc++] Add a new target check-cxx-deps to build dependencies of the test suite
When running the tests through `lit` directly instead of through `check-cxx`,
it is required to manually build the `cxx` (and often `cxx_experimental`)
targets. Instead of having to do that manually, this commit adds a new
target `check-cxx-deps` that does that for you.
2020-04-15 15:11:27 -04:00
Louis Dionne 91f110f50e [libc++] Adjust XFAIL markup for modules tests on single-threaded systems
When building these tests without modules in the whole test suite,
the __config_site macro definitions are not included anymore in the
%{compile_flags}. This causes the _LIBCPP_HAS_NO_THREADS define not
to be picked up, and the test to XPASS on single-threaded systems.

This is a stop-gap measure to fix the build bots, however the proper
solution would be to always pass the __config_site defines as compiler
macros, whether we build with modules or not.
2020-04-15 14:28:07 -04:00
Louis Dionne e87c46b162 [libc++] Remove the need for the %{build_module} substitution
Instead of using .sh.cpp tests for the modules tests, use .compile.pass.cpp
and add the -fmodules additional flag.
2020-04-15 13:01:26 -04:00
Louis Dionne 2bed2facdb [libc++] NFC: Remove the %{compile} substitution, which is not used anymore 2020-04-15 12:43:35 -04:00
Louis Dionne 40515b19b0 [libc++] Split up tests for <stdint.h> on AIX and make them AIX-independent
Avoid using <sys/types.h> in those tests so that we can run them on
non-AIX systems (otherwise this test is basically dead-code on all
the build bots I'm aware of). Also, split up the test to allow using
.compile.pass.cpp tests instead of .sh.cpp tests, since that is the
last test referencing the %{compile} substitution explicitly.
2020-04-15 12:43:35 -04:00
Louis Dionne 1a7c6b23fc [libc++] Move some .sh.cpp tests to .compile.pass.cpp
As a fly-by fix, improve/fix the comments explaining the tests. This is
a step towards removing references to the %{compile} substitution.
2020-04-15 12:27:49 -04:00
Louis Dionne 1348b53c63 [libc++] Move aligned allocation tests to .verify.cpp
Instead of being ShTests that use clang-verify (and without the proper
REQUIRES annotation), create .verify.cpp tests instead with the right
REQUIRES annotation.
2020-04-15 12:04:55 -04:00
Louis Dionne 7a6aaf9b23 [libc++] Remove workaround for .fail.cpp tests that don't have clang-verify markup
By renaming .fail.cpp tests that don't need clang-verify to .compile.fail.cpp,
the new test format will not try to compile these tests with clang-verify,
and the old test format will work just the same. However, this allows
removing a workaround that requires parsing each test looking for
clang-verify markup.

After this change, a .fail.cpp test should always have clang-verify markup.
When clang-verify is not supported by the compiler, we will just check that
these tests fail to compile. When clang-verify is supported, these tests
will be compiled with clang-verify whether they have markup or not (so
they should have markup, or they will fail).

This simplifies the test suite and also ensures that all of our .fail.cpp
tests provide clang-verify markup. If it's impossible for a test to have
clang-verify markup, it can be moved to a .compile.fail.cpp test, which
are unconditionally just checked for compilation failure.
2020-04-15 10:53:37 -04:00
Louis Dionne ec442f0996 [libc++] run.py: Create directory hierarchy if it does not exist
This is useful when replaying tests after the fact and the directories
don't exist anymore.
2020-04-14 16:20:58 -04:00
Louis Dionne 509cbc2a8d [libc++] CI: Allow pointing to specific dylib roots during backdeployment testing
This can be useful when the CI jobs don't have internet access.
2020-04-14 15:09:48 -04:00
Louis Dionne 35bbf3bb71 [libc++] Add .verify.cpp tests to the new format
With this patch, .verify.cpp tests explicitly require clang-verify, but
no other test types require clang-verify out of the box. This will allow
making several .fail.cpp tests that don't have any clang-verify markup
to be just .compile.fail.cpp tests, which in turn should allow removing
a long standing workaround that requires parsing tests to detect whether
they have any clang-verify markup in them.
2020-04-14 14:49:51 -04:00
Louis Dionne d58107c3bf [libc++] Remove support for .fail.mm tests
There are no such tests in the libc++ test suite, and I want to move
away from `.fail.cpp` tests (in favour of something else) too, which
require a workaround.
2020-04-14 12:20:23 -04:00
Louis Dionne 80aea8e4a8 [libc++] Simplify how with_system_cxx_lib and availability features are defined
Instead of spamming a bunch of available features that are not actually
used anywhere, only set those that are actually used in the test suite.
In the future, this should probably be based on the target triple only,
with the ability to have wildcards in the triple.
2020-04-14 08:28:05 -04:00
Louis Dionne 025641342b [libc++] NFC: Minor cleanups in config.py
Remove mentions of the ValgrindExecutor, which doesn't exist. That
executor is literally nowhere in the code base, so this is dead code
as far as we're concerned.

Also, inline a one-liner function that was called exactly once.
2020-04-14 08:28:05 -04:00
Louis Dionne 961914eeb9 [libc++] Mark test failing with macos < 10.13 as unsupported 2020-04-13 17:39:05 -04:00
Louis Dionne 9d8c22587b [libc++] NFC: Remove unused Lit features in the test suite
The libc++ test suite currently defines several features that are not
used anywhere in the tests, or that are redundant with other features.
For the purpose of simplifying config.py and to ease the bring up of a
new configuration, this commit removes some of these features:

- rename dylib-has-no-filesystem to c++filesystem-disabled, which exists
- rename apple-darwin to just darwin, which is already set
- remove useless setting of libstdc++, which is already set correctly
- remove libcpp-abi-unstable, which is not used anywhere
- remove the glibc-XXX features, which are not used anywhere
2020-04-13 17:19:00 -04:00
Louis Dionne 4537ba4978 [libc++] NFC: Remove unused method call 2020-04-13 16:59:54 -04:00
Casey Carter 470eb62d7b [libc++][test] Silence "unused variable" warning 2020-04-11 11:40:16 -07:00
Martijn Vels 7ba045a430 Make basic_string::operator=() tail call properly
Summary: We discovered that the compiler may chose not to inline the operator=, which leads to an expensive extra stack frame. This change makes __assign_no_alias always tail called.

Reviewers: EricWF, #libc!

Subscribers: libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D77913
2020-04-10 19:41:46 -04:00
Louis Dionne 7149bb7068 [libc++] NFC: Clean up a lot of old Lit features
The libc++ test suite has a lot of old Lit features used to XFAIL tests
and mark them as UNSUPPORTED. Many of them are to workaround problems on
old compilers or old platforms. As time goes by, it is good to go and
clean those up to simplify the configuration of the test suite, and also
to reflect the testing reality. It's not useful to have markup that gives
the impression that e.g. clang-3.3 is supported, when we don't really
test on it anymore (and hence several new tests probably don't have the
necessary markup on them).
2020-04-10 17:20:29 -04:00
Louis Dionne 13d07bf437 [libc++] NFC: Fix typo in Lit feature (C++14 with a capital C) 2020-04-10 16:12:01 -04:00
Eric Fiselier c6eb584c64 [libc++] Fix recursive instantiation in std::array.
The use of the `&& ...` fold expression in std::array's deduction guides
recursively builds a set of binary operator expressions of depth N where
`N` is the number of elements in the initializer.

This is problematic because arrays may be large, and instantiation
depth is limited.

This patch addresses the issue by flattening the SFINAE using
the existing `__all` type trait.
2020-04-09 17:42:10 -04:00
Louis Dionne 77b46fb326 [libc++/abi] Add scripts for building libc++ and libc++abi on Apple platforms
These scripts allow creating dylibs that are very close to the dylibs
shipped on Apple platforms.
2020-04-09 12:58:54 -04:00
Eric Fiselier bf90b8fc25 [libc++] Fix failing concepts tests 2020-04-08 18:25:07 -04:00
Eric Fiselier 601f763182 [libcxx] Adds [concept.same]
Patch from Christopher Di Bella (cjdb@google.com)
Reviewed as https://reviews.llvm.org/D74291

Adds `std::same_as` to libc++. Since there aren't clang-format rules for
//requires-expressions//, I'll need to disable the formatter in certain areas.
2020-04-08 18:00:13 -04:00
Louis Dionne eceae25f6d [libc++] CI: Always build for both i386 and x86_64 in the back-deployment script 2020-04-08 16:11:20 -04:00
Louis Dionne 82bec93181 [libc++] Update the documentation for running Lit to reflect reality
Our documentation for running LIT is basically wrong, since it doesn't
mention `llvm-lit`, and nothing works without it. Note that this
documentation improvement reflects the current reality outside of
the recent efforts on improving the test suite. My goal is to document
the current way of running the test suite, so that everybody agrees on
how things currently work. As the configuration system for libc++ gets
simplified, we can come back and keep this documentation up to date to
reflect those changes.

Differential Revision: https://reviews.llvm.org/D77673
2020-04-08 15:04:16 -04:00
zoecarver b25ec45809 Fix __is_pointer builtin type trait to work with Objective-C pointer types.
Summary: 5ade17e broke __is_pointer for Objective-C pointer types. This patch fixes the builtin and re-applies the change to type_traits.

Tags: #clang, #libc

Differential Revision: https://reviews.llvm.org/D77519
2020-04-08 10:02:53 -07:00
zoecarver 7a0dc1a9e7 [libc++] Remove std::optional from ObjC is_scalar test.
std::optional requires C++17. Instead of only running the test above
C++14, this commit removes uses of std::optional from the test (it's
already tested in block.objc.pass.mm).
2020-04-08 09:44:49 -07:00
Louis Dionne f3bf25eb66 [libc++] Explicitly specify that we use libc++abi in Apple's cache 2020-04-08 09:04:39 -04:00
Dan Albert 0b43db5202 Reset more globalMemCounters.
Reviewers: EricWF, #libc

Reviewed By: EricWF, #libc

Subscribers: broadwaylamb, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D77681
2020-04-07 16:40:22 -07:00
Dan Albert 50280c1895 Revert "Don't expose unavailable cstdio functions."
Broke builders that emit different diagnostics. e.g.:

error: 'warning' diagnostics seen but not expected:
  Line 13: alias declarations are a C++11 extension
  Line 20: alias declarations are a C++11 extension

This reverts commit ff87813715.
2020-04-07 15:36:44 -07:00
Dan Albert ff87813715 Don't expose unavailable cstdio functions.
Summary: These aren't available on Android in all configurations.

Reviewers: EricWF, mclow.lists, #libc, ldionne

Reviewed By: EricWF, #libc, ldionne

Subscribers: broadwaylamb, dexonsmith, ldionne, krytarowski, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D76093
2020-04-07 15:02:30 -07:00
Louis Dionne a092e3833b [libc++] Remove the %{not} substitution
It has never been used, and it actually doesn't really work because it
assumes that the target supports Python. Instead, it's better to just
use `!` since we're running ShTests in system shells anyway.
2020-04-07 17:12:37 -04:00
Louis Dionne 3fefda6e57 [libc++] Run tests in a directory related to %t instead of /tmp
Instead of creating a temporary directory inside /tmp and running the
tests there, use a directory name based on LIT's %t substitution. This
has the benefit of not hitting /tmp so much (which is slow on some
filesystems). It also has the benefit that `ninja -C build clean` will
automatically remove the artifacts even if a test somehow failed to
remove its temporary directory (I've seen this happen when CTRL-C is
received).
2020-04-07 16:09:52 -04:00
Louis Dionne f8b6529218 [libc++] Translate MODULES_DEFINES annotations to ADDITIONAL_COMPILE_FLAGS
This allows both the old and the new testing formats to handle these
tests with modules enabled.

We also include the modules flags in the %{flags} substitution, which
means that .sh.cpp tests in the old format and all tests in the new
format will use modules flags when enabled.
2020-04-07 14:40:49 -04:00
Louis Dionne f75ebe1ab3 [libc++] Support .sh.s tests in the new format
libc++abi has two of these tests.
2020-04-07 09:13:21 -04:00
Louis Dionne 9949cfbd05 [libc++] Make sure the source file appears before link libraries when compiling tests
Otherwise, files don't link when using a GNU linker, which is more
sensitive on the order of the source file relative to the various
linked libraries. See http://c-faq.com/lib/libsearch.html for an
explanation of the problem.
2020-04-07 08:58:40 -04:00
Louis Dionne 276d2b78ce [libc++] 2/N: Enable the new libc++ testing format by default
Both test formats are equivalent, so this *should* not be a problem.
We've fixed a couple of failures uncovered by the first time we tried
making the switch, so this new attempt should go even farther.

If failures are noticed, it should be fine to revert this commit, but
please give a heads up afterwards so we know to address the issues!

Also note that it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit for the time being.
2020-04-06 18:35:17 -04:00
Louis Dionne bcf14f375e [libc++] Only support std::to_chars availability test when back-deploying 2020-04-06 18:09:34 -04:00
Louis Dionne 46c3876188 [libc++] Add availability markup for the C++20 Synchronization Library on Apple 2020-04-06 18:07:26 -04:00
Dan Albert cbf1904a3e Upstream Bionic definitions of ctype_base/regex.
Summary:
This is a patch that Android has been carrying in its tree for several
years. This patch upstreams the existing ABI.

There's some historical cruft here. __regex_word used to be a part of
regex_traits rather than ctype_base. Bionic also used to use its own
ctype implementation because the libc++ builtin one wasn't available
yet. Bionic's ctype masks were 8 bits wide and already saturated, so a
wider type needed to be used for the regex mask, and the existing
value was already used so Android needed to specify its own.

Since then Android has migrated to the builtin ctype implementation
and this patch probably should have been dropped then. Unfortunately
that was not noticed at the time, so now we need to keep this to
maintain the current ABI.

Reviewers: EricWF, #libc, ldionne

Reviewed By: #libc, ldionne

Subscribers: dexonsmith, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D76171
2020-04-06 13:38:16 -07:00
Louis Dionne 8a42bf24ae [lit] Move the recursiveExpansionLimit setting to TestingConfig
The LitConfig is shared across the whole test suite. However, since
enabling recursive expansion can be a breaking change for some test
suites, it's important to confine the setting to test suites that
enable it explicitly.

Note that other issues were raised with the way recursiveExpansionLimit
operates. However, this commit simply moves the setting to the right
place -- the mechanism by which it works can be improved independently.

Differential Revision: https://reviews.llvm.org/D77415
2020-04-06 13:58:00 -04:00
Louis Dionne 267273563d [libc++] Make sure we execute tests with the current environment
The new libc++ test format doesn't automatically do this (cause it
would be the wrong place to do it).
2020-04-06 13:38:11 -04:00
Louis Dionne 7662ad67c5 [libc++] Mark two std::timed_mutex tests as flaky 2020-04-06 12:41:10 -04:00
Louis Dionne 2c1c4777a5 [libc++] Always use -fsyntax-only in .fail.cpp tests
We had a workaround because GCC 5 does not evaluate static assertions
that are dependent on template parameters. This commit removes the
workaround and marks the corresponding tests as unsupported with GCC 5.
This has the benefit of bringing the new and the old test formats closer
without having to carry a workaround for an old compiler in the new
test format.
2020-04-06 11:38:45 -04:00
Louis Dionne 4e52944ef1 [libc++] Make sure we include %{flags} when building with the new format
Otherwise, we're missing some flags like the flags that are used by
sanitizer builds and the 32-bit builds. In the long term, I think it
would be better to have only %{compile_flags} and %{link_flags}, but
for the benefit of adopting the new format by default, I think it's OK
to add %{flags} to it.
2020-04-06 11:24:04 -04:00
Louis Dionne 38e0720474 [libc++] Mark is_scalar test as unsupported in C++11 and C++14
That test requires std::optional. We never noticed that because our
test format was skipping Objective-C++ tests altogether.
2020-04-06 11:23:36 -04:00
Louis Dionne b00a874b7c [libc++] SSH: Fix tarring of dependencies on Windows
On Windows, we must make sure to close the temporary tar file before we
try to scp it.

This is an alternative approach to https://reviews.llvm.org/D77500.
2020-04-06 09:58:08 -04:00
Sergej Jaskiewicz a41cd6bb89 [libc++] [test] Add missing FILE_DEPENDENCIES to align.pass.sh.cpp
Differential Revision: https://reviews.llvm.org/D77541
2020-04-06 09:13:16 -04:00
David Zarzycki 168503773d Revert "[libc++] Enable the new libc++ testing format by default"
This reverts commit 1580c76c4a.

This causes libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp to
fail with a linker error on Fedora 31 (x86-64) release (no assert)
builds.
2020-04-05 07:16:47 -04:00
Louis Dionne 1580c76c4a [libc++] Enable the new libc++ testing format by default
Both test formats are equivalent, so this *should* not be a problem.
However, I'm taking advantage of the week-end to test this and see if
there are any failures. If so, it should be fine to revert this until
the failures have been addressed.

For the time being, it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit.
2020-04-04 16:57:16 -04:00
Brian Gesiak 54176d1766 libcxx 'LLVM_USE_SANITIZER=Address;Undefined'
Summary:
Allow users to simultaneously enable address and undefined behavior
sanitizers, in the same manner that LLVM's 'HandleLLVMOptions.cmake'
allows.

Prior to this patch, `cmake -DLLVM_USE_SANITIZER="Address;Undefined"`
would succeed and the build would build most of the LLVM project with
`-fsanitize=address,undefined`, but a warning would be printed by
libcxx's CMake, and the build would use neither sanitizer. This
patch results in no warning being printed, and both sanitizers are used
in building libcxx.

Reviewers: jroelofs, EricWF, ldionne, #libc!

Subscribers: mgorny, dexonsmith, llvm-commits, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D77466
2020-04-04 16:28:41 -04:00
Eric Fiselier 62f3a9650a [libc++] Attempt to workaround module invalidation bug 2020-04-04 03:18:01 -04:00