Commit Graph

7080 Commits

Author SHA1 Message Date
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
Louis Dionne 2cb4a96a99 [libc++] NFCI: Refactor allocator_traits
The implementation had a lot of boilerplate and was more complicated than
necessary. This NFC refactoring introduces a few macros to reduce code
duplication, and uses a consistent style and formatting for the whole file.

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

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

Differential Revision: https://reviews.llvm.org/D94530
2021-01-18 15:19:21 -05:00