Commit Graph

7397 Commits

Author SHA1 Message Date
Markus Böck 6359049c35 [CMake][runtimes] Add file level dependency to merge_archives commands
Both libc++ and libc++abi have options of merging with another archive. In the case of libc++abi, libunwind can be merged into it and in the case of libc++, libc++abi can be merged into it.

This is realized using add_custom_command with POST_BUILD and the usage of the CMake generator expression TARGET_LINKER_FILE in the arguments. For such generator expressions CMake doc states: "This target-level dependency does NOT add a file-level dependency that would cause the custom command to re-run whenever the executable is recompiled" [1]

This patch adds a DEPENDS argument to both add_custom_command invocations so that the archives also have a file-level dependency on the target they are merging with. That way, changes in say, libunwind source code, will be updated in the libc++abi and/or libc++ static libraries as well.

[1] https://cmake.org/cmake/help/v3.20/command/add_custom_command.html

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

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

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

Reviewed By: ldionne, Quuxplusone, #libc, Mordante

Differential Revision: https://reviews.llvm.org/D97904
2021-03-18 17:08:10 +00:00
Martin Storsjö 6718ce4037 [libcxx] [docs] Fix formatting of inline verbatim snippets in the Windows section
Use double backticks instead of single, as single backticks produces
italic formatting.
2021-03-17 11:41:45 +02:00
Martin Storsjö 42d653d294 [libcxx] Simplify rounding of durations in win32 __libcpp_thread_sleep_for
Also fix a comment typo, and remove a superfluous "std::" qualififcation
in __libcpp_semaphore_wait_timed for consistency.

This mirrors what was suggested in review of
1773eec692.

Differential Revision: https://reviews.llvm.org/D98015
2021-03-17 10:09:10 +02:00
Arthur O'Dwyer 0aa637b203 [libc++] Improve src/filesystem's formatting of paths.
This is my attempt to merge D98077 (bugfix the format strings for
Windows paths, which use wchar_t not char)
and D96986 (replace C++ variadic templates with C-style varargs so that
`__attribute__((format(printf)))` can be applied, for better safety)
and D98065 (remove an unused function overload).

The one intentional functional change here is in `__create_what`.
It now prints path1 and path2 in square-brackets _and_ double-quotes,
rather than just square-brackets. Prior to this patch, it would
print either path double-quoted if-and-only-if it was the empty
string. Now the double-quotes are always present. I doubt anybody's
code is relying on the current format, right?

Differential Revision: https://reviews.llvm.org/D98097
2021-03-16 15:00:36 -04:00
Tomas Matheson 64595f9b84 [libcxx][type_traits] add tests for is_signed and is_unsigned
In previous versions of clang, __is_signed and __is_unsigned builtins did not
correspond to is_signed and is_unsigned behaviour for enums.  The builtins were
fixed in D67897 and D98104.

* Disable the fast path of is_unsigned for clang versions < 13

* Add more tests for is_signed, is_unsigned and is_arithmetic

Differential Revision: https://reviews.llvm.org/D97283
2021-03-16 16:36:10 +00:00
Martin Storsjö b5e228fc00 [libcxx] [test] Fix the temp_directory_path test for windows
Check a different set of env vars, don't check the exact value
of the fallback path. (GetTempPath falls back to returning the Windows
folder if nothing better is available in env vars.)

The test still fails one check on windows (due to relying on perms::none),
which will be addressed separately.

Differential Revision: https://reviews.llvm.org/D98139
2021-03-15 19:24:56 +02:00
Martin Storsjö d07e5c23b4 [libcxx] [test] Fix the get_temp_file_name() function for mingw
Add the missing includes for getting the defines and functions used
in the mingw version of get_temp_file_name().

This fixes 31 tests when built in a mingw configuration.

Also remove a redundant ifdef; _WIN32 is defined in mingw targets too.

Differential Revision: https://reviews.llvm.org/D97456
2021-03-15 18:52:49 +02:00
Martin Storsjö f5f3a59837 [libcxx] [test] Disable some allocation checks in class.path tests on windows
On windows, the path internal representation is wchar_t, and
input/output often goes through utf8 inbetween, which causes extra
allocations.

