Commit Graph

7282 Commits

Author SHA1 Message Date
Christopher Di Bella eadece333f [libcxx] adds common_reference to <type_traits>
Implements part of P0898R3 Standard Library Concepts

Reworks D74351 to use requires-clauses over SFINAE and so that it more
closely follows the wording.

Co-authored by: Michael Schellenberger Costa <mschellenbergercosta@googlemail.com>

(Michael did all the heavy lifting and I came in to polish it for
 submission, since Michael is focussing on `std::format` now.)

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D96657
2021-03-02 22:33:37 +00: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
Martin Storsjö c5e8f024dc [libcxx] Explicitly return the expected error code in create_directories if the parent isn't a directory
On windows, going ahead and actually trying to create the directory
doesn't return an error code that maps to
std::errc::not_a_directory in this case.

This fixes two cases of
    TEST_CHECK(ErrorIs(ec, std::errc::not_a_directory))
in filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
for windows (in testcases added in 59c72a7012).

Differential Revision: https://reviews.llvm.org/D97090
2021-03-02 22:21:29 +02:00
Martin Storsjö 4adb4bca05 [libcxx] [test] Fix a test error with condvars with trivial destruction
If the destructor is trivial (_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION,
the constructor always is), the compiler warns about the
std::condition_variable being unused.

Add a cast to void to silence the warning about the object being unused.

Differential Revision: https://reviews.llvm.org/D97540
2021-03-02 20:34:22 +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
Martin Storsjö 74c883f7e5 [libcxx] [test] Use the native path types in path.compare
This makes sure that it actually tests the right compare() overloads
in windows configurations.

This also fixes the allocation guards that enforce no allocations
while running the compare() functions.

Differential Revision: https://reviews.llvm.org/D97551
2021-03-01 21:01:46 +02: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
Marek Kurdej 11ef785cdd [libc++] [docs] [C++2b] Update status page with issues (and forgotten papers) adopted in November 2020 and February 2021 virtual meetings.
Sources:
* https://github.com/cplusplus/draft/pull/4380 (November 2020)
* https://github.com/cplusplus/draft/pull/4523 (February 2021)
* https://github.com/cplusplus/draft/issues?q=is%3Aissue+LWG+Motion
2021-03-01 11:19:18 +01:00
Vitaly Buka 3744ba24dc [NFC][libc++] Suppress "warning: ignoring return value"
According to the comment on the next line
it's expected behaviour.
2021-02-26 14:32:54 -08:00
Casey Carter 30cd3dd0fb [libcxx][test] Don't require Container<cv T> extension on non-libc++
... when testing `default_initializable`. Also, include `<memory>` for `unique_ptr`.
2021-02-26 13:40:22 -08: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 27f9ed7850 [libc++] Make the from-scratch config work on macOS out-of-the-box 2021-02-26 13:11:49 -05: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ö c7d46f221e [libcxx] Use the allocating form of getcwd() on Glibc and Apple platforms
This avoids having to query pathconf for a max size for
preallocating a buffer for the return value.

This is an extension to the POSIX getcwd() spec.

Differential Revision: https://reviews.llvm.org/D97460
2021-02-26 00:14:12 +02: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ö 3be7968c36 [libcxx] [test] Ifdef out uses of create_fifo on windows
Restructure code in directory_entry.obs/file_type_obs.pass.cpp
and directory_entry.obs/hard_link_count.pass.cpp to reduce the
amount of ifdeffery needed.

In file_type_obs.pass.cpp, we can't inline the calls to
env.create_* into the lambda calls (e.g. "test_path(env.create_*())"),
because the lambda removes the referenced file, and the hardlink
must be created while the earlier test file exists.

In hard_link_count.pass.cpp, move restoration of the original
directory permissions to the end of the lambda, so that new
directory entries can be created after the lambda has run once.

Differential Revision: https://reviews.llvm.org/D89948
2021-02-26 00:10:47 +02:00
Martin Storsjö f15377084c [libcxx] [test] Use string().c_str() to convert a std::filesystem::path to a const char*
On Windows, path::value_type is wchar_t, so one can't pass the return
value of path::c_str() directly to std::remove().

This matches what was done for tests under std/input.output/filesystems
in 81db3c31aa and
3784bdf217.

Differential Revision: https://reviews.llvm.org/D97458
2021-02-26 00:10:47 +02:00
Louis Dionne 618862e89a [libc++] Fix incorrect forwarding in tuple's assignment operator
Also, add a bunch of tests for tuple and pair's assignment operators
involving reference types.

Differential Revision: https://reviews.llvm.org/D97419
2021-02-25 14:56:16 -05:00
Martin Storsjö c218c80c73 [libcxx] [test] Quote the path to the python interpreter
This should allow running tests with the interpreter in some of the
default paths where Python for Windows might be installed.

