10077 Commits

Author SHA1 Message Date
Petr Hosek
efae3174f0 [CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag
These have the same purposes but two different implementations.
llvm_check_compiler_linker_flag uses CMAKE_REQUIRED_FLAGS which affects
flags used both for compilation and linking which is problematic because
some flags may be link-only and trigger unused argument warning when set
during compilation. llvm_check_linker_flag does not have this issue so
we chose it as the prevailaing implementation.

Differential Revision: https://reviews.llvm.org/D143052
2023-02-22 04:24:49 +00:00
Nikolas Klauser
141471a0cb [runtimes] Remove unused functions from Handle{Libcxx,Libunwind}Flags.cmake
Reviewed By: phosek, #libunwind, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144400
2023-02-22 00:38:44 +01:00
Nikolas Klauser
811b5f52ad [libc++][NFC] Simplify __sort{4,5}
Don't return the number of swaps; it's not used anywhere.

Reviewed By: Mordante, #libc, avogelsgesang

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144478
2023-02-21 19:42:23 +01:00
Nikolas Klauser
b4ecfd3c46 [libc++] Forward to std::memcmp for trivially comparable types in equal
Reviewed By: #libc, ldionne

Spies: ldionne, Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D139554
2023-02-21 17:11:21 +01:00
Nikolas Klauser
e8cb3559ee [libc++] Move constexpr <cstring> functions into their own headers and remove unused <cstring> includes
Reviewed By: ldionne, Mordante, #libc, #libc_abi

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D143329
2023-02-21 16:56:29 +01:00
Nikolas Klauser
d0e95fec65 [runtimes] Remove add_target_flags* functions and use add_flags* instead
Reviewed By: phosek, #libunwind, #libc, #libc_abi

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144398
2023-02-21 13:16:44 +01:00
Nikolas Klauser
0af67d167d [runtimes] Move common functions from Handle{Libcxx,Libcxxabi,Libunwind}Flags.cmake to runtimes/cmake/Modules/HandleFlags.cmake
Reviewed By: phosek, #libunwind, #libc, #libc_abi

Spies: arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144395
2023-02-21 13:15:25 +01:00
Mark de Wever
cf83e79a4b [libc++][format] Disables test on GCC-12.
These tests fail in D144331, for the same reason other format tests fail
in GCC. This is a resource issue.
2023-02-19 16:44:56 +01:00
Mark de Wever
9adf78d6a7 [NFC][libc++][format] Small improvements.
While working on the formatter for the thread::id several minor issues
where spotted. This fixes them.
2023-02-18 18:59:32 +01:00
Mark de Wever
c1877e6465 [NFC][libc++][doc] Fixes formatting. 2023-02-18 18:30:56 +01:00
Nikolas Klauser
b69963eb3f [libc++] Fix header includes in <__atomic/cxx_atomic_impl.h>
Reviewed By: #libc, philnik

Spies: Mordante, paulkirth, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144307
2023-02-18 14:23:24 +01:00
Mark de Wever
2f2ed47714 [libc++][test] Removes rapid-cxx-test.h.
Depends on D142808

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D143383
2023-02-18 12:51:53 +01:00
Nikolas Klauser
b1e09b5fa6 [libc++][NFC] Remove TODOs that are already done 2023-02-17 22:17:54 +01:00
Nikolas Klauser
ef3a3b0726 [libc++][NFC] Replace _VSTD and _LIBCPP_INLINE_VISIBILITY in <__atomic/*>
Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144258
2023-02-17 21:54:07 +01:00
Mark de Wever
8caa8d95af [libc++][format] Addresses LWG3810.
LWG3810 CTAD for std::basic_format_args

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144275
2023-02-17 21:08:24 +01:00
Konstantin Varlamov
f50cad2c55 [libc++] Mark a test relying on typeid as unsupported without RTTI. 2023-02-17 11:21:18 -08:00
Nikolas Klauser
21a543656c [libc++] Add missing include in <__atomic/cxx_atomic_impl.h> 2023-02-17 19:33:25 +01:00
Mark de Wever
2d85683f98 [lib++][format] Uses the new exception test macros.
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D143393
2023-02-17 18:53:14 +01:00
Mark de Wever
261d21f8c3 [libc++] Fixes a flaky test.
While investigating the flaky tests on the mac backdeployment targets
it seems the tests are different than suggested in the LWG issue.
That tests "does work", grabs the mutex, marks the task as done, and
finally calls the notifier.
Our test emulated "does work" after the notification, effectively
sleeping with a lock held. This has been fixed.

A second improvement is that the test fails when, due to OS
scheduling, the condition variable is not used in the main thread.

During discussing the approach of the patch with @ldionne, he
noticed the real reason why the test is flaky; the Apple
backdeployment targets use a dylib, which does not contain the
fix. So the test can't be tested on that platform; it only
proves the LWG issue was correct and the Standard contained
a bug.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D143816
2023-02-17 18:22:09 +01:00
Mark de Wever
7067aee367 [libc++][CI] Switches to clang-format-16.
Uses an absolute path to the selected binary.
Updates the formatting of two files to match clang-format-16 style.

Depends on D144126

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144132
2023-02-17 18:03:49 +01:00
Mark de Wever
f7f86451ec [libc++] Improve the format ignorelist generation.
Several improvements
- Only add files that we actually want to format.
- Sort according to a fixed locale.

Some drive-by fixes
- Rename a text file, this avoids a filter exception.
- Adds a some missing source files extensions.
- Removes unused extensions hh, hxx, cc, and cxx from clang-format.

Reviewed By: philnik, #libc

Differential Revision: https://reviews.llvm.org/D144126
2023-02-17 18:01:57 +01:00
Nikolas Klauser
b22aa3d74f [libc++][NFC] Rename _LIBCPP_NO_EXCEPTIONS to _LIBCPP_HAS_NO_EXCEPTIONS
Other macros that disable parts of the library are named `_LIBCPP_HAS_NO_WHATEVER`.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits, smeenai

Differential Revision: https://reviews.llvm.org/D143163
2023-02-17 17:39:03 +01:00
Mark de Wever
3476b56f0c [libc++][test] Adds more generic test macros.
These macros are intended to replace the macros in rapid-cxx-test.h.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142808
2023-02-17 17:01:58 +01:00
Nikolas Klauser
46db8d822e [libc++] Granularize <atomic>
Reviewed By: Mordante, #libc

Spies: arichardson, libcxx-commits, krytarowski

Differential Revision: https://reviews.llvm.org/D142972
2023-02-17 12:44:32 +01:00
Nikolas Klauser
40a20ae6ab [libc++] Granularize <bit> includes
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D141228
2023-02-17 11:36:19 +01:00
Louis Dionne
23d43e6977 [libc++] Add regression test for std::hash implementation in ABI v1
Differential Revision: https://reviews.llvm.org/D144107
2023-02-16 14:14:39 -05:00
Joe Loser
83014d8770 [libc++] LWG 3857: allow string_view conversion when only traits vary
The `basic_string_view` constructor accepting a contiguous range rejects
converting between `basic_string_view` even when only the trait types vary.
This prevents conversions for converting from `basic_string_view<C, T1>` and
`basic_string<C, T1, A>` to `basic_string_view<C, T2>`.  Recently, this
constructor was made `explicit`, so there's no reason to really forbid this
conversion anymore.

Relax the restriction that the trait types need to match in this constructor.

Differential Revision: https://reviews.llvm.org/D143972
2023-02-16 06:00:01 -07:00
Mark de Wever
a41e1ea2a7 [libc++][CI] Starts using Clang 17.
Reviewed By: #libc, ldionne, Mordante

Differential Revision: https://reviews.llvm.org/D143483
2023-02-15 19:19:16 +01:00
Nikolas Klauser
4f15267d3d [libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= x
This change is almost fully mechanical. The only interesting change is in `generate_feature_test_macro_components.py` to generate `_LIBCPP_STD_VER >=` instead. To avoid churn in the git-blame this commit should be added to the `.git-blame-ignore-revs` once committed.

Reviewed By: ldionne, var-const, #libc

Spies: jloser, libcxx-commits, arichardson, arphaman, wenlei

Differential Revision: https://reviews.llvm.org/D143962
2023-02-15 16:52:25 +01:00
Igor Zhukov
0a0d58f546 [libc++] <algorithm>: ranges::minmax should dereference iterators only once
Reviewed By: philnik, #libc

Differential Revision: https://reviews.llvm.org/D142864
2023-02-15 06:02:12 +07:00
Louis Dionne
33d0d1e36f [runtimes] Rename newconfig.py to config.py -- it's not new anymore
Differential Revision: https://reviews.llvm.org/D144031
2023-02-14 17:21:34 -05:00
Hui
c510c38763 [libc++][NFC] update Range Status for the completion of C++20 ranges
Differential Revision: https://reviews.llvm.org/D142494
2023-02-14 21:27:30 +00:00
Mark de Wever
5c1b8de77d [libc++][doc] Sets the proper plenary date. 2023-02-14 21:03:34 +01:00
Mark de Wever
9c8f340949 [libc++][format] Fixes test failures.
Using some builds the modular build fails due to missing exports
and includes. This fixes the build.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D143203
2023-02-14 19:13:01 +01:00
Mark de Wever
7f5d130a42 [libc++][chrono] Add hh_mm_ss formatter.
Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters
- P1466 Miscellaneous minor fixes for chrono

Depends on D137022

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D139771
2023-02-14 19:12:19 +01:00
Mark de Wever
f8877d86a8 [libc++][doc] Adds Issaquah papers and issues.
Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D143845
2023-02-14 19:04:53 +01:00
Arthur O'Dwyer
a9f384994b [libc++] Counter<T>'s assignment operator shouldn't ++gConstructed
This has been here since d5f461ca03e30, but assigning into an existing
Counter object definitely doesn't create a new object. This causes the
count to "leak" higher and higher, inside algorithms based on swapping.
2023-02-14 12:57:36 -05:00
Nikolas Klauser
800fec13a8 [libc++] Enforce formatting for already formatted and new files and ignore the formatting of tests
It is quite confusing to newcomers that the formatting check gets mostly ignored. To fix that, enforce the formatting for new file and already formatted files, but ignore it for any files that aren't formatted already. We ignore the tests for now, since almost no test is formatted currently, and they are changed almost never.

Reviewed By: ldionne, Mordante, #libc

Spies: arichardson, fedor.sergeev, phosek, sstefan1, libcxx-commits, abrachet

Differential Revision: https://reviews.llvm.org/D142180
2023-02-14 17:28:35 +01:00
Adrian Vogelsgesang
855b67799b [libc++][NFC] Remove duplicated line from Cxx20Issues.csv 2023-02-13 16:33:21 -08:00
Mark de Wever
31c42f8f35 [libc++][doc] Updates format status page.
This adds the papers voted in during the Issaquah plenary.
2023-02-13 18:32:04 +01:00
Louis Dionne
201b2b5674 [libc++] Reorganize exception_guard
We try to keep as little code as possible within #ifdef.

Differential Revision: https://reviews.llvm.org/D143299
2023-02-13 11:50:24 -05:00
Hans Wennborg
bbff77a14e Revert "[libc++] Remove _LIBCPP_CONSTEVAL"
It causes mysterious memory leaks when comparing std::string, see GitHub
Issue #60709 and the code review.

> All supported compilers support `consteval`, so there is no more need for the macro.
>
> Reviewed By: ldionne, Mordante, #libc
>
> Spies: libcxx-commits
>
> Differential Revision: https://reviews.llvm.org/D143489

This reverts commit aaef3b82f4f0dd3924a3491b381d5015ff472b86.
2023-02-13 16:29:57 +01:00
Louis Dionne
5801090258 [libc++] Fix bug in allocate_shared_for_overwrite
Instead of destroying the object with allocator::destroy, we must
call its destructor directly. As a fly-by also mark LWG3008 as
fixed since it is handled by our implementation.

This was pointed out by Tim Song in https://reviews.llvm.org/D140913.

Differential Revision: https://reviews.llvm.org/D143791
2023-02-13 08:50:54 -05:00
Louis Dionne
87cc95a904 [libc++] Implement P2136R3 std::invoke_r
Differential Revision: https://reviews.llvm.org/D143610
2023-02-13 08:46:57 -05:00
Nikolas Klauser
e698c59504 [libc++] Granularize <type_traits> includes in <algorithm>
Reviewed By: Mordante, #libc

Spies: libcxx-commits, wenlei

Differential Revision: https://reviews.llvm.org/D140673
2023-02-13 13:21:25 +01:00
Adrian Vogelsgesang
2a06757a20 [libc++][spaceship] Implement lexicographical_compare_three_way
The implementation makes use of the freedom added by LWG 3410. We have
two variants of this algorithm:
* a fast path for random access iterators: This fast path computes the
  maximum number of loop iterations up-front and does not compare the
  iterators against their limits on every loop iteration.
* A basic implementation for all other iterators: This implementation
  compares the iterators against their limits in every loop iteration.
  However, it still takes advantage of the freedom added by LWG 3410 to
  avoid unnecessary additional iterator comparisons, as originally
  specified by P1614R2.

https://godbolt.org/z/7xbMEen5e shows the benefit of the fast path:
The hot loop generated of `lexicographical_compare_three_way3` is
more tight than for `lexicographical_compare_three_way1`. The added
benchmark illustrates how this leads to a 30% - 50% performance
improvement on integer vectors.

Implements part of P1614R2 "The Mothership has Landed"

Fixes LWG 3410 and LWG 3350

Differential Revision: https://reviews.llvm.org/D131395
2023-02-12 14:51:08 -08:00
Adrian Vogelsgesang
bb00fb66ba [libc++][NFC] Fix formatting in ranges status page 2023-02-12 12:06:17 -08:00
Hui
01d68b13f5 [libcxx][ranges] mark new join view tests unsupported without experimental flag
Differential Revision: https://reviews.llvm.org/D143828
2023-02-11 20:42:00 +00:00
Hui
a38a4654ce [libc++] fix shared_ptr's incorrect constraints
Fix several bugs:
1. https://llvm.org/PR60258
   The conversion constructors' constraint `__compatible_with` incorrectly allow array types conversion to scalar types
2. https://llvm.org/PR53368
   The constructor that takes `unique_ptr` are not suffiently constrained.
3. The constructors that take raw pointers incorretly use `__compatible_with`. They have different constraints

Differential Revision: https://reviews.llvm.org/D143346
2023-02-11 19:44:38 +00:00
Nikolas Klauser
d05f889535 [libc++] Enable radability-identifier-naming for local variables and fix any problems
Fixes #60658

Reviewed By: Mordante, #libc

Spies: aheejin, sstefan1, libcxx-commits

Differential Revision: https://reviews.llvm.org/D143737
2023-02-11 20:03:53 +01:00