MS STL also fails a number of strict allocation checks, so this
shouldn't be a standards compliance issue.

Differential Revision: https://reviews.llvm.org/D98398
2021-03-15 18:52:48 +02:00
Martin Storsjö 995a128f07 [libcxx] [docs] Update docs about how to build for Windows
Refresh the existing paragraphs on building in MSVC configurations,
add a sample of one working configuration for MinGW, and add more
details on what's necessary to run the tests these days.

Differential Revision: https://reviews.llvm.org/D97166
2021-03-15 17:30:26 +02:00
Muiez Ahmed 62705ee012 [SystemZ][z/OS] Define _LIBCPP_ELAST
The aim is to define _LIBCPP_ELAST for z/OS libc++ since strerror/strerror_r can't handle out-of-range errno values.

Differential Revision: https://reviews.llvm.org/D98541
2021-03-15 09:23:36 -04:00
Muiez Ahmed febbf68b42 [SystemZ][z/OS] Missing wchar functions libc++
The aim is to add the missing z/OS specific implementations for mbsnrtowcs and wcsnrtombs, as part of libc++.

Differential Revision: https://reviews.llvm.org/D98207
2021-03-12 15:39:31 -05:00
Christopher Di Bella 8d4af1b6e0 [libcxx] adds concept std::regular
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D97911

Reviewed By: EricWF, #libc, Quuxplusone

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

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

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

Reviewed By: #libc, curdeius, Mordante

Differential Revision: https://reviews.llvm.org/D98019
2021-03-12 09:47:07 +00:00
Christopher Di Bella 154395536e [libcxx] adds concept std::semiregular
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D97443

Reviewed By: Quuxplusone, EricWF, #libc

Differential Revision: https://reviews.llvm.org/D97911
2021-03-11 22:40:07 -08:00
Christopher Di Bella 8ef69c66d5 [libcxx] adds concept std::copyable
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D97359

Reviewed By: EricWF, #libc, Quuxplusone, zoecarver

Differential Revision: https://reviews.llvm.org/D97443
2021-03-11 19:30:55 -08:00
Christopher Di Bella dc9f385722 [libcxx] adds concept std::movable
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D97162

Reviewed By: EricWF, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D97359
2021-03-11 19:27:43 -08:00
Marek Kurdej e9ba25b59d [libc++] [docs] Add link to clang status page for C++2b and fix anchor for C++20. 2021-03-11 20:49:14 +01:00
Martin Storsjö e69c65d5c4 [libcxx] Test accessing a directory on windows that gives "access denied" errors
Fix handling of skip_permission_denied on windows; after converting
the return value of GetLastError() to a standard error_code, ec.value()
is in the standard errc range, not a native windows error code. This
was missed in 156180727d.

The directory "C:\System Volume Information" does seem to exist and
have these properties on most relevant contempory setups.

Differential Revision: https://reviews.llvm.org/D98166
2021-03-11 21:07:29 +02:00
Martin Storsjö 8ba05e1489 [libcxx] [test] Disable a test regarding error behaviour for excessively long paths on windows
Checking for the existence of an invalid long path name isn't
an error in itself on windows.

Differential Revision: https://reviews.llvm.org/D98141
2021-03-11 20:21:54 +02:00
Martin Storsjö 49173ca4db [libcxx] Avoid intermediate string objects for substrings in windows operator/=
Check that appends with a path object doesn't do allocations, even
on windows.

Suggested by Marek in D98398. The patch might apply without D98398
(depending on how much of the diff context has to match), but doesn't
make much sense until after that patch has landed.

Differential Revision: https://reviews.llvm.org/D98412
2021-03-11 19:34:59 +02:00
Martin Storsjö cb2648e6f0 [libcxx] [test] Use a string_view of the native path type in the concat test
This makes sure that no extra allocations happen on windows, fixing
earlier errors in the DisableAllocationGuard (in the second case that
is modified).

This is split out from D98398.

