Commit Graph

7413 Commits

Author SHA1 Message Date
Mark de Wever
18b03b0085 [libc++][NFC] Remove non-ASCII from comment.
Seems our check-generated-output doesn't work as intended. Will
investigate it further.
2021-04-26 17:53:20 +02:00
Mark de Wever
a354fd56c5 [libc++] Adds __utility/to_underlying.h.
During the review of D97115 it was mentioned adding the `<utility>`
header for `__to_underlying` was a bit unfortunate. Nowadays we tend to
implement smaller headers, so a good reason to move `std::to_underlying`
to its own header and adjust `<charconv>` to use the new header.

Differential Revision: https://reviews.llvm.org/D101233
2021-04-25 13:27:19 +02:00
Christopher Di Bella
38225d6921 [libcxx][iterator] adds std::input_or_output_iterator and std::sentinel_for
Implements parts of:
    * P0896R4 The One Ranges Proposal`

Depends on D100080

Differential Revision: https://reviews.llvm.org/D100160
2021-04-24 15:49:21 +00:00
Mark de Wever
ca177dcda3 [libc++][doc] Adds a Format library status page.
A status page for libc++'s Format library. The page is inspired by
@zoecarver's Ranges status page.

Differential Revision: https://reviews.llvm.org/D101085
2021-04-24 16:38:18 +02:00
Shu Tian
7402ec8f38 [libc++] Remove if-else to make branch predictor happy
Reviewed By: #libc, ldionne, Quuxplusone, Mordante

Differential Revision: https://reviews.llvm.org/D100828
2021-04-24 16:09:52 +02:00
Christopher Di Bella
2205286095 [libcxx][iterator] adds std::weakly_incrementable and std::incrementable
Implements parts of:
    * P0896R4 The One Ranges Proposal`

Depends on D100073.

Reviewed By: ldionne, zoecarver, #libc

Differential Revision: https://reviews.llvm.org/D100080
2021-04-23 22:25:37 -07:00
Christopher Di Bella
a224bf8ec4 [libcxx] disables ranges for clang-cl
clang-cl doesn't properly handle concepts right now and is failing CI.

Differential Revision: https://reviews.llvm.org/D101205
2021-04-23 18:21:33 -07:00
Arthur O'Dwyer
bbc6893b11 Implement N3644 "Null Forward Pointers" in _LIBCPP_DEBUG mode.
This functionality is tested in std/containers/sequences/vector/iterators.pass.cpp
(and similarly for all containers, but vector is the only one to be tested that
uses debug iterators).

Differential Revision: https://reviews.llvm.org/D100881
2021-04-23 18:20:39 -04:00
zoecarver
d7bd62a64e [libcxx][nfc] Add license to pointer_comparison_test_helper.h 2021-04-23 12:37:47 -07:00
Louis Dionne
a3ab5120fd [libc++] Rewrite the tuple constructors to be strictly Standards conforming
This nasty patch rewrites the tuple constructors to match those defined
by the Standard. We were previously providing several extensions in those
constructors - those extensions are removed by this patch.

The issue with those extensions is that we've had numerous bugs filed
against us over the years for problems essentially caused by them. As a
result, people are unable to use tuple in ways that are blessed by the
Standard, all that for the perceived benefit of providing them extensions
that they never asked for.

Since this is an API break, I communicated it in the release notes.
I do not foresee major issues with this break because I don't think the
extensions are too widely relied upon, but we can ship it and see if we
get complaints before the next LLVM release - that will give us some
amount of information regarding how much use these extensions have.

Differential Revision: https://reviews.llvm.org/D96523
2021-04-23 12:46:37 -04:00
Dávid Bolvanský
3b71de41cc [libcxx] Fixed build break on buildbots with -Werror 2021-04-23 18:16:38 +02:00
zoecarver
879cbac08b [libc++][ranges] Add range.cmp: equal_to, not_equal_to, less, etc.
Adds the six new concept constrained comparisons.

