Commit Graph

7971 Commits

Author SHA1 Message Date
Mark de Wever fea130cec9 [libc++][doc] Update format status.
Marked the entries solely depending on D103357 or D96664 as complete.
Initial work on implementing P2216 has started.
2021-09-04 13:31:29 +02:00
Mark de Wever df2af9936c [libc++][format] Add a CMake Unicode option.
This option is used to select between the format headers output column
width option. This option should be independent of the locale setting.
It's encouraged to default to Unicode unless the platform doesn't offer
that option.

[format.string.std]/10
```
  For the purposes of width computation, a string is assumed to be in a
  locale-independent, implementation-defined encoding. Implementations
  should use a Unicode encoding on platforms capable of displaying Unicode
```

Reviewed By: #libc, ldionne, vitaut

Differential Revision: https://reviews.llvm.org/D103379
2021-09-04 11:55:10 +02:00
Mark de Wever d7444d9f41 [libc++][format] Implement formatters.
This implements the initial version of the `std::formatter` class and its specializations. It also implements the following formatting functions:
- `format`
- `vformat`
- `format_to`
- `vformat_to`
- `format_to_n`
- `formatted_size`

All functions have a `char` and `wchar_t` version. Parsing the format-spec and
using the parsed format-spec hasn't been implemented. The code isn't optimized,
neither for speed, nor for size.

The goal is to have the rudimentary basics working, which can be used as a
basis to improve upon. The formatters used in this commit are simple stubs that
will be replaced by real formatters in later commits.

The formatters that are slated to be replaced in this patch series don't have
an availability macro to avoid merge conflicts.

Note the formatter for `bool` uses `0` and `1` instead of "false" and
"true". This will be fixed when the stub is replaced with a real
formatter.

Implements parts of:
- P0645 Text Formatting

Completes:
- LWG3539 format_to must not copy models of output_iterator<const charT&>

Reviewed By: ldionne, #libc, vitaut

Differential Revision: https://reviews.llvm.org/D96664
2021-09-04 11:41:08 +02:00
Louis Dionne fd66b44ec1 [libc++] Add an assertion in the subrange constructors with a size hint
Those constructors are very easy to misuse -- one could easily think that
the size passed to the constructor is the size of the range to exhibit
from the subrange. Instead, it's a size hint and it's UB to get it wrong.
Hence, when it's cheap to compute the real size of the range, it's cheap
to make sure that the user didn't get it wrong.

Differential Revision: https://reviews.llvm.org/D108827
2021-09-03 16:04:02 -04:00
Amy Kwan 217c6d6431 [libc++][NFC] Mark values in gdb pretty print comparison functions as live to prevent values being optimized out.
It appears when testing LLVM 13 on Power, we run into failures with the
`libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp` test case optimizing
values out.

Despite some the functions in the test already being marked with optnone,
adding the `MarkAsLive()` calls inside of the pretty printer comparison functions
resolves the issues of the values being optimized out.

This patch aims to address https://llvm.org/PR51675.

Differential Revision: https://reviews.llvm.org/D109204
2021-09-03 14:55:25 -04:00
Louis Dionne c137a0754c [libc++] Remove _LIBCPP_HAS_NO_LONG_LONG in favour of using_if_exists
_LIBCPP_HAS_NO_LONG_LONG was only defined on FreeBSD. Instead, use the
using_if_exists attribute to skip over declarations that are not available
on the base system. Note that there's an annoying limitation that we can't
conditionally define a function based on whether the base system provides
a function, so for example we still need preprocessor logic to define the
abs() and div() overloads.

Differential Revision: https://reviews.llvm.org/D108630
2021-09-03 14:26:59 -04:00
Louis Dionne ef2cdfe393 [libc++][NFC] Remove uses of 'using namespace std;' in the test suite
Differential Revision: https://reviews.llvm.org/D109120
2021-09-03 13:15:10 -04:00
Arthur O'Dwyer d1e50738d7 [libc++] Define insert_iterator::iter with ranges::iterator_t.
The `insert_iterator::iter` member is defined as `Container::iterator` but
the standard requires `iter` to be defined in terms of `ranges::iterator_t` as
of C++20. So, if in C++20 or later, define the `iter` member as
`ranges::iterator_t`.

Original patch by Joe Loser!