Differential Revision: https://reviews.llvm.org/D98406
2021-03-11 19:34:58 +02:00
Aditya Kumar 6976255faf Add noreturn attribute to non-returning functions
Differential Revision: https://reviews.llvm.org/D97308
2021-03-10 14:35:50 -08:00
Martin Storsjö e23317c9da [libcxx] [test] Adjust separator form in fs.op.absolute for libc++ on windows
This test was previously tweaked in
321f696920 to match the output of
of MS STL (except that the MS STL fails on the testcase with an
empty path).

libc++ doesn't produce paths with all normalized separators (and the
spec doesn't mandate it to either).

Tweak the test reference to match exactly what libc++ produces. If
testing with a non-libc++ library, do a relaxed comparison that allows
the separators to differ.

Differential Revision: https://reviews.llvm.org/D98215
2021-03-09 16:57:26 +02:00
Muiez Ahmed ebe6161c54 [SystemZ][z/OS] Missing locale functions libc++
The aim is to add the missing z/OS specific locale functions for libc++ (newlocale, freelocale and uselocale).

Reviewed By: ldionne, #libc, curdeius

Differential Revision: https://reviews.llvm.org/D98044
2021-03-08 19:32:33 +00:00
Martin Storsjö b9f169fb7d [libcxx] Document windows specifics regarding file_type and perms. NFC.
This was requested in the review of D98138.

Differential Revision: https://reviews.llvm.org/D98155
2021-03-08 15:27:07 +02:00
Arthur O'Dwyer ab49f50ad0 [libc++] Fix typos in the synopsis of bit_xor, bit_not, etc. NFC. 2021-03-07 20:22:50 -05:00
Martin Storsjö 3a11a41795 [libcxx] [test] Don't test CharFile (/dev/null) on windows
Also clarify a nearby comment regarding block devices.

Differential Revision: https://reviews.llvm.org/D98138
2021-03-07 23:26:41 +02:00
Martin Storsjö 52c5f5ad5f [libcxx] [test] Fix building create_directory in MSVC configurations
Don't use the mode_t type - the official windows sdk doesn't have that type.
(Mingw headers does have such a typedef though.) The umask function returns
int on windows, in both header variants.

Thus just use auto to deduce the umask return type automatically.

Differential Revision: https://reviews.llvm.org/D98140
2021-03-07 23:26:41 +02:00
Martin Storsjö 4d571cf4e9 [libcxx] [test] Clarify and improve consistency in lexically_relative_and_proximate.pass.cpp. NFC.
Use "expect" instead of "output" for generating "proximate_expected",
pass the arguments to PathEq in the same order as above, rename the
"proximate_expected" variable to be consistent with the naming of the
earlier "expect", use .empty() instead of .native().empty().

Differential Revision: https://reviews.llvm.org/D98127
2021-03-07 23:15:05 +02:00
Martin Storsjö ab67fd39fc [libcxx] [test] Fix path.modifiers remove_filename and replace_filename for windows
Also fix the synopsis in the replace_filename test, while touching
that file.

Differential Revision: https://reviews.llvm.org/D98108
2021-03-07 10:37:13 +02:00
Martin Storsjö d601edf0b0 [libcxx] [test] Fix lexically_normal and lexically_relative_and_proximate for windows
Convert the expected result path to preferred separators, add exceptions
to the test results where needed (due to some cases being interpreted
as a root name).

Differential Revision: https://reviews.llvm.org/D98106
2021-03-06 22:42:38 +02:00
Martin Storsjö 15fdd536f9 [libcxx] [test] Fix path.itr/iterator.pass.cpp for windows
Differential Revision: https://reviews.llvm.org/D98107
2021-03-06 19:27:14 +02:00
David Zarzycki f4059cc352 Partially revert "[runtimes] Use add_lit_testsuite to register lit testsuites"
This partially reverts commit e1173c8794
until we find out why libcxx tests are failing under runtimes build.
2021-03-06 06:06:55 -05:00
Martin Storsjö 714644a36c [libcxx] [test] Move the is_<platform> functions down to subclasses
If cross testing (and manually specifying a LIBCXX_TARGET_INFO in the
cmake configuration, as the default is to match the build platform),
we want the accessors for querying the target platform, is_windows,
is_darwin, to return the right value depending on which target info
class is used, not based on what platform is running the build and
driving the tests.

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