Differential Revision: https://reviews.llvm.org/D100429
2021-04-22 17:33:04 -07:00
Arthur O'Dwyer
5dfbcc5ae9 [libc++] [test] Fix nodiscard_extensions.pass.cpp in _LIBCPP_DEBUG mode.
`std::clamp(2, 1, 3, std::greater<int>())` has UB because (1 > 3) is false.
Swap the operands to fix the _LIBCPP_ASSERT failure in this test.
2021-04-22 12:17:32 -04:00
Arthur O'Dwyer
b98b6d99c5 [libc++] Eliminate macro _LIBCPP_UNUSED_VAR. NFCI.
Reviewed as part of https://reviews.llvm.org/D100737
2021-04-22 12:02:22 -04:00
Arthur O'Dwyer
e6972024c8 [libc++] Fix some typos and remove unused macros. NFCI.
Reviewed as part of https://reviews.llvm.org/D100737
2021-04-22 12:02:22 -04:00
Louis Dionne
57ebf3d008 [libc++] Re-apply std::indirectly_readable and std::indirectly_writable
That was originally committed in 04733181b5 and then reverted in
a9f11cc0d9 because it broke several people.

The problem was a missing include of __iterator/concepts.h, which has now
been fixed.

Differential Revision: https://reviews.llvm.org/D100073
2021-04-22 11:24:04 -04:00
David Zarzycki
a9f11cc0d9 Revert "[libcxx][iterator] adds std::indirectly_readable and std::indirectly_writable"
This reverts commit 04733181b5 which was
failing for multiple people.
2021-04-22 09:49:54 -04:00
Martin Storsjö
cfec0a3e9e [libcxx] [test] Fix testing on windows with c++experimental enabled
The straightforward `AddLinkFlag('-lc++experimental')` approach doesn't
work on e.g. MSVC. For linking to libc++ itself, a more convoluted logic
is used (see configure_link_flags_cxx_library).

Differential Revision: https://reviews.llvm.org/D99177
2021-04-22 10:26:00 +03:00
Petr Hosek
f749550cfe [libcxx] Stop using use c++ subdirectory for libc++ library
The new layout more closely matches the layout used by other compilers.
This is only used when LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is enabled.