Differential Revision: https://reviews.llvm.org/D108575
2021-09-02 16:15:53 -04:00
Mark de Wever 803141c7a7 [libc++] Remove an unused internal concept.
Removed as suggested by @Quuxplusone during the review of D109075.
2021-09-02 19:27:49 +02:00
Mark de Wever 1637921134 [libc++][NFC] Move concepts to a subheader.
D103357 added some new concepts. Since the header `<concepts>` has moved
all its concepts to a separate header these new concepts feel out of
place. Move them to the appropriate header.

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D109075
2021-09-02 19:22:15 +02:00
Louis Dionne c8439e9a80 [libc++][docs] Remove "Last Updated" entries from the docs
Those don't provide a lot of value, and they can easily be wrong anyway.

Differential Revision: https://reviews.llvm.org/D109087
2021-09-02 13:02:49 -04:00
Louis Dionne 9d7c420ad1 [libc++][NFC] Replace uses of stdr:: by just std::ranges::
Differential Revision: https://reviews.llvm.org/D109121
2021-09-02 13:02:12 -04:00
Mark de Wever 67794e784e [libc++][nfc] Fixes ppc64le-sanitizer build issue.
After landing D103357 the worker ppc64le-sanitizer fails on `__bool`.
This replaces all occurrences with `__boolean`.
2021-09-02 08:13:59 +02:00
Mark de Wever 0922ce56f4 [libc++][format] Add __format_arg_store.
This implements the struct `__format_arg_store` and its dependencies:
* the class basic_format_arg,
* the class basic_format_args,
* the class basic_format_context,
* the function make_format_args,
* the function wmake_format_args,
* the function visit_format_arg,
* several Standard required typedefs.

The following parts will be implemented in a later patch:

* the child class `basic_format_arg::handle`,
* the function `basic_format_arg::basic_format_arg(const T* p)`.

The following extension has been implemented:
* the class basic_format_arg supports `__[u]int128_t` on platform where libc++ supports 128 bit integrals.

Implements parts of:
* P0645 Text Formatting

Completes:
* LWG3371 visit_format_arg and make_format_args are not hidden friends
* LWG3542 basic_format_arg mishandles basic_string_view with custom traits

Note https://mordante.github.io/blog/2021/06/05/format.html gives a bit more information about the goals and non-goals of this initial patch series.

Reviewed By: #libc, ldionne, vitaut

Differential Revision: https://reviews.llvm.org/D103357
2021-09-01 19:45:02 +02:00
Louis Dionne a4cb5aefd5 [libc++] Remove some workarounds for unsupported GCC and Clang versions
There is a lot more we can do, in particular in <type_traits>, but this
removes some workarounds that were gated on checking a specific compiler
version.

Differential Revision: https://reviews.llvm.org/D108923
2021-09-01 10:57:14 -04:00
Louis Dionne 9d7ae0acde [libc++][NFC] Correct comment about P0600 missing node_handle bits
Differential Revision: https://reviews.llvm.org/D109027
2021-09-01 10:51:55 -04:00
Louis Dionne 3557c7c122 [libc++] Remove workarounds for [[nodebug]] not working properly on typedefs in older Clangs
Clang used to support [[nodebug]] everywhere except on typedefs. Since
we don't support such old Clangs anymore, we can get rid of _LIBCPP_NODEBUG_TYPE
in favour of always using _LIBCPP_NODEBUG.

Differential Revision: https://reviews.llvm.org/D108996
2021-09-01 10:51:09 -04:00
Louis Dionne 8f9cc3bc29 [libc++][NFC] Use std::enable_if instead of _EnableB helper in pair
This doesn't impact the compile-time efficiency, but we get better
diagnostics when an overload is disabled.
2021-09-01 10:48:09 -04:00
Joe Loser 2d400db63c
[libcxx] contiguous iterator concept: don't require pointer or complete element types
`contiguous_iterator` requires the iterator type passed is either a
pointer type or that the element type of the iterator is a complete
object type. These constraints are not part of the current wording in
defining the `contiguous_iterator` concept - adjust the concept to
reflect this.

