Commit Graph

3757 Commits

Author SHA1 Message Date
Arthur O'Dwyer a13c10588c [libc++] [test] Fix LWG3146 "Excessive unwrapping in std::ref/cref"
Drive-by constexprify the existing tests, too.

Differential Revision: https://reviews.llvm.org/D117953
2022-01-25 19:30:32 -05:00
Arthur O'Dwyer 8b29b84c99 [libc++] Fix LWG3422 "Issues of seed_seq's constructors"
https://cplusplus.github.io/LWG/issue3422

Also add a static_assert to check the "Mandates:" on the
iterator-pair constructor. Oddly, the `InputIterator` parameter
itself is merely preconditioned, not constrained, to satisfy the
input iterator requirements.

Also drive-by rename `init` to `__init`.

Differential Revision: https://reviews.llvm.org/D117962
2022-01-24 20:14:25 -05:00
Nikolas Klauser 014a673441 [libc++] Remove std::basic_string's base class in ABIv2
Remove `std::basic_string`'s base class in ABI version 2

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116334
2022-01-25 00:21:53 +01:00
Nikolas Klauser 52f37c24c3 [libc++][NFC] remove this-> when calling member functions in <string>
remove `this->` when calling member functions

Reviewed By: Quuxplusone, Mordante, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116324
2022-01-25 00:21:51 +01:00
Louis Dionne 0407ab4114 [libc++] Make sure basic_string::reserve(n) never shrinks in all Standard modes
Since basic_string::reserve(n) is instantiated in the shared library but also
available to the compiler for inlining, its definition should not depend on
things like the Standard mode in use. Indeed, that flag may not match between
how the shared library is compiled and how users are compiling their own code,
resulting in ODR violations.

However, note that we retain the behavior of basic_string::reserve() to
shrink the string for backwards compatibility reasons. While it would
technically be conforming to not shrink, we believe user expectation is
for it to shrink, and so existing code might have been written based on
that assumption. We prefer to not break such code, even though that makes
basic_string::reserve() and basic_string::reserve(0) not equivalent anymore.

Fixes llvm-project#53170

Differential Revision: https://reviews.llvm.org/D117332
2022-01-24 15:43:13 -05:00
Mark de Wever 4684857abf [libc++][format] Finish P0645 Text Formatting.
This adjust the version macro and sets it as completed. All parts of the paper
have been implemented, except for the parts replaced by later papers and
LWG-issues.

Adjusted the synopsis to match the synopsis in the Standard. Not yet
implemented parts of P2216 and P2418 still use the P0645 wording.

Completes:
- P0645 Text Formatting

Depends on D115991

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D115999
2022-01-24 20:10:14 +01:00
Arthur O'Dwyer eadf7268d5 [libc++] Fix bugs in common_iterator; add test coverage.
Differential Revision: https://reviews.llvm.org/D117400
2022-01-24 13:45:38 -05:00
Mark de Wever ade6d0d8fa [libc++][format] Adds formatter handle.
This implements the handler according to P0645. P2418 changes the wording
in the Standard. That isn't implemented and requires changes in more
places. LWG3631 applies modifications to P2418, but is currently
unresolved.

Implements parts of:
* P0645 Text Formatting

Depends on D115989

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D115991
2022-01-24 18:15:08 +01:00
Mark de Wever 2b8b48c5a0 [libc++][format] Disable default formatter.
[format.formatter.spec]/5 lists the requirements for the default
formatter. The original implementation didn't implement this. This
implements the default formatter according to the Standard.

This adds additional test to validate the default formatter is disabled
and the required standard formatters are enabled.

While adding the tests it seems the formatters needed a constraint for the
character types they were valid for.

Implements parts of:
- P0645 Text Formatting

Depends on D115988

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D115989
2022-01-24 18:14:41 +01:00
Mark de Wever 787ccd345c [libc++][format] Adds formatter pointer.
This implements the last required formatter specialization.

