Commit Graph

9985 Commits

Author SHA1 Message Date
Nikolas Klauser
c8eff9560f [libc++] Add a clang-tidy check to make sure we use _Uglyfied attribute names
Reviewed By: ldionne, #libc

Spies: krytarowski, jdoerfert, libcxx-commits

Differential Revision: https://reviews.llvm.org/D142322
2023-02-01 18:57:06 +01:00
Nikolas Klauser
157c12310c Revert "[libc++] Fix ODR violation with __exception_guard in mixed exceptions builds"
This reverts commit 561105fb9d.

This breaks C++03 with -fno-exceptions.
2023-02-01 16:05:18 +01:00
Alexander Kornienko
561105fb9d [libc++] Fix ODR violation with __exception_guard in mixed exceptions builds
This fix was proposed in https://reviews.llvm.org/D133661#4095018
2023-02-01 15:01:12 +01:00
Konstantin Varlamov
3fe3f9c51c [libc++][ranges] Fix incorrect integer typedef in elements_view test.
Differential Revision: https://reviews.llvm.org/D142951
2023-01-31 15:29:00 -08:00
Louis Dionne
a845b5b4fb [libc++] Use bounded iterators in std::string_view when the debug mode is enabled
Differential Revision: https://reviews.llvm.org/D142903
2023-01-31 18:23:46 -05:00
Mark de Wever
a125659f5e [NFC][libc++] Addresses LWG3781.
LWG3781 The exposition-only alias templates cont-key-type and
  cont-mapped-type should be removed

Libc++ never implemented these aliases.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D142912
2023-01-31 20:09:05 +01:00
Mark de Wever
f02c9e6f26 [libc++] Addresses LWG3755.
LWG3755 tuple-for-each can call user-defined operator,

Reviewed By: #libc, ldionne, philnik

Differential Revision: https://reviews.llvm.org/D142909
2023-01-31 20:08:07 +01:00
Mark de Wever
26597bf141 [libc++] Marks LWG2970 as complete.
LWG2970 Return type of std::visit misspecified

Was applied in D86006 including tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142840
2023-01-31 20:02:45 +01:00
Mark de Wever
87451cf05a [libc++] Partly addresses LWG3798.
LWG3798 Rvalue reference and iterator_category

The changes are only applied to `ranges::transform_view`, the other
views haven't been implemented yet.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142815
2023-01-31 20:00:40 +01:00
Mark de Wever
76804e89b3 [libc++] Addresses LWG3764.
LWG3764 reference_wrapper::operator() should propagate noexcept

As drive-by adds constexpr to the synopsis, since it has already been
implemented.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142814
2023-01-31 19:59:16 +01:00
Mark de Wever
0729010488 [NFC][libc++][format] Uses retarget buffer.
Lets the tuple formatter use the retarget buffer added for the range
formatter.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142838
2023-01-31 19:54:53 +01:00
Mark de Wever
a7f8ddc4e2 [libc++] Fixes the Clang modular build.
The patch
430b397f67 ("[libc++] Granularize <type_traits> includes in <iterator>") missed some exports in the modulemap with became apparent in the reverting commit 12cb1cb372.

This fixes the issue by updating the modulemap. Note that the Clang ICE is not fixed by this change.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142690
2023-01-31 19:20:46 +01:00
Chuanqi Xu
226c444b38 [libc++] Remove <experimental/coroutine>
We've been shipping <coroutine> since LLVM 14, so LLVM 17 won't ship
the <experimental/coroutine> header per our policy for removing TSes.

Differential Revision: https://reviews.llvm.org/D108697
2023-01-30 16:32:48 -05:00
Louis Dionne
bab1a14ccc [libc++] Add missing include promote.h in <cmath>
As a fly-by, also remove a superfluous <cstddef> include in promote.h.

Differential Revision: https://reviews.llvm.org/D142657
2023-01-30 16:26:19 -05:00
Nikolas Klauser
934650b24f [libc++] Add [[clang::lifetimebound]] to min/max algorithms
Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D142608
2023-01-30 18:01:46 +01:00
Louis Dionne
1562e51491 [libc++] Don't assume that string_view::const_iterator is a raw pointer
Our implementation of std::format assumed that string_view's iterators
were raw pointers in various places. If we want to introduce a checked
iterator in debug mode, that won't be true anymore. This patch removes
that assumption.