Inspired from discussion at https://reviews.llvm.org/D108645.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D108855
2021-09-01 08:32:41 -04:00
Joe Loser 2498f8fd76
[libcxx][docs] Remove completed issues from TODO.TXT
Remove tasks listed that refer to papers or issues that are marked complete in
`libcxx/docs/Status/Cxx17Papers.csv` or `libcxx/docs/Status/Cxx17Issues.csv`

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D108856
2021-09-01 08:22:23 -04:00
Joe Loser f76bdb9b82
[libcxx][docs] Mark LWG3356 as complete
Feature test macro for `__cpp_lib_is_nothrow_convertible` was introduced in
466df1718e but the LWG issue was not marked as
`Complete` in the docs. Also, fix the formatting of `Complete` for
LWG 3348.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D108964
2021-09-01 08:20:03 -04:00
Louis Dionne 1c9b7d0ecc [libc++][NFC] Remove redundant friend declaration for operator==
This must have been meant to be friend-declaring operator!=, but it
turns out that it's not even necessary to make it a friend since it
does not access any private state.

rdar://82568613
2021-08-31 17:02:58 -04:00
Louis Dionne 928cad59c7 [libc++][NFC] Rename _LIBCPP_NODISCARD_ATTRIBUTE to _LIBCPP_NODISCARD
Differential Revision: https://reviews.llvm.org/D108940
2021-08-31 16:06:31 -04:00
Louis Dionne e781e03e40 [libc++] Remove workaround for broken __is_trivially_copyable on old GCC
All supported versions of GCC now do the right thing.

Differential Revision: https://reviews.llvm.org/D108997
2021-08-31 16:05:29 -04:00
Arthur O'Dwyer c5e7981aec [libc++] Add missing space in (__map_value_compare&__y) etc. NFCI. 2021-08-31 14:30:20 -04:00
Joe Loser 167b2dbde4
[libcxx][docs] Mark LWG3153 as complete
Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D108967
2021-08-31 13:54:10 -04:00
Mark de Wever e983a659e5 [libc++][NFC] split <charconv>.
This move the helper types `chars_format`, `to_chars_result` and
`from_chars_result` to a separate header. The first two are needed for
D70631 the third for consistency.

The header `__charconv/ryu.h` uses these types and it can't depend on the
types in `<charconv>` in a modular build. Moving them to the ryu header
would be an odd place and doesn't work since the header is included in the
middle of `<charconv>`.

Reviewed By: #libc, ldionne, Quuxplusone