Differential Revision: https://reviews.llvm.org/D97369
2021-02-24 22:24:41 +02:00
Louis Dionne 5f5416e1c4 [libc++] NFC: Fix a few tests in tuple that would succeed trivially 2021-02-24 11:33:41 -05:00
Louis Dionne 4814985dec [libc++] NFC: Fix a few tests in pair that would succeed trivially 2021-02-24 11:25:45 -05: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
Marek Kurdej 77bd454da3 [libc++] [docs] [C++2b] Update status page with papers adopted in February 2021 virtual meeting. 2021-02-24 09:40:33 +01: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
Mark de Wever c61e511f38 [NFC][libc++] Fix _LIBCPP_HAS_BITSCAN64 usage.
Seems line was accidentally left in
llvm-svn: 290924 86eebc5b65

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D97211
2021-02-23 08:13:49 +01:00
Louis Dionne a0839b14df [libc++] Fix tuple assignment from types derived from a tuple-like
The implementation of tuple's constructors and assignment operators
currently diverges from the way the Standard specifies them, which leads
to subtle cases where the behavior is not as specified. In particular, a
class derived from a tuple-like type (e.g. pair) can't be assigned to a
tuple with corresponding members, when it should. This commit re-implements
the assignment operators (BUT NOT THE CONSTRUCTORS) in a way much closer
to the specification to get rid of this bug. Most of the tests have been
stolen from Eric's patch https://reviews.llvm.org/D27606.

As a fly-by improvement, tests for noexcept correctness have been added
to all overloads of operator=. We should tackle the same issue for the
tuple constructors in a future patch - I'm just trying to make progress
on fixing this long-standing bug.

PR17550
rdar://15837420

Differential Revision: https://reviews.llvm.org/D50106
2021-02-22 14:52:18 -05:00
Martin Storsjö 3d6ca4b8dc [libcxx] [test] Call create_directory_symlink when linking directories
This makes the symlinks work properly on windows.

A similar round of cleanup was done in
c41bda7f5f, but these tests were
added after that.

Differential Revision: https://reviews.llvm.org/D97089
2021-02-21 00:25:54 +02:00
Martin Storsjö 26005c788b [libcxx] Make path::format a non-class enum
The spec doesn't declare it as an enum class, and being declared
as an enum class breaks referring to the values as e.g.
path::auto_format.

Differential Revision: https://reviews.llvm.org/D97084
2021-02-21 00:25:54 +02:00
Mark de Wever 84dbcdd5ff [libc++] Fix the build for AppleClang.
Forgot to add some parts of D93593, this should disable the tests on
Apple. Seems Louis was right ;-)
2021-02-20 13:54:46 +01:00
Martin Storsjö 7b5f0050a9 [libcxx] [test] Remove two unnecesary files/variables in a test
These don't seem to have any function in the test.

The non_regular_file one seems to have been added in
0f8c8f59df, without any apparent
purpose there.

Differential Revision: https://reviews.llvm.org/D97083
2021-02-20 10:20:12 +02:00
Martin Storsjö 8c305a5d82 [libcxx] Rename a method in PathParser for clarity. NFC.
Differential Revision: https://reviews.llvm.org/D97081
2021-02-20 10:20:11 +02:00
Mark de Wever 1a5c92f680 [libc++] Fixes _LIBCPP_HAS_NO_CONCEPTS
Before the define was in a GCC specific part. Now it's available for all
compilers. The patch had its CI run in D93593.
2021-02-20 09:13:16 +01:00
zoecarver 6c75a84ce7 [libc++][nfc] Only test if pair is_assignable after C++03.
In C++03 libc++ uses a different set of constructors which aren't
constrained, so these tests won't work. This should fix the bots.

Refs: 82c4701.
2021-02-19 15:14:44 -08:00
Martin Storsjö 99fc4a6584 [libcxx] Enable filesystem by default for mingw targets
This feature can be built successfully for windows now. However,
the helper functions for __int128_t aren't available in MSVC
configurations, so don't enable it by default there yet. (See
https://reviews.llvm.org/D91139 for discussion on how to proceed
with things in MSVC environments.)

Differential Revision: https://reviews.llvm.org/D97075
2021-02-20 01:09:10 +02:00
zoecarver 82c4701d4e [libc++][nfc] SFINAE on pair/tuple assignment operators: LWG 2729.
This patch ensures that SFINAE is used to delete assignment operators in pair and tuple based on issue 2729.

Differential Review: https://reviews.llvm.org/D62454
2021-02-19 13:25:34 -08:00
Martin Storsjö f4f5fb9151 [libcxx] Make generic_*string return paths with forward slashes on windows
This matches what MS STL returns; in std::filesystem, forward slashes
are considered generic dir separators that are valid on all platforms.

Differential Revision: https://reviews.llvm.org/D91181
2021-02-19 21:49:51 +02:00
zoecarver dbc89028d7 [libcxx] Fix LWG 2875: shared_ptr::shared_ptr(Y*, D, […]) constructors should be constrained.
Fixes LWG issue 2875.

Differential Revision: https://reviews.llvm.org/D81414
2021-02-19 11:11:39 -08:00
Martin Storsjö 513463fd26 [libcxx] Have lexically_normal return the path with preferred separators
Differential Revision: https://reviews.llvm.org/D91179
2021-02-19 21:06:54 +02:00
Marek Kurdej bcb5a124ae [libc++] Turn off clang-format for auto-generated version header. NFC. 2021-02-19 17:26:16 +01:00
zoecarver 6a328c66d3 [libc++] shared_ptr deleter requirements (LWG 2802).
This patch implements 2802. Requires _Deleter to have call operator and be move constructible. Based on D62233.