Differential Revision: https://reviews.llvm.org/D138795
2023-01-30 10:19:32 -05:00
Hans Wennborg
7bf5f62574 Revert "[ASan][libcxx] Annotating std::vector with all allocators"
This caused false container-overflow errors when using a custom allocator that
touches the memory on deallocation: GitHub Issue #60384

> This revision is a part of a series of patches extending
> AddressSanitizer C++ container overflow detection
> capabilities by adding annotations, similar to those existing
> in std::vector, to std::string and std::deque collections.
> These changes allow ASan to detect cases when the instrumented
> program accesses memory which is internally allocated by
> the collection but is still not in-use (accesses before or
> after the stored elements for std::deque, or between the size and
> capacity bounds for std::string).
>
> The motivation for the research and those changes was a bug,
> found by Trail of Bits, in a real code where an out-of-bounds read
> could happen as two strings were compared via a std::equals function
> that took iter1_begin, iter1_end, iter2_begin iterators
> (with a custom comparison function).
> When object iter1 was longer than iter2, read out-of-bounds on iter2
> could happen. Container sanitization would detect it.
>
> In revision D132522, support for non-aligned memory buffers (sharing
> first/last granule with other objects) was added, therefore the
> check for standard allocator is not necessary anymore.
> This patch removes the check in std::vector annotation member
> function (__annotate_contiguous_container) to support
> different allocators.
>
> If you have any questions, please email:
>  - advenam.tacet@trailofbits.com
>  - disconnect3d@trailofbits.com
>
> Reviewed By: #libc, #sanitizers, philnik, vitalybuka
>
> Spies: EricWF, philnik, #sanitizers, libcxx-commits
>
> Differential Revision: https://reviews.llvm.org/D136765

This reverts commit 4905550268.
2023-01-30 13:24:44 +01:00
varconst
c2b3986e39 [libc++][ranges] Temporarily mark ranges::join_view as experimental.
This is in anticipation of https://isocpp.org/files/papers/D2770R0.html,
which is ABI-breaking for `join_view`.

Differential Revision: https://reviews.llvm.org/D142520
2023-01-30 00:36:07 -08:00
Konstantin Varlamov
fdb709be7b [libc++] Fix some missed return 0 statements in test main functions. 2023-01-30 00:30:52 -08:00
Mark de Wever
a3bfd2bc48 [libc++] Addresses LWG3754
LWG3754 Class template expected synopsis contains declarations that do
  not match the detailed description

This parts of the detailed synopsis that is not copied in libc++, so
effectively there's nothing to do.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D142809
2023-01-28 18:15:48 +01:00
Mark de Wever
4fa997ddf4 [libc++] Disables a test in clang-17.
This test already had issues and bumping main to 17 causes them to fail
again.
2023-01-27 17:03:11 +01:00
Louis Dionne
051bcd4f31 [libc++] Add documentation for reproducing CI issues locally
Differential Revision: https://reviews.llvm.org/D142566
2023-01-26 14:52:20 -05:00
Louis Dionne
36080434a8 [libc++] Move the definition of aligned allocation helpers outside of <new>
They are not needed in <new> -- in fact they are only needed in .cpp files.
Getting those out of the way makes the headers smaller and also makes it
easier to use the library on platforms where aligned allocation is not
available.

Differential Revision: https://reviews.llvm.org/D139231
2023-01-26 14:41:13 -05:00
Nikolas Klauser
ba43f3e857 [libc++][NFC] Rename multidimentional uninitialized algorithms
Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D142526
2023-01-26 09:58:29 +01:00
Advenam Tacet
4905550268 [ASan][libcxx] Annotating std::vector with all allocators
This revision is a part of a series of patches extending
AddressSanitizer C++ container overflow detection
capabilities by adding annotations, similar to those existing
in std::vector, to std::string and std::deque collections.
These changes allow ASan to detect cases when the instrumented
program accesses memory which is internally allocated by
the collection but is still not in-use (accesses before or
after the stored elements for std::deque, or between the size and
capacity bounds for std::string).

The motivation for the research and those changes was a bug,
found by Trail of Bits, in a real code where an out-of-bounds read
could happen as two strings were compared via a std::equals function
that took iter1_begin, iter1_end, iter2_begin iterators
(with a custom comparison function).
When object iter1 was longer than iter2, read out-of-bounds on iter2
could happen. Container sanitization would detect it.

