12060 Commits

Author SHA1 Message Date
Tobias Hieta
6553889987
Bump version to 19.1.7 2025-01-13 11:48:09 +01:00
Tobias Hieta
c9e72b3945
Bump version to 19.1.6 2024-12-13 14:49:03 +01:00
Tobias Hieta
51dee6b64f
Bump version to 19.1.5 2024-11-19 13:43:39 +01:00
Louis Dionne
ec2e1cae2c
[libc++] Fix broken configuration system-libcxxabi on Apple (#110920)
On Apple platforms, using system-libcxxabi as an ABI library wouldn't
work because we'd try to re-export symbols from libc++abi that the
system libc++abi.dylib might not have. Instead, only re-export those
symbols when we're using the in-tree libc++abi.

This does mean that libc++.dylib won't re-export any libc++abi symbols
when building against the system libc++abi, which could be fixed in
various ways. However, the best solution really depends on the intended
use case, so this patch doesn't try to solve that problem.

As a drive-by, also improve the diagnostic message when the user forgets
to set the LIBCXX_CXX_ABI_INCLUDE_PATHS variable, which would previously
lead to a confusing error.

Closes #104672

(cherry picked from commit 21da4e7f51c7adfd0b1c5defc8bd0d16ea1ce759)
2024-11-18 17:01:02 +01:00
Tobias Hieta
a3f0f1d004
Bump version to 19.1.4 2024-11-11 14:12:23 +01:00
Tobias Hieta
17365dfd21
Bump version to 19.1.3 2024-10-29 09:57:40 +01:00
Louis Dionne
c36d7fd568 [libc++] Avoid re-exporting a few specific symbols from libc++abi (#109054)
In 6a884a9aef39, I synchronized the export list of libc++abi to the
export list of libc++. From the linker's perspective, this caused these
symbols to be taken from libc++.dylib instead of libc++abi.dylib.

However, that can be problematic when back-deploying. Indeed, this means
that the linker will encode an undefined reference to be fullfilled by
libc++.dylib, but when backdeploying against an older system, that
symbol might only be available in libc++abi.dylib.

Most of the symbols that started being re-exported after 6a884a9aef39
turn out to be implementation details of libc++abi, so nobody really
depends on them and this back-deployment issue is inconsequential.

However, we ran into issues with a few of these symbols while testing
LLVM 19, which led to this patch. This slipped between the cracks and
that is why the patch is coming so long after the original patch landed.

In the future, a follow-up cleanup would be to stop exporting most of
the _cxxabiv1_foo_type_infoE symbols from both libc++abi and libc++
since they are implementation details that nobody should be relying on.

rdar://131984512
(cherry picked from commit 677e8cd6ff51e178bcb4669104763f71a2de106c)
2024-10-15 08:50:13 +02:00
Louis Dionne
1360969b81 [libc++] Adjust the version of __cpp_lib_ranges in C++20 mode
This is a (very partial) cherry-pick of #101715 to fix this oversight
in the LLVM 19 release.
2024-10-11 15:30:47 +08:00
Louis Dionne
b0b36c00f5 [libc++] Fix name of is_always_lock_free test which was never being run (#106077)
(cherry picked from commit b45661953e6974782b0ccada6f0784db04bc693f)
2024-10-11 07:59:25 +02:00
Jakub Mazurkiewicz
4f844b265d
[libc++] Follow-up to "Poison Pills are Too Toxic"
* Update release notes and `Cxx23.html`
* Update `__cpp_lib_ranges` feature test macro
2024-10-11 07:54:27 +02:00
Tobias Hieta
d5498c39fe
Bump version to 19.1.2 2024-10-01 16:04:00 +02:00
David Spickett
23eadbda36 [libcxx][test] Use smaller time range for 32 bit time_t (#104762)
This fixes the test on Arm 32 bit Ubuntu Jammy where time_t is 32 bit.

(cherry picked from commit cdd608b8f0ce090b3568238387df368751bdbb5d)
2024-10-01 09:03:25 +02:00
David Spickett
4dbe72f91a [lldb][test] Mark sys_info zdump test unsupported on 32 bit Arm Linux
Until https://github.com/llvm/llvm-project/pull/103056 lands
or another more appropriate check can be found.

This test fails on Ubuntu Focal where zdump is built with 32 bit time_t
but passes on Ubuntu Jammy where zdump is built with 64 bit time_t.

Marking it unsupported means Linaro can upgrade its bots to Ubuntu
Jammy without getting an unexpected pass.

(cherry picked from commit 6f6422f4a2b8647a59936c131e50a79906d89510)
2024-10-01 09:03:25 +02:00
Tobias Hieta
fae11d419d
Bump version to 19.1.1 2024-10-01 09:02:07 +02:00
Louis Dionne
53010fcf66 [libc++] Fix AppleClang version number when checking for __builtin_verbose_trap support (#110161)
We should have been checking against 1700, not 17000, which was a typo.

(cherry picked from commit 1eba87904b0cbaaee82cfdb835528b85d99320ef)
2024-10-01 08:56:18 +02:00
Louis Dionne
8a25c601eb [libc++] Disable the clang-tidy checks to get CI back (#109989)
The CI has been a complete mess for the past week, and the only thing
preventing it from being back is the Clang tidy checks. Disable them (as
a total hack) to get CI back.

(cherry picked from commit 78c6506543dee13c9335edc5c85bc73c4853fbd7)
2024-09-26 16:00:43 -04:00
Konstantin Varlamov
82f3a4a32d Guard an include of <ostream> in <chrono> with availability macro (#108429)
This fixes a regression introduced in
https://github.com/llvm/llvm-project/pull/96035.

(cherry picked from commit 127c34948bd54e92ef2ee544e8bc42acecf321ad)
2024-09-16 20:31:52 +02:00
Ties Stuij
6f623478d4 [libcxx] don't #include <cwchar> if wide chars aren't enabled (#99911)
Pull request #96032 unconditionall adds the `cwchar` include in the
`format` umbrella header. However support for wchar_t can be disabled in
the build system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking
the `_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.

For clarity I've also merged the include header section that `cwchar`
was in with the one above as they were both guarded by the same `#if`
logic.

(cherry picked from commit ec56790c3b27df4fa1513594ca9a74fd8ad5bf7f)
2024-09-01 10:20:37 +02:00
Louis Dionne
6883c490e0 [libc++] Add missing include to three_way_comp_ref_type.h
We were using a `_LIBCPP_ASSERT_FOO` macro without including `<__assert>`.

rdar://134425695
(cherry picked from commit 0df78123fdaed39d5135c2e4f4628f515e6d549d)
2024-09-01 10:11:08 +02:00
Louis Dionne
90f2d48965 [libc++] Fix rejects-valid in std::span copy construction (#104500)
Trying to copy-construct a std::span from another std::span holding an
incomplete type would fail as we evaluate the SFINAE for the range-based
constructor. The problem was that we checked for __is_std_span after
checking for the range being a contiguous_range, which hard-errored
because of arithmetic on a pointer to incomplete type.

As a drive-by, refactor the whole test and format it.

Fixes #104496

(cherry picked from commit 99696b35bc8a0054e0b0c1a26e8dd5049fa8c41b)
2024-08-19 09:17:27 +02:00
Louis Dionne
4d4a4100f6 [libc++] Fix ambiguous constructors for std::complex and std::optional (#103409)
Fixes #101960

(cherry picked from commit 4d08bb11eea5907fa9cdfe4c7bc9d5c91e79c6a7)
2024-08-15 09:40:37 +02:00
Brian Cain
a3b18fcd24 [libc++] Use a different smart ptr type alias (#102089)
The `_SP` type is used by some C libraries and this alias could conflict
with it.

(cherry picked from commit 7951673d408ee64744d0b924a49db78e8243d876)
2024-08-15 09:34:45 +02:00
PaulXiCao
2c29bd3d4c [libc++][math] Fix undue overflowing of std::hypot(x,y,z) (#100820)
This is in relation to mr #93350. It was merged to main, but reverted
because of failing sanitizer builds on PowerPC.

The fix includes replacing the hard-coded threshold constants (e.g.
`__overflow_threshold`) for different floating-point sizes by a general
computation using `std::ldexp`. Thus, it should now work for all architectures.
This has the drawback of not being `constexpr` anymore as `std::ldexp`
is not implemented as `constexpr` (even though the standard mandates it
for C++23).

Closes #92782

(cherry picked from commit 72825fde03aab3ce9eba2635b872144d1fb6b6b2)
2024-08-13 09:07:01 +02:00
Mitch Phillips
5230e327a1 Revert "[libc++][math] Fix undue overflowing of std::hypot(x,y,z) (#93350)"
This reverts commit 9628777479a970db5d0c2d0b456dac6633864760.

More details in https://github.com/llvm/llvm-project/pull/93350, but
this broke the PowerPC sanitizer bots.

(cherry picked from commit 1031335f2ee1879737576fde3a3425ce0046e773)
2024-08-13 09:07:01 +02:00
Xing Xue
f6381989f4 [NFC][libc++][test][AIX] UnXFAIL LIT test transform.pass.cpp (#102338)
Remove `XFAIL: LIBCXX-AIX-FIXME` from lit test `transform.pass.cpp` now
that AIX system call `wcsxfrm`/`wcsxfrm_l` is fixed in AIX 7.2.5.8 and
7.3.2.2 and buildbot machines have been upgraded.

Backported from commit cb5912a71061c6558bd4293596dcacc1ce0ca2f6
2024-08-12 10:39:47 +02:00
Mark de Wever
01a49d21c7 [libc++][bit] Improves rotate functions. (#98032)
Investigating #96612 shows our implementation was different from the
Standard and could cause UB. Testing the codegen showed quite a bit of
assembly generated for these functions. The functions have been written
differently which allows Clang to optimize the code to use simple CPU
rotate instructions.

Fixes: https://github.com/llvm/llvm-project/issues/96612
2024-08-10 11:52:40 +02:00
Xing Xue
3ee69f2405 [NFC][libc++][libc++abi][libunwind][test] Fix/unify AIX triples used in LIT tests (#101196)
This patch fixes/unifies AIX target triples used in libc++, libc++abi,
and libunwind LIT tests.

(cherry picked from commit 2d3655037ccfa276cb0949c2ce0cff56985f6637)
2024-08-02 09:26:00 +02:00
Damien L-G
39e8e7797a [libc++] Increase atomic_ref's required alignment for small types (#99654)
This patch increases the alignment requirement for std::atomic_ref
such that we can guarantee lockfree operations more often. Specifically,
we require types that are 1, 2, 4, 8, or 16 bytes in size to be aligned
to at least their size to be used with std::atomic_ref.

This is the case for most types, however a notable exception is
`long long` on x86, which is 8 bytes in length but has an alignment
of 4.

As a result of this patch, one has to be more careful about the
alignment of objects used with std::atomic_ref. Failure to provide
a properly-aligned object to std::atomic_ref is a precondition
violation and is technically UB. On the flipside, this allows us
to provide an atomic_ref that is actually lockfree more often,
which is an important QOI property.

More information in the discussion at https://github.com/llvm/llvm-project/pull/99570#issuecomment-2237668661.

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
(cherry picked from commit 59ca618e3b7aec8c32e24d781bae436dc99b2727)
2024-08-02 09:25:20 +02:00
Louis Dionne
0e615206e3 [libc++] Revert "Use GCC type traits builtins for remove_cv and remove_cvref (#81386)"
This reverts commit 55357160d0e151c32f86e1d6683b4bddbb706aa1.
This is only being reverted from the LLVM 19 branch as a
convenience to avoid breaking some IDEs which were not ready
for that change.

Fixes #99464
2024-08-01 09:21:02 +02:00
Mark de Wever
3389604cd9 [libc++][spaceship] Marks P1614 as complete. (#99375)
Implements parts of:
- P1902R1 Missing feature-test macros 2017-2019

Completes:
- P1614R2 The Mothership has Landed

Fixes #100018
2024-07-30 17:06:54 +02:00
Louis Dionne
f53633b1e2 [libc++][libc++abi] Minor follow-up changes after ptrauth upstreaming (#87481)
This patch applies the comments provided on #84573. This is done as a
separate PR to avoid merge conflicts with downstreams that already had
ptrauth support.

(cherry picked from commit e64e745e8fb802ffb06259b1a5ba3db713a17087)
2024-07-29 10:05:31 +02:00
Louis Dionne
47fafad155 [libc++] Fix bug in atomic_ref's calculation of lock_free-ness (#99570)
The builtin __atomic_always_lock_free takes into account the type of the
pointer provided as the second argument. Because we were passing void*,
rather than T*, the calculation failed. This meant that
atomic_ref<T>::is_always_lock_free was only true for char & bool.

This bug exists elsewhere in the atomic library (when using GCC, we fail
to pass a pointer at all, and we fail to correctly align the atomic like
_Atomic would).

This change also attempts to start sorting out testing difficulties with
this function that caused the bug to exist by using the
__GCC_ATOMIC_(CHAR|SHORT|INT|LONG|LLONG|POINTER)_IS_LOCK_FREE predefined
macros to establish an expected value for `is_always_lock_free` and
`is_lock_free` for the respective types, as well as types with matching
sizes and compatible alignment values.

Using these compiler pre-defines we can actually validate that certain
types, like char and int, are actually always lock free like they are on
every platform in the wild.

Note that this patch was actually authored by Eric Fiselier but I picked
up the patch and GitHub won't let me set Eric as the primary author.

Co-authored-by: Eric Fiselier <eric@efcs.ca>
(cherry picked from commit cc1dfb37aa84d1524243b83fadb8ff0f821e03e9)
2024-07-27 16:03:10 +02:00
Louis Dionne
ec17a7a759 [libc++] Add missing xlocale.h include on Apple and FreeBSD (#99689)
The `<locale>` header uses `strtoll_l` and friends which are defined in
`<xlocale.h>` on these platforms. While this works via transitive
includes when modules are disabled, this doesn't work anymore if the
platforms are modularized properly.

(cherry picked from commit a55df237375e98cfc2520d5eb1a23b302ef02ba0)
2024-07-26 09:29:22 +02:00
Mark de Wever
05446fb31a [libc++][spaceship] Implements X::iterator container requirements. (#99343)
This implements the requirements for the container iterator requirements
for array, deque, vector, and `vector<bool>`.

Implements:
- LWG3352 strong_equality isn't a thing

Implements parts of:
- P1614R2 The Mothership has Landed

Fixes: https://github.com/llvm/llvm-project/issues/62486
2024-07-26 09:25:49 +02:00
Louis Dionne
5c03c4fc26 [libc++] Improve behavior when using relative path for LIBCXX_ASSERTION_HANDLER_FILE (#100157)
Fixes #80696

(cherry picked from commit 046a17717d9c5b5385ecd914621b48bdd91524d0)
2024-07-26 09:25:23 +02:00
Mark de Wever
2df1cec9db [libc++][doc] Update the release notes for LLVM 19. (#99061)
This is a preparation for the upcoming LLVM 19 release.
2024-07-26 09:20:03 +02:00
Mark de Wever
c5cd826c05 [libc++][string] Fixes shrink_to_fit. (#97961)
This ensures that shrink_to_fit does not increase the allocated size.

Partly addresses #95161

(cherry picked from commit d0ca9f23e8f25b0509c3ff34ed215508b39ea6e7)
2024-07-24 09:25:07 +02:00
Mark de Wever
a930d1f322 [libc++][vector<bool>] Tests shrink_to_fit requirement. (#98009)
`vector<bool>`'s shrink_to_fit implementation is using the
"swap-to-free-container-resources-trick" which only shrinks when the
input vector is empty. Since the request to shrink_to_fit is
non-binding, this is a valid implementation. It is not a high-quality
implementation. Since `vector<bool>` is not a very popular container the
implementation has not been changed and only a test to validate the
non-growing property has been added.

This was discovered while investigating #95161.

(cherry picked from commit c2e438675754b83c31d7d5ba40cb13fe77e795de)
2024-07-24 09:24:42 +02:00
PaulXiCao
40af7ee9c1 [libc++][math] Fix undue overflowing of std::hypot(x,y,z) (#93350)
The 3-dimentionsional `std::hypot(x,y,z)` was sub-optimally implemented.
This lead to possible over-/underflows in (intermediate) results which
can be circumvented by this proposed change.

The idea is to to scale the arguments (see linked issue for full
discussion).

Tests have been added for problematic over- and underflows.

Closes #92782

(cherry picked from commit 9628777479a970db5d0c2d0b456dac6633864760)
2024-07-24 09:24:11 +02:00
Tobias Hieta
c2dbaeb91a
Bump version to 19.1.0git 2024-07-23 11:06:16 +02:00
David Benjamin
bcf9fb9802
[libc++][hardening] Use bounded iterators in std::vector and std::string (#78929)
~~NB: This PR depends on #78876. Ignore the first commit when reviewing,
and don't merge it until #78876 is resolved. When/if #78876 lands, I'll
clean this up.~~

This partially restores parity with the old, since removed debug build.
We now can re-enable a bunch of the disabled tests. Some things of note:

- `bounded_iter`'s converting constructor has never worked. It needs a
friend declaration to access the other `bound_iter` instantiation's
private fields.

- The old debug iterators also checked that callers did not try to
compare iterators from different objects. `bounded_iter` does not
currently do this, so I've left those disabled. However, I think we
probably should add those. See
https://github.com/llvm/llvm-project/issues/78771#issuecomment-1902999181

- The `std::vector` iterators are bounded up to capacity, not size. This
makes for a weaker safety check. This is because the STL promises not to
invalidate iterators when appending up to the capacity. Since we cannot
retroactively update all the iterators on `push_back()`, I've instead
sized it to the capacity. This is not as good, but at least will stop
the iterator from going off the end of the buffer.

There was also no test for this, so I've added one in the `std`
directory.

- `std::string` has two ambiguities to deal with. First, I opted not to
size it against the capacity. https://eel.is/c++draft/string.require#4
says iterators are invalidated on an non-const operation. Second,
whether the iterator can reach the NUL terminator. The previous debug
tests and the special-case in https://eel.is/c++draft/string.access#2
suggest no. If either of these causes widespread problems, I figure we
can revisit.

- `resize_and_overwrite.pass.cpp` assumed `std::string`'s iterator
supported `s.begin().base()`, but I see no promise of this in the
standard. GCC also doesn't support this. I fixed the test to use
`std::to_address`.

- `alignof.compile.pass.cpp`'s pointer isn't enough of a real pointer.
(It needs to satisfy `NullablePointer`, `LegacyRandomAccessIterator`,
and `LegacyContiguousIterator`.) `__bounded_iter` seems to instantiate
enough to notice. I've added a few more bits to satisfy it.

Fixes #78805
2024-07-22 22:44:25 -07:00
Ryan Prichard
a1359f5ed4
[libc++][Android] Pass -no-metrics to emulator (#99627)
The Android Emulator has started printing this message, so pass the
`-no-metrics` option:

```
##############################################################################
##                        WARNING - ACTION REQUIRED                         ##
##  Consider using the '-metrics-collection' flag to help improve the       ##
##  emulator by sending anonymized usage data. Or use the '-no-metrics'     ##
##  flag to bypass this warning and turn off the metrics collection.        ##
##  In a future release this warning will turn into a one-time blocking     ##
##  prompt to ask for explicit user input regarding metrics collection.     ##
##                                                                          ##
##  Please see '-help-metrics-collection' for more details. You can use     ##
##  '-metrics-to-file' or '-metrics-to-console' flags to see what type of   ##
##  data is being collected by emulator as part of usage statistics.        ##
##############################################################################
```
2024-07-22 15:30:31 -07:00
nicole mazzuca
4189226236
[libc++] Update some C++23 statuses to "Nothing to do" or "Complete" (#99621)
- [P2160R1][] "Locks lock lockables"
- [P2212R2][] "Relax Requirements for `time_point::clock`"
- [P1675R2][] "`rethrow_exception` must be allowed to copy"
- [P2340R1][] "Clarifying the status of the 'C headers'"
- [P2460R2][] "Relax requirements on `wchar_t` to match existing
practices"

Are all papers that change wording without changing implementation
behaviour.

Additionally, [P2736R2][] "Referencing The Unicode Standard", is an
already complete paper in 19.0 (as of [LLVM-86543][])

[P2160R1]: https://wg21.link/p2160r1
[P2212R2]: https://wg21.link/p2212r2
[P1675R2]: https://wg21.link/p1675r2
[P2340R1]: https://wg21.link/p2340r1
[P2460R2]: https://wg21.link/p2460r2
[P2736R2]: https://wg21.link/p2736r2
[LLVM-86543]: https://github.com/llvm/llvm-project/pull/86543
2024-07-22 18:33:41 +02:00
Xiaoyang Liu
3d7622ea0b
[libc++][ranges] LWG3618: Unnecessary iter_move for transform_view::iterator (#91809)
## Introduction

This patch implements LWG3618: Unnecessary `iter_move` for
`transform_view::iterator`.

`transform_view`'s iterator currently specifies a customization point
for `iter_move`. This customization point does the same thing that the
default implementation would do, but its sole purpose is to ensure the
appropriate conditional `noexcept` specification.

## Reference

-
[[range.transform.iterator]](https://eel.is/c++draft/range.transform.iterator)
- [LWG3618](https://cplusplus.github.io/LWG/issue3618)
2024-07-22 18:32:37 +02:00
Martin Storsjö
ec966f699d
[libcxx] [test] Make indentation more consistent in thousands_sep. NFC. (#99844)
This was made inconsistent recently in
f114eddb1923289b696f1b0980cc22c4dbaafa22.
2024-07-22 19:31:47 +03:00
Mark de Wever
14ec4746cc
[libc++] Makes `unique_ptr operator*() noexcept. (#98047)
This implements
 - LWG2762  unique_ptr operator*() should be noexcept.

Differential Revision: https://reviews.llvm.org/D128214
2024-07-21 13:06:02 +02:00
Nikolas Klauser
f9dd885cb6
[libc++] Make std::pair trivially copyable if its members are (#89652)
This makes `std::pair` trivially copyable if its members are and we have
a way to do so. We need either C++20 with requires clauses or support
for `__attribute__((enable_if))`. Only Clang has support for this
attribute, so it's effectively clang or C++20.

Co-authored-by: Christopher Di Bella <cjdb@google.com>
2024-07-20 19:59:06 +02:00
Mark de Wever
afbfb16d29
[libc++][TZDB] Implements zoned_time formatters. (#98347)
Implements parts of:
- P0355 Extending to chrono Calendars and Time Zones
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters
2024-07-20 19:24:41 +02:00
PaulXiCao
af0d731b12
[libc++][math] Mathematical Special Functions: Hermite Polynomial (#89982)
Implementing the Hermite polynomials which are part of C++17's
mathematical special functions. The goal is to get early feedback which
will make implementing the other functions easier. Integration of
functions in chunks (e.g. `std::hermite` at first, then `std::laguerre`,
etc.) might make sense as well (also see note on boost.math below).

I started out from this abandoned merge request:
https://reviews.llvm.org/D58876 .

The C++23 standard defines them in-terms of `/* floating-point type */`
arguments. I have not looked into that.

Note, there is still an ongoing discussion on discourse whether
importing boost.math is an option.
2024-07-20 17:50:05 +02:00
Mark de Wever
f65d7fdcf8
[libc++][vector] Fixes shrink_to_fit. (#97895)
This assures shrink_to_fit does not increase the allocated size.

Partly addresses https://github.com/llvm/llvm-project/issues/95161

---------

Co-authored-by: Mital Ashok <mital.vaja@googlemail.com>
2024-07-20 12:55:44 +02:00