Completes:
- LWG 3251 Are std::format alignment specifiers applied to string arguments?
- LWG 3340 Formatting functions should throw on argument/format string mismatch in §[format.functions]
- LWG 3540 §[format.arg] There should be no const in basic_format_arg(const T* p)

Implements parts of:
- P0645 Text Formatting

Depends on D114001

Reviewed By: ldionne, vitaut, #libc

Differential Revision: https://reviews.llvm.org/D115988
2022-01-24 18:13:02 +01:00
Mark de Wever db2944e34b [libc++][format] Adds formatter floating-point.
This properly implements the formatter for floating-point types.

Completes:
- P1652R1 Printf corner cases in std::format
- LWG 3250 std::format: # (alternate form) for NaN and inf
- LWG 3243 std::format and negative zeroes

Implements parts of:
- P0645 Text Formatting

Reviewed By: #libc, ldionne, vitaut

Differential Revision: https://reviews.llvm.org/D114001
2022-01-24 18:12:24 +01:00
Arthur O'Dwyer 5d78fef6db [libc++] Fix LWG3437 "__cpp_lib_polymorphic_allocator is in the wrong header"
https://cplusplus.github.io/LWG/issue3437

Differential Revision: https://reviews.llvm.org/D117963
2022-01-23 10:30:09 -05:00
Arthur O'Dwyer 938944445a [libc++] Mark LWG3541 as "Complete". NFC.
Differential Revision: https://reviews.llvm.org/D117956
2022-01-23 10:15:17 -05:00
Joe Loser 2513b79030
[libc++] Implement LWG3549: view_interface need not inherit from view_base
Implement LWG3549 by making `view_interface` not inherit from `view_base`. Types
are still views if they have a public and unambiguous derivation from
`view_interface`, so adjust the `enable_view` machinery as such to account for
that.

Differential Revision: https://reviews.llvm.org/D117714
2022-01-22 22:52:46 -05:00
Mark de Wever 26544b98f7 [libc++] Use addressof in unordered_set.
This addresses the usage of `operator&` in `<unordered_set>`.

(Note there are still more headers with the same issue.)

Reviewed By: #libc, philnik, Quuxplusone

Differential Revision: https://reviews.llvm.org/D117917
2022-01-22 11:41:13 +01:00
Muiez Ahmed 4f8ea3c84f [SystemZ][z/OS][NFC] Remove extra symbol 2022-01-21 16:18:46 -05:00
Mark de Wever d6e2c95d22 [libc++] Use addressof in unordered_map.
This addresses the usage of `operator&` in `<unordered_map>`.

(Note there are still more headers with the same issue.)

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D117393
2022-01-21 20:43:45 +01:00
Mark de Wever e4a556268e Revert "[libc++] Use addressof in unordered_map."
This reverts commit cab9616938.

This breaks the CI.
2022-01-21 17:59:07 +01:00
Mark de Wever cab9616938 [libc++] Use addressof in unordered_map.
This addresses the usage of `operator&` in `<unordered_map>`.

(Note there are still more headers with the same issue.)

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D117393
2022-01-21 17:34:29 +01:00
Casey Carter 864b5b49fd [libcxx] chrono::month_weekday should not be default constructible
It was not in P0355R7, nor has it ever been so in a working draft.

Drive-by:
* tests should test something: fix loop bounds so initial value is not >= final value
* calender type streaming tests are useless - let's remove them
* don't declare printf, especially if you don't intend to use it

Differential Revision: https://reviews.llvm.org/D117638
2022-01-20 11:47:56 -08:00
Arthur O'Dwyer 63a991d035 [libc++] Eliminate the `__function_like` helper.
As prefigured in the comments on D115315.
This gives us one unified style for all niebloids,
and also simplifies the modulemap.

Differential Revision: https://reviews.llvm.org/D116570
2022-01-20 14:40:16 -05:00
Nikolas Klauser 4822447522 [libc++] basic_string::resize_and_overwrite: Adopt LWG3645 (Not voted in yet)
Adopt LWG3645, which fixes the value categories of basic_string::resize_and_overwrite
https://timsong-cpp.github.io/lwg-issues/3645

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116815
2022-01-20 18:41:09 +01:00
Casey Carter 4e00a1921f [libcxx][test] compiler options are non-portable
... it's easier to suppress warnings internally, where we can detect the compiler.