In revision D132522, support for non-aligned memory buffers (sharing
first/last granule with other objects) was added, therefore the
check for standard allocator is not necessary anymore.
This patch removes the check in std::vector annotation member
function (__annotate_contiguous_container) to support
different allocators.

If you have any questions, please email:
 - advenam.tacet@trailofbits.com
 - disconnect3d@trailofbits.com

Reviewed By: #libc, #sanitizers, philnik, vitalybuka

Spies: EricWF, philnik, #sanitizers, libcxx-commits

Differential Revision: https://reviews.llvm.org/D136765
2023-01-25 19:04:15 +01:00
Arsen Arsenović
21d9282ae2 libcxx: Don't apply ABI tags to extern "C" fns
GCC rejects ABI tags on non mangled functions, as they would otherwise
be a no-op.  This commit replaces such instances with equivalent
_LIBCPP_HIDE_FROM_ABI constants but without ABI tags attached.

  .../include/c++/v1/__support/musl/xlocale.h:28:68: error: 'abi_tag'
  attribute applied to extern "C" declaration 'long long int
  strtoll_l(const char*, char**, int, locale_t)'
     28 | strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t) {
        |                                                                    ^

Bug: https://bugs.gentoo.org/869038

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142415
2023-01-25 07:35:33 +00:00
Tom Stellard
603c286334 Bump the trunk major version to 17 2023-01-24 22:57:27 -08:00
Louis Dionne
17c05a44d9 [libc++] Introduce a compile-time mechanism to override __libcpp_verbose_abort
This changes the mechanism for verbose termination (again!) to make it
support compile-time customization in addition to link-time customization,
which is important for users who need fine-grained control over what code
gets generated around sites that call the verbose termination handler.

This concern had been raised to me both privately by prospecting users
and in https://llvm.org/D140944, so I think it is clearly worth fixing.

We still support _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED for
a limited time since the same functionality can be achieved by overriding
the _LIBCPP_VERBOSE_ABORT macro.

Differential Revision: https://reviews.llvm.org/D141326
2023-01-24 21:39:14 -05:00
yronglin
002b190d37 [NFC][libc++] Remove __unexpected namespace
Remove __unexpected namespace.

Reviewed By: philnik, #libc, ldionne

Differential Revision: https://reviews.llvm.org/D141947
2023-01-25 09:12:23 +08:00
Mark de Wever
a6c43e8ca8 [libc++][format] Fixes usage of contiguous ranges.
The contiguous range made incorrect assumptions for certain input
ranges.

Fixes llvm.org/PR60164

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142302
2023-01-24 18:08:53 +01:00
Mark de Wever
7c3a7c727b [libc++][doc] Updates format status.
The paper
- P2286R8 Formatting ranges
is fully implemented modulo its feature test macro. This macro has been
revised by
- LWG3750 Too many papers bump __cpp_lib_format
The new macro depends on
- P2585R0 Improving default container formatting
This paper revises parts of P2286R8 and adds new formatter
specializations. The specialization for debug strings has some wording
issues, which is addresses in this paper
- P2733R0 Fix handling of empty specifiers in std::format

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142153
2023-01-24 17:20:56 +01:00
Hui
a2b3ab8f77 [libc++][ranges] implement std::ranges::split_view
- implement `std::ranges::split_view` (last c++20 view)
- Work in process on testing iterator/sentinel, but since we are
getting closer to the deadline, I'd like to send the review early

Differential Revision: https://reviews.llvm.org/D142063
2023-01-24 09:03:33 +00:00
Louis Dionne
3c8397fa83 [libc++] Fix installation path for the modulemap
As pointed out in a post-commit comment of https://reviews.llvm.org/rGd00e035a4270.

Differential Revision: https://reviews.llvm.org/D142365
2023-01-23 20:12:26 -05:00
Hui
9af9d39a47 [libc++] implement P1020R1 P1973R1 make_unique[shared]_for_overwrite
Differential Revision: https://reviews.llvm.org/D140913
2023-01-23 21:07:22 +00:00
Mark de Wever
4f7d7eb98a [libc++][doc] Fixes the usage of improper markup. 2023-01-23 18:26:18 +01:00
Nikolas Klauser
06385491a6 [libc++] Refactor clang-query checks to clang-tidy checks to get less obscure error messages
Also remove clang-query related code, since it's unused now.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D141805
2023-01-23 05:01:28 +01:00
Nikolas Klauser
7458908f12 [libc++] Improve binary size when using __transaction
__exception_guard is a no-op in -fno-exceptions mode to produce better code-gen. This means that we don't provide the strong exception guarantees. However, Clang doesn't generate cleanup code with exceptions disabled, so even if we wanted to provide the strong exception guarantees we couldn't. This is also only relevant for constructs with a stack of -fexceptions > -fno-exceptions > -fexceptions code, since the exception can't be caught where exceptions are disabled. While -fexceptions > -fno-exceptions is quite common (e.g. libc++.dylib > -fno-exceptions), having another layer with exceptions enabled seems a lot less common, especially one that tries to catch an exception through -fno-exceptions code.

Fixes https://github.com/llvm/llvm-project/issues/56783

Reviewed By: ldionne, Mordante, huixie90, #libc

Spies: EricWF, alexfh, hans, joanahalili, libcxx-commits

Differential Revision: https://reviews.llvm.org/D133661
2023-01-23 04:57:32 +01:00
Piotr Fusik
898b5c9f5e [NFC] Fix "form/from" typos
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142007
2023-01-22 20:05:51 +01:00
Mark de Wever
d819703410 [libc++][test] Disable parts requiring locales.
This part should be guarded, but there are no proper guards yet.
Therefore disable the offending part. This was reported post commit in
D140653.
2023-01-22 16:51:13 +01:00
Nikolas Klauser
3ed8b93714 [libc++] Rename take_while_view::__sentinel to __take_while_view_sentinel
This makes it easier to specialize traits classes, like __segmented_iterator_traits.

Reviewed By: var-const, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D142276
2023-01-22 07:44:08 +01:00
Nikolas Klauser
fafed06b2e [libc++] Granularize <type_traits> includes in <bit>, <numbers> and <coroutine>
`<coroutine>` seems to be new enough to not be a huge problem.

Reviewed By: Mordante, #libc

Spies: libcxx-commits, ChuanqiXu

Differential Revision: https://reviews.llvm.org/D140600
2023-01-21 15:09:21 +01:00
Nikolas Klauser
987f08fe22 [libc++] Implement P1413R3 (Deprecate std::aligned_storage and std::aligned_union)
There are no tests for the aliases because clang doesn't diagnose deprecated template aliases currently.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D127678
2023-01-21 15:08:27 +01:00
Ed Maste
7ec6c62905 [libc++] Add FreeBSD XFAILs in preparation for CI
This at least allows us to stand up libc++ FreeBSD CI and avoid future
regressions.  The failures do need to be addressed, and can be done
iteratively.

Reviewed By: philnik, Mordante

Differential Revision: https://reviews.llvm.org/D141542
2023-01-20 16:49:30 -05:00
Konstantin Belousov
83387dbc18 [libc++] add FreeBSD atomic wait support
Reviewed By: philnik

Differential Revision: https://reviews.llvm.org/D142134
2023-01-20 16:39:38 -05:00
Mark de Wever
857cbb9276 [libc++][format] range-default-formatter for set.
Implements the range-default-formatter specialization range_format::set.

Implements parts of
- P2286R8 Formatting Ranges
- P2585R0 Improving default container formatting

Depends on D140801

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D141195
2023-01-20 17:39:59 +01:00
Nikolas Klauser
e4e0288f5b [libc++] Move iota_view::iterator and sentinel out of iota_view
This makes it a lot easier to specialize traits types for it, like __segmented_iterator_traits.

Reviewed By: var-const, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D141454
2023-01-20 17:12:05 +01:00
Nikolas Klauser
5f6812748e [libc++] Enable clang-tidy from the buildkite pipeline instead of hard-coding it in run-buildbot
Reviewed By: ldionne, #libc, Mordante, emaste

Spies: emaste, Mordante, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D141294
2023-01-20 17:10:46 +01:00
Nikolas Klauser
21f4232dd9 [libc++] Enable segmented iterator optimizations for join_view::iterator
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D138413
2023-01-20 07:55:58 +01:00
Nikolas Klauser
79b917b6e8 [libc++] Mark LWG3349 as complete 2023-01-20 07:06:50 +01:00
Nikolas Klauser
e52ce7f554 [libc++] Remove old CI configurations and update the supported compiler versions
`_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` doesn't do anything anymore in C++23 mode, so it's now just a duplicate of the C++23 configuration.
Also add new steps to the post-release checklist for updating the supported compilers.

Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D133364
2023-01-20 06:04:35 +01:00