Differential Revision: https://reviews.llvm.org/D98045
2021-03-06 08:52:34 +02:00
Christopher Di Bella c744332793 [libcxx] adds std::ranges::swap, std::swappable, and std::swappable_with
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D96742

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

Differential Revision: https://reviews.llvm.org/D98026
2021-03-06 00:49:26 +02:00
Martin Storsjö 1540646dbd [libcxx] Don't add -Wall when building in MSVC mode
The MSVC -Wall (or /Wall) option maps (in clang-cl) to the GCC style
option -Weverything, which we don't really want. Instead use -W4 which
is the corresponding MSVC option.

This silences the build with clang-cl, which previously used to
output 100 warnings per translation unit.

Differential Revision: https://reviews.llvm.org/D98035
2021-03-05 23:48:02 +02:00
Martin Storsjö 24a176b107 [libcxx] Apply pragma for silencing warning when building with clang-cl too
This silences warnings about unused functions (in an anonymous
namespace).

Differential Revision: https://reviews.llvm.org/D98036
2021-03-05 21:36:54 +02:00
Petr Hosek e1173c8794 [runtimes] Use add_lit_testsuite to register lit testsuites
The runtimes build uses variables set by add_lit_testsuite to collect
testsuites from all the runtimes.

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

Differential Revision: https://reviews.llvm.org/D98028
2021-03-05 19:37:31 +02:00
Martin Storsjö 1adaf48d23 [libcxx] [test] Fix path.decompose for windows
Add ifdefs to the test reference tables for cases where paths are
interpreted differently (paths that contain a root name).

Fix test assumptions regarding has_root_name() and is_absolute() and
add logic to verify the results of is_absolute() for the test cases in
the table.

Also add a testcase for the path "//net/", which seemed like an
omission.

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

Reviewed By: ldionne, Mordante, #libc

Differential Revision: https://reviews.llvm.org/D97365
2021-03-05 10:31:21 +01:00
Martin Storsjö 29012ce986 [libcxx] Map ERROR_BAD_PATHNAME to errc::no_such_file_or_directory on windows
Opening a path like \\server (without a trailing share name and
path) produces this error, while opening e.g. \\server\share
(for a nonexistent server/share) produces ERROR_BAD_NETPATH (which
already is mapped).

This happens in some testcases (in fs.op.proximate); as proximate()
calls weakly_canonical() on the inputs, weakly_canonical() checks
whether the path exists or not. When the error code wasn't recognized
(it mapped to errc::invalid_argument), the stat operation wasn't
conclusive and weakly_canonical() errored out. With the proper error
code mapping, this isn't considered an error, just a nonexistent
path, and weakly_canonical() can proceed.

This roughly matches what MS STL does - it doesn't have
ERROR_BAD_PATHNAME in its error code mapping table, but it
checks for this error code specifically in the return of their
correspondence of the stat function.

Differential Revision: https://reviews.llvm.org/D97619
2021-03-05 10:49:03 +02:00
Martin Storsjö 99c7b53294 [libcxx] Avoid infinite recursion in create_directories, if the root directory doesn't exist
Differential Revision: https://reviews.llvm.org/D97618
2021-03-05 10:49:01 +02:00
Martin Storsjö 1773eec692 [libcxx] Implement semaphores for windows
Also add WIN32_LEAN_AND_MEAN before including windows.h, for consistency
with other sources.

Differential Revision: https://reviews.llvm.org/D97539
2021-03-05 10:48:59 +02:00
Christopher Di Bella 6eb5d55c55 [libcxx] fixes up some [concepts]-related code
* moves `std::copy_constructible` so it comes before
  `std::equality_comparable_with`
* replaces a few uses of `auto`
2021-03-04 22:09:43 -08:00
Christopher Di Bella e63ddcccf8 [libcxx] adds concepts std::equality_comparable[_with]
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D96660