Refs PR37637.

Differential Revision: https://reviews.llvm.org/D62274
2021-02-18 21:31:07 -08:00
zoecarver 82b82b9430 Mark 2534 as Complete.
c90dee1 fixed LWG 1203 which supresses LWG 2534 as well.

Refs D62889.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D96885
2021-02-18 21:28:49 -08:00
Christopher Di Bella 9f4f6ac94b [libcxx] adds concept `std::uniform_random_bit_generator`
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Differential Revision: https://reviews.llvm.org/D96577
2021-02-19 01:47:29 +00:00
Joerg Sonnenberger a77e918016 libcxx: use early returns
Differential Revision: https://reviews.llvm.org/D96955
2021-02-18 19:43:14 +01:00
Nico Weber 9d36f70ef2 libcxx: fix a documentation typo
See `grep 'option.LIBCXX_INCLUDE_TESTS' libcxx/CMakeLists.txt`.
2021-02-18 11:59:51 -05:00
Zbigniew Sarbinowski 25aa0d1244 [SystemZ][ZOS] Guard using declaration for ::fchmodat
The use of fchmodat() is beeing guarded but its using declaration is not. Let's use the same guard in both places to avoid compiler errors on platforms where `fchmodat` does not exist.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D96303
2021-02-18 15:01:04 +00:00
Martin Storsjö 78d693faec [libcxx] Implement append and operator/ properly for windows
The root_path function has to be changed to return the parsed bit
as-is; otherwise a path like "//net" gets a root path of "//net/", as
the root name, "//net", gets the root directory (an empty string) appended,
forming "//net/". (The same doesn't happen for the root dir "c:" though.)

Differential Revision: https://reviews.llvm.org/D91178
2021-02-18 09:03:53 +02:00
Martin Storsjö 8a783e6845 [libcxx] Implement is_absolute properly for windows
Differential Revision: https://reviews.llvm.org/D91177
2021-02-17 19:33:05 +02:00
Louis Dionne 642048eea0 [libc++] Allow retries in a few more flaky tests 2021-02-17 11:20:40 -05:00
Martin Storsjö 929f0bcc24 [libcxx] Implement parsing of root_name for paths on windows
Differential Revision: https://reviews.llvm.org/D91176
2021-02-17 15:45:31 +02:00
Zbigniew Sarbinowski 5f9be2c3e3 [SystemZ][ZOS] Prefer -nostdlib++ as opposed to -nodefaultlibs when building c++ libraries
Let's use -nostdlib++ rather than -nodefaultlibs when building libc++/libc++abi/libunwind libraries. The default is -nostdlib++ if supported by a build compiler like it is the case with clang, otherwise -nodefaultlibs is used as before.

This change is needed to avoid additional changes at the link step and not to increase the maintenance costs. If clang with -nodefaultlibs is used all the libraries which are removed but required would have to be manually added in. This set of libraries are unique and will send out.

The propose change will allow to make the link step simple for other platforms as well.

Reviewed By: #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D95875
2021-02-16 18:42:14 +00:00
Colin Finck 0f5020af7f [libc++] Build thread_win32.cpp only if LIBCXX_HAS_PTHREAD_API is not set
This allows building libc++ against winpthreads from mingw-w64 to support
operating systems older than Windows 7. The remaining libc++ code already
supports `WIN32` with `LIBCXX_HAS_PTHREAD_API`.

Note that there is also the older "pthreads-win32". However, that support
library implements `pthread_t` as a struct, which violates the libc++
assumption that `pthread_t` is always a scalar and can be compared,
ordered, and set to zero.

Differential Revision: https://reviews.llvm.org/D96339
2021-02-16 10:03:42 -05:00
Arthur O'Dwyer 5f58374bbe [libc++] Change `std::numeric_limits` to just `numeric_limits` in <chrono>.
The namespace is unnecessary, and libc++ style is not to include it on type names.
(As opposed to function names, where qualification affects ADL; and in certain
function signatures where `std::` and `_VSTD::` might be mangled differently.
This is none of those situations.)
2021-02-15 16:12:10 -05:00
Louis Dionne 5d0d465ad4 [libc++] Mark __cpp_lib_constexpr_memory as being implemented 2021-02-15 15:26:53 -05:00
Dimitry Andric 328261019f Define new/delete in libc++ when using libcxxrt
Always turn on LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS, if libcxxrt is used
as the C++ ABI library, since libcxxrt does not provide the full set
ofnew and delete operators. In particular, the aligned versions of these
operators are completely missing. This primarily addresses builds on
FreeBSD, as this platform uses libcxxrt by default.

Also, attempt to provide a FreeBSD.cmake cache file, with hopefully sane
settings, partially copied from the Apple.cmake cache file. This needs
more work, probably some additions to ci build scripts (although I am
not aware of any 'official' FreeBSD build bots).

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D96720
2021-02-15 21:22:12 +01:00
Zbigniew Sarbinowski 48fcce1aea [SystemZ][ZOS] Fix __libcpp_thrad_isnull()
Previous pthread revision https://reviews.llvm.org/D91875 missed a small change for `__libcpp_thrad_isnull()` required for z/OS.

Reviewed By: zibi

Differential Revision: https://reviews.llvm.org/D96302
2021-02-12 20:21:11 +00:00
Zbigniew Sarbinowski cb2d2ae56a [SystemZ][ZOS] Provide CLOCK_MONOTONIC alternative
We need CLOCK_MONOTONIC equivalent implementation for z/OS within libc++. The default implementation is asserting.

On z/OS the lack of  'clock_gettime()' and 'time_point()' force us to look for alternatives.
The current proposal is to use `gettimeofday()` for CLOCK_MONOTONIC  which is also used in CLOCK_REALTIME.  This will allow us to skip the assertion with compromised CLOCK_MONOTONIC implementation which will not guarantee to never go back in time because it will use `gettimeofday()` but only when it's set.

Is this a good compromise for platforms which does not support monotonic clock?
Hopefully this will spark the discussion and agreement how to proceed in this situation.

Reviewed By: #libc, ldionne, hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D93542
2021-02-12 18:39:48 +00:00
Mark de Wever f8772da8cc [libc++][format] Enable format_error on older compilers.
It seems like modifying the header doesn't cause libc++ to be rebuild.
So the breakage of the previous commit didn't happen on my system.

This should fix the build of https://buildkite.com/mlir/mlir-core
2021-02-11 19:11:20 +01:00
Mark de Wever af83e89ae3 [libc++][format] Improve Add basic_format_parse_context.
Add an additional guard to prevent building on older clang versions.

This should fix the build of https://buildkite.com/mlir/mlir-core
2021-02-11 18:55:54 +01:00
Mark de Wever 38ddeade65 [libc++][format] Add basic_format_parse_context.
Implements parts of:
- P0645 Text Formatting

Depends on D92214

Reland with changes:
The format header will only be compiled if the compiler used has support
for concepts. This should fix the issues with the initial version.

Differential Revision: https://reviews.llvm.org/D93166
2021-02-11 17:57:54 +01:00
Ilya Tokar c81d52997a [libc++] Use builtins in more math.h functions.
Not using builtins doesn't always imply worse code,
but for e. g. isinf, this is 30%+ faster.

Before:
name        time/op
BM_isinf     2.14ns ± 2%

After:
name        time/op
BM_isinf     1.33ns ± 2%

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D88854
2021-02-10 15:17:42 -05:00
Christopher Di Bella 17db24a7a8 [libcxx] adds concepts `std::invocable` and `std::regular_invocable`
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Differential Revision: https://reviews.llvm.org/D96235
2021-02-10 19:35:53 +00:00
Christopher Di Bella c63de225fd [libcxx] adds concept std::derived_from
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D74292
2021-02-10 19:30:08 +00:00
Christopher Di Bella bee7b07f23 [libcxx] adds [concepts.arithmetic]
Implements parts of:
    * P0898R3 Standard Library Concepts
    * P1754 Rename concepts to standard_case for C++20, while we still can

Differential Revision: https://reviews.llvm.org/D88131
2021-02-10 19:04:57 +00:00
Louis Dionne 183b75f667 [libc++] Remove c++98 Lit features in the test suite
We don't populate a Lit feature named c++98 since 31cbe0f240.
2021-02-10 13:32:41 -05:00
Christopher Di Bella 2193e8be3e [libcxx] adds concept `std::copy_constructible`
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D96230

Differential Revision: https://reviews.llvm.org/D96232
2021-02-10 17:56:42 +00:00
Christopher Di Bella 2b2f36a8b1 [libcxx] adds concept `std::move_constructible`
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D77961

Differential Revision: https://reviews.llvm.org/D96230
2021-02-10 17:33:35 +00:00
Colin Finck ebfadd82cb [libc++] Fix copy-paste mistake in __threading_support
Differential Revision: https://reviews.llvm.org/D96115
2021-02-10 11:00:32 -05:00
Christopher Di Bella 8caf835337 [libcxx] adds concept `std::convertible_to`
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Differential Revision: https://reviews.llvm.org/D77961
2021-02-10 03:27:41 +00:00
Arthur O'Dwyer eec04092d6 [libc++] [LWG2993] reference_wrapper<T> conversion from U&&
Implement the resolution of LWG2993. Replace a deleted constructor
with a constructor that SFINAEs away in appropriate circumstances.
Also, now that the constructor is templated, we must have an
explicit deduction guide to make CTAD work.

Some tests have been merged in from Agustín Bergé's D40259.

Differential Revision: https://reviews.llvm.org/D92725
2021-02-09 15:50:25 -05:00
zoecarver dea74b2820 [libc++] Add `noexcept` to `string::find` and similar members.
Adds `noexcept` to `string_view`/`string::find` and similar members
(`rfind`, etc.). See discussion in D95251. Refs D95821.

Reviewed By: curdeius, ldionne

Differential Revision: https://reviews.llvm.org/D95848
2021-02-09 11:47:40 -08:00
Mark de Wever 171956aab3 Revert "[libc++] Require C++20 to build the benchmarks."
There are build bots without C++20 support building the benchmarks.

This reverts commit 34acc91642.
2021-02-09 19:59:34 +01:00
Mark de Wever 34acc91642 [libc++] Require C++20 to build the benchmarks.
Some work-in-progress patches for the format header contain benchmarks.
The format header requires C++20 to build. This is a preparation to make
it easy to add these benchmarks.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D96057
2021-02-09 18:34:07 +01:00
Mark de Wever 2544060e71 [libc++] Remove C++11 work-arounds in src.
Building libcxx requires at least C++17 so remove the old work-arounds.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D96200
2021-02-09 18:31:00 +01: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
Martin Storsjö d4f4e723d0 [libcxx] Implement temp_directory_path using GetTempPath on windows
This does roughly the same as the manual implementation, but checks
a slightly different set of environment variables and has a more
appropriate fallback if no environment variables are available
(/tmp isn't a very useful fallback on windows).

Differential Revision: https://reviews.llvm.org/D91175
2021-02-05 22:47:33 +02:00
Martin Storsjö 4d292d531b [libcxx] Use the posix code for directory_entry::__do_refresh
This works just fine for windows, as all the functions it calls
are implemented and wrapped for windows.

Differential Revision: https://reviews.llvm.org/D91173
2021-02-05 22:47:33 +02:00
Arthur O'Dwyer 85167fb7c2 [libc++] Further improve the contiguous-iterator story, and fix some bugs.
- Quality-of-implementation: Avoid calling __unwrap_iter in constexpr contexts.
    The user might conceivably write a contiguous iterator where normal iterator
    arithmetic is constexpr-friendly but `std::to_address(it)` isn't.

- Bugfix: When you pass contiguous iterators to `std::copy`, you should get
    back your contiguous iterator type, not a raw pointer. That means that
    libc++ can't `__unwrap_iter` unless it also does `__rewrap_iter`.
    Fortunately, this is implementable.

- Improve test coverage of the new `contiguous_iterator` test iterator.
    This catches the bug described above.

- Tests: Stop testing that we can `std::copy` //into// an `input_iterator`.
    Our test iterators may currently support that, but it seems nonsensical to me.

Differential Revision: https://reviews.llvm.org/D95983
2021-02-05 15:18:04 -05:00
zoecarver fab194898b [lic++][docs] Explain noexcept policy for narrow contracts.
Adds documentation around libc++'s policy to add noexcept to things that cannot throw but aren't marked as noexcept.

Refs LWG 3518 and D95251.

Differential Revision: https://reviews.llvm.org/D95821
2021-02-05 11:27:19 -08:00
Arthur O'Dwyer 5d9565634c Revert "Revert "[libc++] [P0879] constexpr std::nth_element, and rewrite its tests.""
This reverts commit b6ffece320.

The bug is now fixed (it was a stupid cut-and-paste kind of error),
and the regression test added. The new patch is also simpler than the old one!

Differential Revision: https://reviews.llvm.org/D96084
2021-02-05 12:02:43 -05:00
Jordan Rupprecht b6ffece320 Revert "[libc++] [P0879] constexpr std::nth_element, and rewrite its tests."
This reverts commit 207d4be4d9 due to returning incorrect results. Regression test case posted in D96074.
2021-02-04 14:03:49 -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 1700ea7302 [libc++] Remove the ability to use braced-init for filesystem paths
According to my reading of http://eel.is/c++draft/filesystems#fs.class.path,
the Standard doesn't actually mention that this should work. Since other
implementations don't allow it, allowing it in libc++ is just setting a
portability trap.

Supersedes https://reviews.llvm.org/D89865.

Differential Revision: https://reviews.llvm.org/D95975
2021-02-04 11:49:00 -05: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
Louis Dionne 85b9c5ccc1 [libc++] Fix libcxx build on 32bit architectures with 64bit time_t defaults e.g. riscv32
Patch by Khem Raj.

Differential Revision: https://reviews.llvm.org/D85095
2021-02-04 11:38:54 -05:00
Mark de Wever e275e62983 [libc++] Adds a make_string test helper function.
These function makes it easier to write generic unit tests for the
format header. It solves the issue where it's not possible to use
  `templated_prefix"foo"`
where `templated_prefix` resolves to: nothing, `L`, `u8`, `u`,
or `U`. The templated_prefix would be more faster during execution.

Reviewed By: ldionne, #libc, curdeius

Differential Revision: https://reviews.llvm.org/D93414
2021-02-04 17:16:44 +01:00
Louis Dionne b51756819a [libc++] Rename include/support to include/__support
We do ship those headers, so the directory name should not be something
that can potentially conflict with user-defined directories.

Differential Revision: https://reviews.llvm.org/D95956
2021-02-04 10:16:33 -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
Arthur O'Dwyer d41c6d51cb [libc++] Rationalize our treatment of contiguous iterators and __unwrap_iter().
- Implement C++20's changes to `reverse_iterator`, so that it won't be
    accidentally counted as a contiguous iterator in C++20 mode.
- Implement C++20's changes to `move_iterator` as well.
- `move_iterator` should not be contiguous. This fixes a bug where
    we optimized `std::copy`-of-move-iterators in an observable way.
    Add a regression test for that bugfix.
- Add libcxx tests for `__is_cpp17_contiguous_iterator` of all relevant
    standard iterator types. Particularly check that vector::iterator
    is still considered contiguous in all C++ modes, even C++03.

After this patch, there continues to be no supported way to write your
own iterator type in C++17-and-earlier such that libc++ will consider it
"contiguous"; however, we now fully support the C++20 approach (in C++20
mode only). If you want user-defined contiguous iterators in C++17-and-earlier,
libc++'s position is "please upgrade to C++20."

Differential Revision: https://reviews.llvm.org/D94807
2021-02-03 16:28:38 -05:00
Martin Storsjö cdc60a3b9a [libcxx] Implement the read_symlink function for windows
Differential Revision: https://reviews.llvm.org/D91172
2021-02-03 09:23:58 +02:00
Martin Storsjö 40117b700f [libcxx] Implement the permissions function for windows
Differential Revision: https://reviews.llvm.org/D91171
2021-02-03 09:23:24 +02:00
Martin Storsjö 83d705adb2 [libcxx] Implement the canonical function for windows
Differential Revision: https://reviews.llvm.org/D91170
2021-02-02 23:03:19 +02:00
Martin Storsjö 0c71c914fa [libcxx] Implement the current_path function for windows
Differential Revision: https://reviews.llvm.org/D91169
2021-02-02 23:03:19 +02: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
Reid Kleckner bab7486416 Disable CFI in __get_elem to allow casting a pointer to uninitialized memory
Fixes usage of shared_ptr with CFI enabled, which is llvm.org/pr48993.

Differential Revision: https://reviews.llvm.org/D95827
2021-02-02 12:39:24 -08:00
Martin Storsjö a3cc99658d [libcxx] Implement the space function for windows
Differential Revision: https://reviews.llvm.org/D91168
2021-02-02 19:48:24 +02:00
Mehdi Amini 68f66f37d7 Revert "[libc++][format] Add basic_format_parse_context."
This reverts commit 35a57f39b5.

A build is broken during clang bootstrap with:

In file included from ../libcxx/src/format.cpp:9:
/tmp/ci-nGNyLRM9V3/include/c++/v1/format:153:16: error: no member named 'is_constant_evaluated' in namespace 'std::__1'
    if (_VSTD::is_constant_evaluated() && __id >= __num_args_)
        ~~~~~~~^
1 error generated.
2021-02-01 21:18:11 +00:00
Mark de Wever 35a57f39b5 [libc++][format] Add basic_format_parse_context.
Implements parts of:
- P0645 Text Formatting

Depends on D92214

Reviewed By: ldionne, curdeius, #libc

Differential Revision: https://reviews.llvm.org/D93166
2021-02-01 20:19:20 +01:00
Mark de Wever 3ffc53ba16 [libc++] Implements concept default_initializable.
Implements:
- LWG3149 DefaultConstructible should require default initialization

Implements parts of:
 - P0898R3 Standard Library Concepts
 - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D91986

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D93461
2021-02-01 19:13:24 +01:00
Ruslan Arutyunyan c448ea948c [libc++] Fix for the Bug 41784
Add deleted volatile copy-assignment operator in the most derived atomic
to fix the Bug 41784. The root cause: there is an `operator=(T) volatile`
that has better match than the deleted copy-assignment operator of the base
class when `this` is `volatile`. The compiler sees that right operand of
the assignment operator can be converted to `T` and chooses that path
without taking into account the deleted copy-assignment operator of the
base class.

The current behavior on libstdc++ is different from what we have in libc++.
On the same test compilation fails with libstdc++. Proof: https://godbolt.org/z/nebPYd
(everything is the same except the -stdlib option).

I choose the way with explicit definition of copy-assignment for atomic
in the most derived class. But probably we can fix that by moving
`operator=(T)` overloads to the base class from both specializations.
At first glance, it shouldn't break anything.

Differential Revision: https://reviews.llvm.org/D90968
2021-02-01 10:14:22 -05:00
xgupta 94fac81fcc [Branch-Rename] Fix some links
According to the [[ https://foundation.llvm.org/docs/branch-rename/ | status of branch rename ]], the master branch of the LLVM repository is removed on 28 Jan 2021.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D95766
2021-02-01 16:43:21 +05:30
Mark de Wever 8869e2f969 [libc++] Allow building with C++17.
After committing D92214 it was noticed libc++ no longer builds with
C++17. For now reenable building with C++17. This is intended to be a
temporary measure in the future a C++20 capable compiler will be
required.
2021-01-31 14:25:01 +01:00
Casey Carter 6057517904 [libcxx][test] Silence MSVC narrowing warning 2021-01-29 11:05:52 -08:00
Casey Carter 5565092faa [libcxx][test] Silence false positive MSVC /analyze warning 2021-01-29 10:05:14 -08:00
Casey Carter 9f8ca86a87 [libcxx][test] explicitly discard bitset::test's return
... just in case some implementation annotates it `[[nodiscard]]`.
2021-01-29 10:01:51 -08:00
Martin Storsjö f65ba25cf3 [libcxx] Sanitize paths before creating symlinks on windows
The MS STL does even more cleanup (corresponding to lexically_normal
I think), but this seems to be the very minimum needed for making the
symlinks work when the target path contains non-native paths.

Differential Revision: https://reviews.llvm.org/D91145
2021-01-29 13:39:30 +02:00
Martin Storsjö efec3cc652 [libcxx] Hook up a number of operation functions to their windows counterparts
Use the corresponding wchar functions, named "_wfunc" instead of "func",
where feasible, or reimplement functions with native windows APIs.

Differential Revision: https://reviews.llvm.org/D91143
2021-01-29 13:38:45 +02:00
Martin Storsjö 592d623529 [libcxx] Implement _FilesystemClock::now() and __last_write_time for windows
Differential Revision: https://reviews.llvm.org/D91142
2021-01-29 13:38:27 +02:00
Martin Storsjö 2ff8662b5d [libcxx] Implement the stat function family on top of native windows APIs
While the windows CRTs (the modern UCRT, and the legacy msvcrt.dll
that mingw still often defaults to) do provide stat functions, they're
a bit lacking - they only provide second precision on the modification
time, lack support for symlinks and a few other details.

Instead reimplement them using a couple windows native functions,
getting exactly the info we need. (Technically, the implementation
within the CRT calls these functions anyway.)

If we only need a few fields, we could also do with fewer calls, as a
later optimization.

Differential Revision: https://reviews.llvm.org/D91141
2021-01-29 13:37:54 +02:00
Casey Carter edecee3826 [libcxx][test] move libc++-specific tests into the libcxx tree
...and rename from `version.pass.cpp` to `version.compile.pass.cpp` to follow the new convention.
2021-01-28 18:01:56 -08:00
Casey Carter ad4a6ce10c [libcxx][test] MoveOnly's comparisons are non-member
... so that comparisons with an `int` LHS and `MoveOnly` RHS are valid, as is necessary for the `partial_sort_copy` test to pass with an implementation that doesn't force a conversion to the type of the RHS as libc++ does.
2021-01-28 17:07:03 -08:00
Casey Carter 2dd0c4d846 [libcxx][test] Update directory_entry test for C++20
P1614R2 removes most of `directory_entry`'s member comparison operators, leaving only `operator==` and `operator<=>`. This test should require the comparison expressions to be valid rather than require the member functions to be present so it is correct in both C++17 and C++20 modes.
2021-01-28 09:40:54 -08:00
Mark de Wever 18fe3fe0e7 [libc++] Implements concept constructible_from
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can

Depends on: D91004

Reviewed By: ldionne, cjdb, #libc

Differential Revision: https://reviews.llvm.org/D91986
2021-01-28 18:32:47 +01: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
Arthur O'Dwyer 207d4be4d9 [libc++] [P0879] constexpr std::nth_element, and rewrite its tests.
This patch is more than just adding the `constexpr` keyword, because
the old code relied on `goto`, and `goto` is not constexpr-friendly.
Refactor to eliminate `goto`, and then mark it as constexpr in C++20.

I freely admit that the name `__nth_element_partloop` is bad;
I couldn't find any better name because I don't really know
what this loop is doing, conceptually. Vice versa, I think
`__nth_element_find_guard` has a decent name.

Now the only one we're still missing from P0879 is `sort`.

Differential Revision: https://reviews.llvm.org/D93557
2021-01-28 11:59:00 -05:00
Louis Dionne bf5941afcd [libc++] Fix extern-templates.sh.cpp test on Linux 2021-01-28 10:46:22 -05:00
Louis Dionne 90407b16b1 [libc++] Fix extern template test failing on Windows
See https://reviews.llvm.org/D94718#2521489 for details.
2021-01-27 13:08:52 -05:00
Arthur O'Dwyer 5386aa2627 [libc++] [P0879] constexpr heap and partial_sort algorithms
Now the only ones we're still missing from P0879
are `sort` and `nth_element`.

Differential Revision: https://reviews.llvm.org/D93512
2021-01-27 10:26:06 -05:00
Simon Tatham 7b3ba8dd02 [libcxx] Update include/__libcpp_version to match include/__config
https://reviews.llvm.org/rG5369517d20dd362a178a1b2d6c398d8898ee4620
bumped the version number in __config to 13000, causing a test failure
in libcxx/test/libcxx/libcpp_version.pass.cpp because now the two
don't match.

This is the only part of the post-release TODO in
libcxx/docs/Contributing.rst that wasn't done by that commit.
2021-01-27 15:16:55 +00:00
Tom Stellard 5369517d20 Bump the trunk major version to 13
and clear the release notes.
2021-01-26 19:37:55 -08:00
Arthur O'Dwyer fc3192026b [libc++] Give `MoveOnly` all six comparison operators, not just == and <.
Split out of D93512.
2021-01-26 19:42:00 -05:00
Louis Dionne 4210b87020 [libc++] Fix oss-fuzz build 2021-01-26 15:30:50 -05:00
Brad Smith 4b6d7fdd20 [libcxx] random_device, for OpenBSD specify optimal entropy properties
Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D94571
2021-01-25 20:55:09 -05:00
Arthur O'Dwyer f9b6fd269b [libc++] Support immovable return types in std::function.
LWG reflector consensus is that this was a bug in libc++.
(In particular, MSVC also will fix it in their STL, soon.)
Bug originally discovered by Logan Smith.

Also fix `std::function<const void()>`, which should work
the same way as `std::function<void()>` in terms of allowing
"conversions" from non-void types.

Differential Revision: https://reviews.llvm.org/D94452
2021-01-25 19:34:41 -05:00
Nico Weber a206d991f9 libcxx: Try to fix build after D92044 2021-01-25 15:10:41 -05:00
Ruslan Arutyunyan 9d50958757 [libc++] Fix build after 51faba35fd
Differential Revision: https://reviews.llvm.org/D95372
2021-01-25 13:40:47 -05:00
Arthur O'Dwyer f851db3dae [libc++] [P0879] constexpr std::reverse, partition, *_permutation.
After this patch, the only parts of P0879 that remain missing will be
std::nth_element, std::sort, and the heap/partial_sort algorithms.

Differential Revision: https://reviews.llvm.org/D93443
2021-01-25 13:09:30 -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
Mark de Wever 193cda105d [libc++][doc] Update the release notes.
Updates the libc++ release notes with the changes since the last
release.

Differential Revision: https://reviews.llvm.org/D95248
2021-01-25 18:32:13 +01:00
Ruslan Arutyunyan 51faba35fd [libc++] Implement P0655R1 visit<R>: Explicit Return Type for visit
Differential Revision: https://reviews.llvm.org/D92044
2021-01-25 11:14:45 -05:00
Marek Kurdej 5e7a93a954 [libc++] Set CMAKE_FOLDER. NFC.
* This variable populates the default value of FOLDER target property. It is used in some IDE's (e.g. MSVC) to group different targets together.
2021-01-25 09:51:16 +01:00
Zbigniew Sarbinowski 92bb81aac1 [SystemZ][ZOS] Provide PATH_MAX macro for libcxx
Defining PATH_MAX to _XOPEN_PATH_MAX which is the closest macro available on z/OS.
Note that this value is 1024 which is 4 times smaller from same macro on Linux.

Reviewed By: #libc, ldionne, hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D92110
2021-01-24 00:29:39 +00:00
Mark de Wever 99d5fad7a5 [libc++] Remove invalid C++20 code from a test.
During the review of D91986 it has been discovered the in C++11
deprecated `throw()` exception specification has been removed in
C++20. Removed the part of the test code using this feature.
2021-01-23 20:10:17 +01:00
Mark de Wever a8e06361dd [libc++] Implements concept destructible
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can

Reviewed By: ldionne, miscco, #libc

Differential Revision: https://reviews.llvm.org/D91004
2021-01-23 18:17:25 +01:00
Thorsten Schütt b973e2e2f2 [libc++] Introduce __bits
It has the low-level bit fiddling operations from bit. It eliminates a cyclic dependency between __bit_reference, bits, and vector. I want to exploit this in later patches.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D94908
2021-01-22 21:20:23 +01:00
Louis Dionne faa440786c [libc++] Bring back mach_absolute_time implementation of steady_clock
This is meant to unblock Chrome, as discussed in https://llvm.org/D74489.

Differential Revision: https://reviews.llvm.org/D95177
2021-01-22 14:54:16 -05:00
Mark de Wever 3317b38ef8 [NFC][libc++] Update the implementation status.
During the review of https://reviews.llvm.org/D93912 we failed to notice
the implementation status wasn't updated. This rectifies the issue.
2021-01-22 20:24:33 +01:00
Louis Dionne 03b6dc3005 [libc++] Fix broken build when merging libc++abi into libc++ on Apple 2021-01-22 12:39:40 -05:00
Brad Smith 1be2524b7d [libcxx] Check return value for asprintf()
local __libcpp_asprintf_l() -> libc asprintf() was inspecting the pointer (with
indeterminate value) for failure, rather than the return value of -1.

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D94564
2021-01-21 19:43:11 -05:00
Marek Kurdej f3b979b65e [libc++] Use ioctl when available to get random_device entropy.
Implemented the idea from D94571 to improve entropy on Linux.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D94953
2021-01-21 18:01:02 +01: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
Louis Dionne 68dba7eae1 [libc++] Unbreak the debug mode
When the Debug mode is enabled, we disable extern declarations because we
don't want to use the functions compiled in the library, which might not
have had the debug mode enabled when built. However, some extern declarations
need to be kept, because code correctness depends on it.

31e820378b removed those declarations, which had the unintended
consequence of breaking the debug build. This commit fixes that by
re-introducing a separate macro for the required extern declarations,
and adds a comment so that we don't fall into that trap in the future.

Differential Revision: https://reviews.llvm.org/D94718
2021-01-19 14:15:31 -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
Alex Richardson 077a84f911 [libc++] Sync TEST_HAS_TIMESPEC_GET and _LIBCPP_HAS_TIMESPEC_GET on FreeBSD
Commit 5e416ba943 (D71522) updated the
__config header but didn't change test_macros.h.
This fixes libcxx/language.support/has_timespec_get.compile.pass.cpp on
FreeBSD12/13.

Reviewed By: #libc, dim, ldionne

Differential Revision: https://reviews.llvm.org/D94292
2021-01-19 15:02:57 +00:00
Marek Kurdej a11f8b1ad6 [libc++] [P0935] [C++20] Eradicating unnecessarily explicit default constructors from the standard library.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0935r0.html

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D91292
2021-01-19 08:22:06 +01:00
Arthur O'Dwyer 14573d44ae Regenerate the feature test macro unit-tests. NFCI.
Somehow commit 1f1250151f added the
right code but with the wrong whitespace.
2021-01-18 19:06:28 -05:00