Differential Revision: https://reviews.llvm.org/D108927
2021-08-31 18:45:19 +02:00
Louis Dionne e79474d337 [libc++][NFC] Add missing HIDE_FROM_ABI on implementation detail __launder 2021-08-31 10:29:29 -04:00
Xiang Xiao 3285c7a436 [libcxx] Remove the locale fallback for NuttX
Since these functions can handled by NuttX's libc now

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D108895
2021-08-31 09:46:55 -04:00
Fangrui Song daf0dfb786 [libc++] Support -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on in CI
This fixes -isystem/-L/-Wl,-rpath paths when -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on
is used (https://reviews.llvm.org/D107799#2969650).

* `-isystem path/to/build/generic-cxx17/include/c++/v1`. `build/generic-cxx17/include/x86_64-unknown-linux-gnu/c++/v1 (__config_site)` is missing.
* `-L path/to/build/generic-cxx17/lib`. Should be `build/generic-cxx17/lib/x86_64-unknown-linux-gnu` instead

Reviewed By: ldionne, phosek, #libc

Differential Revision: https://reviews.llvm.org/D108836
2021-08-30 12:59:08 -07:00
Joe Loser 7d7765cef5 [libcxx][docs] Mark LWG3348 as complete
Mark LWG3348 as complete. The `__cpp_lib_unwrap_ref` feature test macro
was placed in `<functional>` in 466df1718e

Differential Revision: https://reviews.llvm.org/D108920
2021-08-30 13:03:57 -04:00
Louis Dionne 770602cfa0 [libc++] Various cleanups in the ranges tests
- Rename test files to follow conventions better
- Split constructor tests that were in a single file
- Add missing tests for take_view and transform_view's default constructors
- Add missing tests for transform_view's view/function constructor
- Fix include guards
- Mark some tests as being specific to libc++

Differential Revision: https://reviews.llvm.org/D108829
2021-08-30 12:46:32 -04:00
Sizhe Zhao 3ec634e65a [libcxx] Use GetSystemTimePreciseAsFileTime() if available
We will try to use GetSystemTimePreciseAsFileTime if possible.
Reference: 59195b2d7f/.

Reviewed By: compnerd, #libc, mstorsjo, ldionne

Differential Revision: https://reviews.llvm.org/D104987
2021-08-27 20:11:29 +03:00
Louis Dionne c8b14c03ec [libc++][NFC] Fix include guard for decay_copy.h and remove underscores from the header
We don't use double underscores for private header names when they are
in a subdirectory with double underscores already.

Differential Revision: https://reviews.llvm.org/D108820
2021-08-27 12:45:53 -04:00
Louis Dionne 64184b4af0 [libc++][NFC] Remove useless _LIBCPP_PUSH_MACROS
Only files that actually use min/max are required to do this dance.

Differential Revision: https://reviews.llvm.org/D108778
2021-08-27 12:41:55 -04:00
Louis Dionne b91365e0f1 [libc++][NFC] Remove unused helper function in the test suite 2021-08-27 11:47:33 -04:00
Joe Loser 51414d9982 [libc++][NFC] Remove extra __ranges/take_view.h entry in CMakeLists.txt
Differential Revision: https://reviews.llvm.org/D108802
2021-08-27 10:08:33 -04:00
Louis Dionne 19e806e88d [libc++][NFC] Sort headers alphabetically 2021-08-26 14:18:09 -04:00
Louis Dionne ee44dd8062 [libc++] Implement the underlying mechanism for range adaptors
This patch implements the underlying mechanism for range adaptors. It
does so based on http://wg21.link/p2387, even though that paper hasn't
been adopted yet. In the future, if p2387 is adopted, it would suffice
to rename `__bind_back` to `std::bind_back` and `__range_adaptor_closure`
to `std::range_adaptor_closure` to implement that paper by the spec.

Differential Revision: https://reviews.llvm.org/D107098
2021-08-26 14:07:21 -04:00
Louis Dionne a4357bc496 [libc++] Fix incorrect bypassing of <wctype.h>
Differential Revision: https://reviews.llvm.org/D108709
2021-08-26 13:26:31 -04:00
Louis Dionne f640c31e4b [libc++] XFAIL align.pass.cpp for PowerPC LE
This patch XFAILs the `align.pass.cpp` for PowerPC (LE).

It appears that this test will fail on Power for the `LLIArr2` and `Padding` structs within the test,
as the `assert` for `alignof(AtomicImpl) >= sizeof(AtomicImpl)` will be false. In this case, these structs
presumably should not be lock-free, so we currently XFAIL this for now.

The failure was discovered after D97913 was committed. It looks like `alignof(AtomicImpl) < sizeof(AtomicImpl)`,
even prior to this commit, but this test began running on Power after D97913, whereas we were
not running `align.pass.cpp` before.

This patch addresses https://bugs.llvm.org/show_bug.cgi?id=51548 by temporarily XFAILing the test
in order to investigate it further.

Differential Revision: https://reviews.llvm.org/D108668
2021-08-26 13:21:40 -04:00
Arthur O'Dwyer 15acca5ccd [libc++] Revert a use of `static_cast` for `_VSTD::forward`. NFCI.
As requested in D107584.

Differential Revision: https://reviews.llvm.org/D108743
2021-08-26 11:35:07 -04:00
Joe Loser 231cf0e881 [libc++][NFC] Fix typo in test/support/test_range.h
Fix typo in `#error` filepath.

Differential Revision: https://reviews.llvm.org/D108764
2021-08-26 10:34:50 -04:00
Kent Ross 3fe7dde5f1 [libc++][doc] Cleanup, normalize, and update projects status docs
Mark the now-done [cmp.result] in spaceship projects as complete;
normalize some status markers for papers and projects; fix alignment
and line breaks in spaceship projects, add links to standard

Differential Revision: https://reviews.llvm.org/D108502
2021-08-26 10:33:52 -04:00
Kent Ross 5d993d3bc5 [libc++][doc] Repair files with CRLF line endings.
These are the only files in libc++ that have CRLF line endings instead of LF.

Differential Revision: https://reviews.llvm.org/D108748
2021-08-26 10:09:07 -04:00
Dimitry Andric 18da6db838 [libc++][NFC] Remove duplicate ranges entry in CMakeLists.txt.
The second entry got added accidentally as part of 5a3309f825.

Reviewed By: cjdb

Differential Revision: https://reviews.llvm.org/D108726
2021-08-25 23:49:43 +02:00
Louis Dionne 77b32055ec [libc++] Assume that compilers support extended constexpr in C++14 mode
We don't support any compiler that doesn't support C++14 constexpr when
compiling in C++14 mode anymore, so we can just assume that we have C++14
extended constexpr when compiling in C++14 mode. This allows us to remove
some workarounds for older compilers.

Differential Revision: https://reviews.llvm.org/D108638
2021-08-25 08:41:07 -04:00
Louis Dionne 87dd51983c [libc++] Remove support for CloudABI, which has been abandoned
Based on https://github.com/NuxiNL/cloudlibc, it appears that the CloudABI
project has been abandoned. This patch removes a bunch of CloudABI specific
logic that had been added to support that platform.

Note that some knobs like LIBCXX_ENABLE_STDIN and LIBCXX_ENABLE_STDOUT
coud be useful in their own right, however those are currently broken.
If we want to re-add such knobs in the future, we can do it like we've
done it for localization & friends so that we can officially support
that configuration.

Differential Revision: https://reviews.llvm.org/D108637
2021-08-24 14:11:32 -04:00
Louis Dionne 2540c77360 [libc++][NFC] Reindent error message 2021-08-23 15:34:51 -04:00
Arthur O'Dwyer ca7926bd79 [libc++] Eliminate needless `add_lvalue_reference` from <algorithm> helpers. NFCI.
When `_Compare` is a function parameter already (so it's not `void`
and it's not an abominable function type), `add_lvalue_reference_t<_Compare>`
is simply a synonym for `_Compare&`. We don't need to pull in `<type_traits>`
and instantiate a template trait to figure that out.

Differential Revision: https://reviews.llvm.org/D108400
2021-08-22 11:43:12 -04:00
Fangrui Song 40aab0412f [test] Migrate -gcc-toolchain with space separator to --gcc-toolchain=
Space separated driver options are uncommon but Clang traditionally
did not do a good job. --gcc-toolchain= is the preferred form.
2021-08-20 15:24:58 -07:00
Louis Dionne 5425106e49 [libc++] Remove test-suite annotations for unsupported Clang versions
Differential Revision: https://reviews.llvm.org/D108471
2021-08-20 15:05:13 -04:00
Joe Loser 9807626bc7 [libc++] Include <__iterator/distance.h> instead of <iterator> in a few algorithm headers
A few headers in algorithm include `<iterator>` when
`<__iterator/distance.h>` would suffice. Change them
to just include `<__iterator.distance.h>`.

Differential Revision: https://reviews.llvm.org/D108393
2021-08-20 15:02:33 -04:00
Muiez Ahmed 3f05377d57 [SystemZ][z/OS] Avoid assumption for character value in futures tests
The aim of this patch is to remove the assumption that the character 'a' is always 97. In turn, this patch explicitly uses the character values to account for the EBCDIC 'a' that is not 97.

Differential Revision: https://reviews.llvm.org/D108321
2021-08-20 14:03:03 -04:00
Louis Dionne 3a244fcf29 [libc++] Remove more test-suite workarounds for unsupported GCC versions
Differential Revision: https://reviews.llvm.org/D108466
2021-08-20 13:26:43 -04:00
Albion Fung 4bef7a8ff1 [libc++][PowerPC] Fix a test case failure when compiled with libcxx
The test case is not ran unless libcxx is used, and a macro
may be undefined. This patch checks for the definition of the
macro before using it.

Fixes http://llvm.org/PR51430

Differential Revision: https://reviews.llvm.org/D108352
2021-08-20 13:24:13 -04:00
Louis Dionne 02d11757c1 [libc++][NFC] Fix minor errors and inconsistencies in the test suite 2021-08-20 12:14:24 -04:00
Louis Dionne e8118e6c8d [libc++] Fix XFAIL annotation
The triple can sometimes be arm64-apple-macos, where the previous XFAIL
annotation wouldn't match (and hence the test would fail unexpectedly).
2021-08-20 10:18:40 -04:00
Louis Dionne 65d677435e [libc++] Update credits.txt per coment on D108263 2021-08-20 08:42:36 -04:00
Louis Dionne f3bc0e51ab [libc++] Bypass calling exception-throwing functions in the dylib with -fno-exceptions
basic_string and vector currently have a hard dependency on the compiled
library because they need to call __vector_base_common::__throw_xxx(),
which are externally instantiated in the compiled library. That makes
sense when exceptions are enabled (because we're trying to localize the
exception-throwing code to the compiled library), but it doesn't really
make sense when exceptions are disabled, and the __throw_xxx functions
are just calling abort() anyways.

This patch simply overrides the __throw_xxx() functions so that they
don't rely on the compiled library when exceptions are disabled.

Differential Revision: https://reviews.llvm.org/D108389
2021-08-20 08:38:58 -04:00
Kent Ross 0edcd91d11 [libc++][NFC] Update and alphabetize CREDITS.TXT
Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D108263
2021-08-19 23:13:44 +00:00
Kent Ross 81507bcf6b [libc++] [doc] Add issue tracking for spaceship operator<=> implementation
Add issue tracking and assignment for the implementation of P1614R2: The Mothership has Landed.

Reviewed By: cjdb, #libc, Mordante, Quuxplusone

Differential Revision: https://reviews.llvm.org/D107877
2021-08-19 23:13:44 +00:00
Kent Ross 7e325d4c0c [libc++][NFC] Remove unused include in <compare>.
`<type_traits>` was included in the first iteration of `<compare>` when
it was created as a monolithic header, then never removed. Removing it
now is a beneficial no-op since it is not guaranteed by the standard
and is already included by all of its subheaders.

Reviewed By: cjdb, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D107801
2021-08-19 23:13:44 +00:00
Louis Dionne 475f831b17 [libc++][NFCI] Remove unnecessary exception-throwing base classes
__split_buffer_common was entirely unused, and __deque_base_common
was unused except for two calls to __throw_out_of_range(), which have
been inlined.

The usual intent of the __xxx_base_common base classes is to localize
where the exception-throwing code is instantiated, however that wasn't
the case here because we never explicitly instantiated those base classes
in the shared library, unlike what we do for basic_string and vector.

Differential Revision: https://reviews.llvm.org/D108384
2021-08-19 13:59:57 -04:00
Louis Dionne ebc01bbc7a [libc++] Skip logic for detecting C11 features when using_if_exists is supported
In the future, we'll want to rely exclusively on using_if_exists for this
job, but for now, only rely on it when the compiler supports that attribute.
That removes the possibility for getting the logic wrong.

Differential Revision: https://reviews.llvm.org/D108297
2021-08-18 11:53:34 -04:00
Louis Dionne ec574f5da4 [libc++] Split off tests for aligned_alloc & friends into separate test files
This allows testing the rest of those headers on most platforms, instead
of XFAILing the whole test just because of a few functions.

As a fly-by fix, remove std/utilities/time/date.time/ctime.pass.cpp,
which was a duplicate of std/language.support/support.runtime/ctime.pass.cpp.

Differential Revision: https://reviews.llvm.org/D108295
2021-08-18 11:52:40 -04:00
Arthur O'Dwyer 0fb189952c [libc++] Implement structured binding for std::ranges::subrange.
The `get` half of this machinery was already implemented, but the `tuple_size`
and `tuple_element` parts were hiding in [ranges.syn] and therefore missed.

Differential Revision: https://reviews.llvm.org/D108054
2021-08-18 10:01:45 -04:00
Arthur O'Dwyer 38812f4ac1 [libc++] [P1614] Implement std::compare_three_way_result.
Differential Revision: https://reviews.llvm.org/D103581
2021-08-18 10:01:24 -04:00
Louis Dionne 0166690401 [libc++] Remove workarounds for the lack of deduction guides in C++17
All supported compilers have supported deduction guides in C++17 for a
while, so this isn't necessary anymore.

Differential Revision: https://reviews.llvm.org/D108213
2021-08-18 08:57:25 -04:00
Louis Dionne 6f6175d1c6 [libc++][NFC] Fix copy-paste errors in tests
The test precision_type.pass.cpp was a duplicate of precision.pass.cpp,
so it is removed. atomic_flag_test.pass.cpp was a duplicate of
atomic_flag_test_and_set.pass.cpp, so instead I wrote a proper
test for it. Those duplicate tests were detected with

     find libcxx ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD
2021-08-18 08:54:18 -04:00
Louis Dionne ed7c81d172 [libc++] Convert test-suite workarounds for some C11 features to XFAILs
Instead of trying to sniff out what features are supported by the
library being tested, the way we normally handle these things is with
Lit annotations. This should not be treated differently.

Differential Revision: https://reviews.llvm.org/D108209
2021-08-18 08:28:11 -04:00
Dan Albert d42be2d63c Remove unused imports. 2021-08-17 13:04:02 -07:00
Louis Dionne dc0d4b97a2 [libc++] Update the version of CMake in the Docker image 2021-08-17 13:35:57 -04:00
Louis Dionne b28cb53eac [libc++][NFC] Format expression-equivalent wrappers consistently
Differential Revision: https://reviews.llvm.org/D108144
2021-08-17 12:00:32 -04:00
Louis Dionne ceff0b7258 [libc++] Do not require movability in __non_propagating_cache::__emplace_deref
As explained in http://eel.is/c++draft/range.nonprop.cache#note-1, we
should allow copy and move elision to happen when calling emplace_deref
in non-propagating-cache. Before this change, the only way to emplace
into the non-propagating-cache was to call `__set(*it)`, which materialized
`*it` when binding it to the reference argument of `__set` and disabled
move elision.

As a fly-by change, this also renames `__set` to `__emplace` for consistency
and adds tests for it.

Differential Revision: https://reviews.llvm.org/D107932
2021-08-17 11:32:40 -04:00
Louis Dionne c67f497e7a [libc++][NFC] Fix indentation of documentation 2021-08-17 10:52:17 -04:00
Louis Dionne 9de882fdbf [libc++][NFC] Refactor tests for transform_view
Adjust the names of helper function objects to represent better what
they do, as suggested in the review of D107098.
2021-08-17 09:21:35 -04:00
Louis Dionne 5ed162c8f9 [libc++][NFC] Replace uses of 'constexpr friend' by 'friend constexpr'
This is done for consistency, since that's what we do everywhere else
in the library.
2021-08-16 11:43:05 -04:00
zoecarver 9ed0778179 [libcxx][ranges] Move `namespace views` into `namespace ranges` and add an alias.
Differential Revision: https://reviews.llvm.org/D108047
2021-08-13 16:12:19 -07:00
zoecarver df324bba5c [libcxx][ranges] Add `ranges::join_view`.
Differential Revision: https://reviews.llvm.org/D107671
2021-08-13 11:31:08 -07:00
zoecarver 7b20e05c71 [libcxx][ranges] Add `ranges::iota_view`.
Differential Revision: https://reviews.llvm.org/D107396
2021-08-13 11:31:08 -07:00
Louis Dionne 6900df37d2 [libc++] Remove Lit annotations for unsupported GCC versions from the test suite
Since we officially don't support several older compilers now, we can
drop a lot of the markup in the test suite. This helps keep the test
suite simple and makes sure that UNSUPPORTED annotations don't rot.

This is the first patch of a series that will remove annotations for
compilers that are now unsupported.

Differential Revision: https://reviews.llvm.org/D107787
2021-08-12 13:30:47 -04:00
zoecarver 4ac87e3378 [libcxx][ranges] Add `unreachable_sentinel`.
Differential Revision: https://reviews.llvm.org/D107920
2021-08-12 10:11:27 -07:00
Louis Dionne b408bbbf5b [libc++] Avoid conflating stderr and stdout in the DSL
This is a workaround until https://reviews.llvm.org/D81892 is merged
and the internal Lit shell stops conflating error output with normal
output. Without this, any program that writes to stderr will trip up
the programOutput function, because it will pick up the '# command stderr:'
string and think it's part of the command's stdout.

rdar://81056048

Differential Revision: https://reviews.llvm.org/D107912
2021-08-11 17:06:56 -04:00
Louis Dionne 7c81024a06 [libc++] Remove workarounds for missing __builtin_addressof
All supported compilers implement __builtin_addressof. Even MSVC implements
addressof as a simple call to __builtin_addressof, so it would work if we
were to port libc++ to that compiler.

Differential Revision: https://reviews.llvm.org/D107905
2021-08-11 17:05:12 -04:00
Arthur O'Dwyer c1a8f12873 [libc++] Restore `basic_ios`'s implicit conversion to `bool` in C++03 mode.
efriedma noted that D104682 broke this test case, reduced from SPEC2006.

    #include <istream>
    bool a(std::istream a) {
        return a.getline(0,0) == 0;
    }

We can unbreak it by restoring the conversion to something-convertible-to-bool.
We chose `void*` in order to match libstdc++.

For more ancient history, see PR19460: https://bugs.llvm.org/show_bug.cgi?id=19460

Differential Revision: https://reviews.llvm.org/D107663
2021-08-11 13:36:29 -04:00
Mark de Wever d2bc4fa3c7 [libc++][doc] Improve contributor documentation.
Addresses the post-commit review comments of D107596.
2021-08-11 17:33:54 +02:00
Louis Dionne 15071d2945 [libc++] Remove _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
All supported compilers have implemented __has_unique_object_representations
for a while, so it's reasonable to remove the workaround.

Differential Revision: https://reviews.llvm.org/D107834
2021-08-11 10:11:40 -04:00
Louis Dionne 7be03cc782 [libc++] Remove _LIBCPP_HAS_NO_IS_AGGREGATE
All supported compilers have been supporting __is_aggregate for a long
time now, so it's reasonable to remove this workaround.

Differential Revision: https://reviews.llvm.org/D107833
2021-08-11 10:10:53 -04:00
Louis Dionne 89a7bdb1f3 [libc++] Add the __bind_back and __compose helpers
Those are going to be used to implement range adaptors,
see D107098 for details.

Differential Revision: https://reviews.llvm.org/D107785
2021-08-11 10:08:20 -04:00
Arthur O'Dwyer e27f364c61 [libc++] IWYU to fix Modules complaints in <__ranges/reverse_view.h>.
And now we can use granular concepts headers!
2021-08-10 22:02:41 -04:00
Arthur O'Dwyer 58915667d0 [libc++][modularisation] Split up <concepts> into granular headers.
This is the complete split of <concepts>, with nothing left in the main header.

Differential Revision: https://reviews.llvm.org/D107584
2021-08-10 22:02:41 -04:00
zoecarver f9e58f35e9 [libcxx][ranges] Add `views::counted` CPO.
Differential Revision: https://reviews.llvm.org/D106923
2021-08-10 16:42:28 -07:00
Mark de Wever 1123100a16 [libcxx] Remove _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
All supported compilers should support
_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED so this can be removed.

Reviewed By: ldionne, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D107239
2021-08-10 18:59:55 +02:00
Louis Dionne ce96d81c47 [libc++][NFC] Simplify tests for bind_front 2021-08-10 11:57:51 -04:00
Martin Storsjö bb2a92e66e [libcxx] [test] Convert an XFAIL: LIBCXX-WINDOWS-FIXME into XFAIL: msvc
This one already had a proper explanation why it fails, which is due to
differences by design in MSVC mode. This isn't a fixme, so degrade the
annotation to a more permanent "XFAIL: msvc" instead.

Differential Revision: https://reviews.llvm.org/D107758
2021-08-10 11:06:18 +03:00
Martin Storsjö 4baf369cde [libcxx] [test] Fix the new_faligned_allocation.pass.cpp test for MSVC
Such environments do have aligned allocation functions these days, but
the RTTI type name test needs to be adjusted for the MSVC C++ ABI.

Differential Revision: https://reviews.llvm.org/D107757
2021-08-10 11:06:02 +03:00
Martin Storsjö 128b2136ec [libcxx] [test] Generalize defines for skipping allocation checks
This allows waiving the right amount of asserts on Windows and zOS.
This should supersede D107124 and D105910.

Differential Revision: https://reviews.llvm.org/D107755
2021-08-10 11:05:00 +03:00
zoecarver 9d982c67ba [libcxx][ranges] Add `ranges::reverse_view`.
Differential Revision: https://reviews.llvm.org/D107096
2021-08-09 15:09:59 -07:00
Louis Dionne 706bd129b3 [libc++][NFC] Remove workaround for variadic templates in C++03
That's not necessary anymore, since we always build the dylib with
C++11 capabilities nowadays.

Differential Revision: https://reviews.llvm.org/D107772
2021-08-09 18:05:46 -04:00