* Rename `TEST_COMPILER_C1XX` to `TEST_COMPILER_MSVC`
* Rename all `TEST_WORKAROUND_C1XX_<meow>` to `TEST_WORKAROUND_MSVC_<meow>`

Differential Revision: https://reviews.llvm.org/D117422
2022-01-18 11:34:57 -08:00
Nikolas Klauser 275e7d197c [libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <unordered_map>
Use `_LIBCPP_DEBUG_ASSERT` in <unordered_map>

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117401
2022-01-18 20:31:02 +01:00
Alex Brachet 1dbe32dd9c [libc++] Use reserved identifier for template parameter
`T` is not a valid identifier for libc++ to use, use `_Tp` instead. Caught from D116957

Reviewed By: Quuxplusone

Differential Revision: https://reviews.llvm.org/D117582
2022-01-18 19:20:25 +00:00
Louis Dionne df51be85e4 [libc++] Split a few utilities out of __threading_support
This change is the basis for a further refactoring where I'm going to
split up the various implementations we have in __threading_support to
make that code easier to understand.

Note that I had to make __convert_to_timespec a template to break
circular dependencies. Concretely, we never seem to use it with anything
other than ::timespec, but I am wary of hardcoding that assumption as
part of this change, since I suspect there's a reason for going through
these hoops in the first place.

Differential Revision: https://reviews.llvm.org/D116944
2022-01-18 12:23:44 -05:00
Arthur O'Dwyer 459b4b725f [libc++] [API BREAK] Change `fs::path::iterator::iterator_category` to `input_iterator_tag`.
This essentially reverts e02ed1c255 and puts in a new fix, which makes `path::iterator`
a true C++20 `bidirectional_iterator`, but downgrades it to an `input_iterator` in C++17.

Fixes #37852.

Differential Revision: https://reviews.llvm.org/D116489
2022-01-17 16:33:23 -05:00
Nikolas Klauser caf5548c7c [libc++] Introduce __debug_db_insert_i()
Introduce `__debug_db_insert_i()`

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117410
2022-01-17 20:31:21 +01:00
Nikolas Klauser 311207bbea [libc++][P2321R2] Add specializations of basic_common_reference and common_type for tuple
Add specializations of `basic_common_reference` and `common_type` for `tuple`

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116538
2022-01-17 19:49:57 +01:00
Nikolas Klauser d7630b37ce [libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <vector>
Use `_LIBCPP_DEBUG_ASSERT` in `<vector>`

Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117402
2022-01-17 19:28:16 +01:00
Arthur O'Dwyer 0359b85c61 [libc++] [ABI BREAK] Conform lognormal_distribution::param_type.
Fixes #52906.

Differential Revision: https://reviews.llvm.org/D116344
2022-01-17 10:22:41 -05:00
Arthur O'Dwyer e93f98f09c [libc++] [test] Check for another kind of modulemap typo in lint_modulemap.sh.py.
Verify that the name of the private submodule matches the name of the detail header.

Differential Revision: https://reviews.llvm.org/D117438
2022-01-17 10:20:34 -05:00
Nikolas Klauser d3e49a41b1 [libc++] Add _LIBCPP_HIDE_FROM_ABI to in_in_result
Add `_LIBCPP_HIDE_FROM_ABI` to `in_in_result` conversion operators

Reviewed By: Quuxplusone, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117399
2022-01-15 20:30:08 +01:00
Arthur O'Dwyer cba72e4ce2 [libc++] Normalize some whitespace in preparation for D116570. NFC. 2022-01-15 12:20:33 -05:00
Arthur O'Dwyer 0ab54c28f8 [libc++] Further small cleanups of move_iterator.h. NFC.
Differential Revision: https://reviews.llvm.org/D117324
2022-01-14 15:41:45 -05:00
Arthur O'Dwyer c09692a644 [libc++] s/_LIBCPP_INLINE_VISIBILITY/_LIBCPP_HIDE_FROM_ABI/g in move_iterator.h. NFC. 2022-01-14 15:41:02 -05:00
Arthur O'Dwyer 9542c9c599 [libc++] Rename __i to __current_ in move_iterator. NFC. 2022-01-14 15:40:57 -05:00
Nikolas Klauser bdd5b94837 [libc++][NFC] Remove clang-diagnostic-c++98-compat-extra-semi warnings in experimental/simd
Force semicolons or remove them in `experimental/simd`

Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D117157
2022-01-14 19:38:33 +01:00
Hui Xie 597b90ebac [libc++] Fix __simple_view concept in std::ranges
Differential Revision: https://reviews.llvm.org/D116808
2022-01-14 12:55:34 -05:00
Arthur O'Dwyer 2a11fbb827 [libc++] [NFC] Remove a hard tab from __config. 2022-01-14 12:18:44 -05:00
Muiez Ahmed a1da73961d [SystemZ][z/OS] ASCII/EBCDIC support with no coexistence
The aim of this patch is to break up the larger patch (https://reviews.llvm.org/D111323) to be more upstream friendly. In particular, this patch adds the char encoding sensitive changes but does not use inline namespaces as before. The use of namespaces to build both versions of the library, and localization of error messages will follow in a subsequent patch.

Differential Revision: https://reviews.llvm.org/D114813
2022-01-14 11:37:09 -05:00
Arthur O'Dwyer a8f1a715f0 [libc++] _Uglify some template parameter names. NFCI. 2022-01-14 10:32:04 -05:00
Louis Dionne 5726e55981 [libc++] Modularize <chrono>
I didn't split the calendar bits more than this because there was little
benefit to doing it, and I know our calendar support is incomplete.
Whoever picks up the missing calendar bits can organize these headers
at their leisure.

Differential Revision: https://reviews.llvm.org/D116965
2022-01-14 09:55:29 -05:00
Konstantin Varlamov b6d87773fe [libc++] LWG3171: implement operator<< for filesystem::directory_entry.
Differential Revision: https://reviews.llvm.org/D116642
2022-01-13 20:44:18 -08:00
Nikolas Klauser d3729bb384 [libc++][ranges] Add ranges::in_in_result
Add `std::ranges::in_in_result`

Reviewed By: Quuxplusone, Mordante, #libc

Spies: ldionne, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D116278
2022-01-14 02:56:33 +01:00
Arthur O'Dwyer 67151d029b [libc++] [ranges] Implement P2415R2 owning_view.
"What is a view?"
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2415r2.html
https://github.com/cplusplus/draft/pull/5010/files

This was a late-breaking (Oct 2021) change to C++20.
The only thing missing from this patch is that we're supposed
to bump the feature-test macro from
    #define __cpp_lib_ranges 202106L
to
    #define __cpp_lib_ranges 202110L
but we can't do that because we don't implement all of 202106 Ranges yet.

Differential Revision: https://reviews.llvm.org/D116894
2022-01-13 12:29:41 -05:00
Arthur O'Dwyer 42185ad870 [libc++] Add tests verifying alphabetical order for several things.
These things are header #includes, CMakeLists.txt, and module.modulemap.

Differential Revision: https://reviews.llvm.org/D116958
2022-01-13 09:58:56 -05:00
Arthur O'Dwyer 483f7f5536 [libc++] [ranges] Implement ranges::cdata.
Differential Revision: https://reviews.llvm.org/D117044
2022-01-12 22:07:13 -05:00
Konstantin Varlamov b9bc3c107c [libc++][ranges] Implement `construct_at` and `destroy{,_at}`.
Differential Revision: https://reviews.llvm.org/D116078
2022-01-12 16:01:04 -08:00
Arthur O'Dwyer 9be193bc58 [libc++] [ranges] Finish ADL-proofing ranges::data.
This should have been part of D116239.
2022-01-12 18:16:22 -05:00