Reviewed By: ldionne, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D97176
2021-03-04 18:24:04 -08:00
Martin Storsjö 53d7c63657 [libcxx] [test] Use separate references for windows in the path.append test
Differential Revision: https://reviews.llvm.org/D89945
2021-03-04 23:21:02 +02:00
Louis Dionne c7f244b897 [libc++] Properly pick up the Ninja from Xcode in the CI script 2021-03-04 16:03:39 -05:00
Muiez Ahmed 53c8587dcd [SystemZ][z/OS] Missing non-posix functions libc++
The aim is to add missing non-posix functions for z/OS libc++ (strtod_l and strtof_l).

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D97051
2021-03-04 15:23:21 +00:00
David Spickett 6e5342a6b0 [libcxx] Move Linaro AArch64 buildbots to buildkite
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D96267
2021-03-04 10:22:17 +00:00
Martin Storsjö c793f68d9b [libcxx] Don't use dllimport for a static member in a template
This fixes clang warnings (that are treated as errors when running
the test suite):

libcxx/include/string:4409:59: error: definition of dllimport static field [-Werror,-Wdllimport-static-field-def]
               basic_string<_CharT, _Traits, _Allocator>::npos;

The warning is normally not visible as long as the libc++ headers
are treated as system headers.

The same construct is always an error in MSVC.

(One _LIBCPP_FUNC_VIS was added in
2d8f23f571, which broke DLL builds.
59919c4d6b fixed this by adding another
_LIBCPP_FUNC_VIS on the declaration for consistency, but the underlying
issue remained, that one can't use dllimport here.)

Differential Revision: https://reviews.llvm.org/D97168
2021-03-04 08:55:27 +02:00
Christopher Di Bella 647af31e74 [libcxx] adds concept `std::assignable_from`
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D96660

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D96742
2021-03-03 22:41:55 -08:00
Christopher Di Bella f893312c1a [libcxx] adds concept `std::common_with`
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D96660

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D96683
2021-03-03 20:01:11 -08:00
Arthur O'Dwyer 09fa1d0e50 [libc++] Introduce __identity_t<T>. NFCI.
This is just a shorter synonym for `__identity<T>::type`.
Use it consistently throughout, where possible.

There is still some metaprogramming in <memory> and <variant>
where `__identity` is being used _without_ immediately calling
`::type` on it; but this is the unusual case, and it will become
even less usual as we start deliberately protecting certain types
against deduction (e.g. D97742).

Differential Revision: https://reviews.llvm.org/D97862
2021-03-03 22:23:14 -05:00
Christopher Di Bella 3f5438c46c [libcxx] adds concept `std::common_reference_with`
Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D96657

Reviewed By: ldionne, Mordante, #libc

Differential Revision: https://reviews.llvm.org/D96660
2021-03-03 17:52:41 -08:00
Louis Dionne 460953ad9a [libc++] Temporary hack: disable Apple back-deployment testing
Apple back-deployment testing is currently failing because Green Dragon
is down. To avoid stalling the whole CI pipeline because of that, I am
temporarily disabling those jobs until Green Dragon is back, or even
better we have found a different way to store those small artifacts.
2021-03-03 17:02:48 -05:00
Louis Dionne 3c62198c61 [libc++] NFC: Normalize links to bug reports 2021-03-03 13:45:29 -05:00
Louis Dionne 5034d7115d [libc++] Use generator expression to simplify the CMake code
A comment was left for when we would require CMake >= 3, which we do now.
I expect this should be a NFC.

Differential Revision: https://reviews.llvm.org/D97341
2021-03-03 12:59:51 -05:00
Louis Dionne 5601305fb3 [libc++/abi] Replace uses of _NOEXCEPT in src/ by noexcept
We always build the libraries in a Standard mode that supports noexcept,
so there's no need to use the _NOEXCEPT macro.

Differential Revision: https://reviews.llvm.org/D97700
2021-03-03 12:57:31 -05:00
zoecarver 84a50f5911 [libc++] Add bind_front function (P0356R5).
Implementes [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0356r5.html | P0356R5 ]]. Adds `bind_front` to `functional`.

Reviewed By: ldionne, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D60368
2021-03-02 16:18:06 -08:00
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