Differential Revision: https://reviews.llvm.org/D100869
2021-04-21 15:39:03 -07:00
Louis Dionne
3d8f2059b9 [libc++] Move the debug_level feature to the DSL 2021-04-21 17:57:16 -04:00
Louis Dionne
ac8b71227c [libc++] Move macOS testing out of the 2nd CI stage
It's too slow, which delays the posting of CI results to Phabricator
when another step in the same stage fails.
2021-04-21 17:12:43 -04:00
Mark de Wever
f2ff3b91ec [libc++][doc] Improve Phabricator links.
Removes the "reviews." part of the links as suggested by @ldionne in
D100707.
2021-04-21 20:12:03 +02:00
Christopher Di Bella
04733181b5 [libcxx][iterator] adds std::indirectly_readable and std::indirectly_writable
Implements parts of:
    * P0896R4 The One Ranges Proposal`

Depends on D99873.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D100073
2021-04-21 17:14:28 +00:00
Arthur O'Dwyer
5c40c994c3 [libc++] s/_LIBCPP_NO_HAS_CHAR8_T/_LIBCPP_HAS_NO_CHAR8_T/g
This was raised in D94511.

Differential Revision: https://reviews.llvm.org/D100736
2021-04-21 12:49:07 -04:00
Arthur O'Dwyer
e9d876159e [libc++] [test] Remove epicyclic workarounds for vector/span; use T[] or std::array.
Simplify the test code, and drive-by also test that these algorithms
return the right iterator as their return value.

Differential Revision: https://reviews.llvm.org/D100876
2021-04-21 12:41:45 -04:00
Louis Dionne
97e383aa06 [libc++] Add std::ranges::iter_move and std::iter_rvalue_reference_t
Original patch by @cjdb, modified by @ldionne.

Differential Revision: https://reviews.llvm.org/D99873
2021-04-21 11:32:00 -04:00
Christopher Di Bella
9816d43cff [libcxx] adds iter_difference_t and iter_value_t
Implements parts of:
    * P0896R4 The One Ranges Proposal

Depends on D99855.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D99863
2021-04-20 19:02:07 +00:00
Kristina Bessonova
4a292eda25 [libcxx][test] Construct non-empty containers in iterator's debug mode tests
The debug mode tests for map/set's iterators construct empty
containers, making the code after the first increment meaningless.
It's never executed since the tests exit earlier.

It doesn't seem to be intentional, so the patch makes the tests
to construct containers that include at least one element.

Reviewed By: curdeius, Quuxplusone

Differential Revision: https://reviews.llvm.org/D100029
2021-04-20 19:51:55 +02:00
Sterling Augustine
55b7061116 Tolerate missing debug info in the shared_ptr pretty printer.
Certain fields of shared ptr have virtual functions and therefore
have their debug info homed in libc++. But if libc++ wasn't built
with debug info, the pretty printer would fail.

This patch makes the pretty printer tolerate such conditions and
updates the test harness.

This patch significantly reworks a previous attempt.

This addresses https://bugs.llvm.org/show_bug.cgi?id=48937

Differential Revision: https://reviews.llvm.org/D100610
2021-04-20 09:52:46 -07:00
Mark de Wever
0c8fab9af7 [libcxx][doc] Use Phabricator links.
Use a link to the Phabricator review in the patch column.

Reviewed By: zoecarver, cjdb, #libc

Differential Revision: https://reviews.llvm.org/D100707
2021-04-20 18:41:04 +02:00
Louis Dionne
4cd6ca102a [libc++] NFC: Normalize #endif // comment indentation 2021-04-20 12:03:32 -04:00
zoecarver
120fa8293e [libc++][nfc] Move iterator_traits and related into __iterator/iterator_traits.h.
Based on D100682 and D99855.

(Note: I originally was going to just make this part of D99855, but I decided not to because this patch moves lots of unrelated code around, and I didn't want to make D99855 harder to review because of unrelated code-changes/moves.)

Differential Revision: https://reviews.llvm.org/D100686
2021-04-20 08:31:34 -07:00
zoecarver
9f01ac3b32 [libcxx] makes iterator_traits C++20-aware
* adds `iterator_traits` specialisation that supports all expected
  member aliases except for `pointer`
* adds `iterator_traits` specialisations for iterators that meet the
  legacy iterator requirements but might lack multiple member aliases
* makes pointer `iterator_traits` specialisation require objects

Depends on D99854.

Differential Revision: https://reviews.llvm.org/D99855
2021-04-20 11:30:08 -04:00
Louis Dionne
2704d0a701 [libc++][ci] Re-split the CI pipeline to try and reduce load on more builders 2021-04-20 08:37:52 -04:00
Kristina Bessonova
90248f2daa [libcxx][test] Split off debug mode tests
This continues the work started by @ldionne in 2908eb20ba.

The debug mode tests from

- libcxx/containers/sequences/vector/
- libcxx/strings/basic.string/string.access/
- libcxx/strings/basic.string/string.iterators/

similarly contain two tests in every file making the second test never
run. The patch splits the tests into separate files.

Reviewed By: Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D100592
2021-04-20 11:59:36 +02:00
Kamlesh Kumar
36c3918ec5 [libc++] [C++20] [P0586] Implement safe integral comparisons
* https://wg21.link/P0586

Reviewed By: #libc, curdeius, Quuxplusone

Differential Revision: https://reviews.llvm.org/D94511
2021-04-20 04:52:59 +05:30
zoecarver
2218f5998b [libc++][gardening] Replace instances of \x{AD}.
This is a NFC.

Differential Revision: https://reviews.llvm.org/D100799
2021-04-19 14:59:46 -07:00
Martin Storsjö
f9ddb81d79 [libcxx] [test] Ifdef out tests that rely on perms::none on directories for triggering errors
On Windows, one can't use perms::none on a directory to trigger
failures to read the directory entries.

These remaining tests can't use GetWindowsInaccessibleDir() sensibly,
e.g. for tests that rely on toggling accessibility back and forth during
the test, or where the semantics of the dir provided by
GetWindowsInaccessibleDir() doesn't allow for running the ifdeffed tests
meaningfully.

Differential Revision: https://reviews.llvm.org/D97538
2021-04-19 23:03:12 +03:00
Martin Storsjö
6c5b0d6bea [libcxx] Base MSVC autolinking on _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
Previously the decision of which library to try to autolink was
based on _DLL, however the _DLL define (which is set by the compiler)
is tied to whether using a dynamically linked CRT or not, and the choice
of dynamic or static CRT is entirely orthogonal to whether libc++ is
linked dynamically or statically.

If _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS isn't defined, then all
declarations are decorated with dllimport, and there's no doubt that
the DLL version of the library is what must be linked.

_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS is defined if building with
LIBCXX_ENABLE_SHARED disabled, and thus the static library is what
should be linked.

If defining _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS manually but wanting
to link against the DLL version of the library, that's not a canonical
configuration, and then it's probably reasonable to manually define
_LIBCPP_NO_AUTO_LINK too, and manually link against the desired
library.

This fixes, among other issues, running tests for the library if
built with LIBCXX_ENABLE_STATIC disabled.

Differential Revision: https://reviews.llvm.org/D100539
2021-04-19 22:42:33 +03:00
zoecarver
e0adf7e06a [libc++][NFC] Move incrementable_traits and indirectly_readable_traits into separate headers.
Differential Revision: https://reviews.llvm.org/D100682
2021-04-19 14:31:30 -04:00
Arthur O'Dwyer
5e7367d3e4 Add a missing debug assertion in <list>.
This came up in D100595.

Differential Revision: https://reviews.llvm.org/D100728
2021-04-18 19:40:17 -04:00
Arthur O'Dwyer
e880c19c6a [libc++] [CI] Fail if the headers contain cyclic dependencies.
Since we have a tool to detect cycles now; and since we're entering
a phase where people can easily introduce cycles by accident (D100682)
or by request (D90999), I think it's increasingly important to shift
the burden of detecting these cycles onto the buildbot instead of
the poor human reviewer.

Also, grep for non-ASCII characters (such as U+200B and U+00AD)
and hard tabs; don't let those get checked in.

Differential Review: https://reviews.llvm.org/D100703
2021-04-18 12:58:04 -04:00
Mark de Wever
01ace074fc [libc++] Implements ranges::enable_borrowed_range
This is the initial patch to implement ranges in libc++.

Implements parts of:
- P0896R4 One Ranges Proposal
- P1870 forwarding-range is too subtle
- LWG3379 in several library names is misleading

Reviewed By: ldionne, #libc, cjdb, zoecarver, Quuxplusone

Differential Revision: https://reviews.llvm.org/D90999
2021-04-18 13:35:08 +02:00
Arthur O'Dwyer
863d5c4e4d [libc++] Remove hard tabs, U+00AD, and U+200B from all libc++ headers. NFCI. 2021-04-17 17:03:20 -04:00
Jennifer Chukwu
21bef4e11e [NFC] Fixed Typos
Reviewed By: xgupta

Differential Revision: https://reviews.llvm.org/D100705
2021-04-17 22:02:23 +05:30
Mark de Wever
f8f60297d7 [libcxx][doc] Fixes typos. 2021-04-17 18:01:32 +02:00
Louis Dionne
1f8a6dcf12 [libc++] Fix LWG 2874: Constructor shared_ptr::shared_ptr(Y*) should be constrained.
This patch fixes LWG2874. It is based on the original patch by Zoe Carver
originally uploaded at D81417.

Differential Revision: https://reviews.llvm.org/D81417
2021-04-16 09:54:20 -04:00
Petr Hosek
9ac988f6a8 [libcxx] Make the GDB pretty printer test less strict
This is a workaround for PR48937. GDB can sometimes print additional
warnings which currently fails the test. Use re.search instead of
re.match to ignore this additional output.

Differential Revision: https://reviews.llvm.org/D99532
2021-04-15 23:33:22 -07:00
Christopher Di Bella
0148b65372 [libcxx] adds cpp17-.*iterator concepts for iterator_traits
The `iterator_traits` patch became too large for a concise review, so
the "bloat" —as it were— was moved into this patch. Also tests most
C++[98,17] iterator types to confirm backwards compatibility is
successful (regex iterators are intentionally not present, but directory
iterators are due to a peculiar error encountered while patching
`iterator_traits`).

Depends on D99461.

Differential Revision: https://reviews.llvm.org/D99854
2021-04-16 03:14:42 +00:00
Christopher Di Bella
f280505aa0 [libcxx] adds std::indirectly_readable_traits to <iterator>
Implements parts of:
    * P0896R4 The One Ranges Proposal
    * LWG3446 `indirectly_readable_traits` ambiguity for types with both `value_type` and `element_type`

Depends on D99141.

Differential Revision: https://reviews.llvm.org/D99461
2021-04-15 23:59:02 +00:00