Commit Graph

9815 Commits

Author SHA1 Message Date
Louis Dionne 20ca119a4d [libc++][NFC] Refactor run-buildbot to make it closer to our buildkite pipeline
Differential Revision: https://reviews.llvm.org/D138380
2022-11-20 13:56:49 -05:00
Louis Dionne af8c49dc1e [libc++] Introduce a setting to remove fstream from the library
This allows porting the library to platforms that are able to support
<iostream> but that do not have a notion of a filesystem, and where it
hence doesn't make sense to support std::fstream (and never will).

Also, remove reliance on <fstream> in various tests that didn't
actually need it.

Differential Revision: https://reviews.llvm.org/D138327
2022-11-20 10:51:32 -05:00
Louis Dionne eaa4f041f7 [libc++] Use numeric_limits instead of raw INT_MAX
This allows discard_block_engine to work on platforms that might not
provide a full <limits.h> header.

Differential Revision: https://reviews.llvm.org/D138212
2022-11-18 11:32:14 -05:00
David Spickett 3ae3162cb6 [libcxx] Fix link to Buildbot interface
Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D138286
2022-11-18 15:47:21 +00:00
Konstantin Varlamov f51c91532e [libc++][NFC] Add a missing include in pre-C++14 language modes. 2022-11-17 17:15:41 -08:00
Konstantin Varlamov 821513b1e6 [libc++] Fix a missing include in pre-C++17 language modes. 2022-11-17 16:53:05 -08:00
Louis Dionne 3de4689048 [libc++][NFC] Add missing include <cstring> in char_traits.h 2022-11-17 10:46:45 -05:00
Louis Dionne 5d87f60f89 [libc++] Only include_next C library headers when they exist
Some platforms don't provide all C library headers. In practice, libc++
only requires a few C library headers to exist, and only a few functions
on those headers. Missing functions that libc++ doesn't need for its own
implementation are handled properly by the using_if_exists attribute,
however a missing header is currently a hard error when we try to
do #include_next.

This patch should make libc++ more flexible on platforms that do not
provide C headers that libc++ doesn't actually require for its own
implementation. The only downside is that it may move some errors from
the #include_next point to later in the compilation if we actually try
to use something that isn't provided, which could be somewhat confusing.
However, these errors should be caught by folks trying to port libc++
over to a new platform (when running the libc++ test suite), not by end
users.

NOTE: This is a reapplicaton of 226409, which was reverted in 674729813
      because it broke the build. The issue has now been fixed with
      https://reviews.llvm.org/D138062.

Differential Revision: https://reviews.llvm.org/D136683
2022-11-17 10:30:20 -05:00
Louis Dionne 5ed6dc4681 [libc++] Introduce helper functions __make_iter in vector and string
This prepares the terrain for introducing a new type of bounded iterator
that can't be constructed like __wrap_iter. This reverts part of the
changes made to std::vector in 4eab04f84.

Differential Revision: https://reviews.llvm.org/D138036
2022-11-15 16:17:13 -05:00
Nico Weber 674729813e Revert "[libc++] Only include_next C library headers when they exist"
This reverts commit 226409c628.
Breaks check-clang on mac, see comments on https://reviews.llvm.org/D136683
2022-11-15 11:35:00 -05:00
Louis Dionne bf68a595f6 [libc++] Start classifying debug mode features with more granularity
I am starting to granularize debug-mode checks so they can be controlled
more individually. The goal is for vendors to eventually be able to select
which categories of checks they want embedded in their configuration of
the library with more granularity.

Note that this patch is a bit weird on its own because it does not touch
any of the containers that implement iterator bounds checking through the
__dereferenceable check of the legacy debug mode. However, I added TODOs
to string and vector to change that.

Differential Revision: https://reviews.llvm.org/D138033
2022-11-15 11:18:22 -05:00
Louis Dionne 226409c628 [libc++] Only include_next C library headers when they exist
Some platforms don't provide all C library headers. In practice, libc++
only requires a few C library headers to exist, and only a few functions
on those headers. Missing functions that libc++ doesn't need for its own
implementation are handled properly by the using_if_exists attribute,
however a missing header is currently a hard error when we try to
do #include_next.

This patch should make libc++ more flexible on platforms that do not
provide C headers that libc++ doesn't actually require for its own
implementation. The only downside is that it may move some errors from
the #include_next point to later in the compilation if we actually try
to use something that isn't provided, which could be somewhat confusing.
However, these errors should be caught by folks trying to port libc++
over to a new platform (when running the libc++ test suite), not by end
users.

Differential Revision: https://reviews.llvm.org/D136683
2022-11-15 10:58:11 -05:00
Louis Dionne 13ea134323 [libc++] Make it an error to define _LIBCPP_DEBUG
We have been transitioning off of that macro since LLVM 15.

Differential Revision: https://reviews.llvm.org/D137975
2022-11-15 09:48:13 -05:00
Louis Dionne 5b0c21753b [libc++] Make sure that we use the libc++ CI pipeline when no projects have changed
That is necessary for scheduled builds to work.
2022-11-12 08:10:10 -10:00
Louis Dionne 1651d8303d [libc++] Remove unused variable in buildkite pipeline generation 2022-11-12 08:10:10 -10:00
Louis Dionne 0389438347 [libc++] Add a libc++ CI pipeline specific to Clang changes
This will ensure that Clang changes get tested against libc++.

Differential Revision: https://reviews.llvm.org/D137759
2022-11-11 14:43:22 -10:00
Mark de Wever 0c111dd86f [libc++] Documents details of the pre-commit CI.
This documentation aims to make it cleare how the libc++ pre-commit CI
works. For libc++ developers and other LLVM projects whose changes can
affect libc++.

This was discusses with @aaron.ballman as a follow on some unclearities
for the Clang communitee how the libc++ pre-commit CI works.

Note some parts depend on patches under review as commented in the
documentation.

Reviewed By: ldionne, #libc, philnik

Differential Revision: https://reviews.llvm.org/D133249
2022-11-10 20:20:17 +01:00
Louis Dionne c9eeaedccd [libc++] Add a script to generate the libc++ BuildKite pipeline dynamically 2022-11-09 16:52:41 -10:00
Nikolas Klauser b7c0a4065e [libc++] Add FTM for constexpr vector
It looks like we forgot to set the FTM when adding constexpr vector support.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D137729
2022-11-09 22:45:20 +01:00
Sam James 32a2af44e1 [CMake] Fix -Wstrict-prototypes
Fixes warnings (or errors, if someone injects -Werror in their build system,
which happens in fact with some folks vendoring LLVM too) with Clang 16:
```
+/var/tmp/portage.notmp/portage/sys-devel/llvm-15.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: warning: a function declaration without a prototype
is deprecated in all versions of C [-Wstrict-prototypes]
-/var/tmp/portage.notmp/portage/sys-devel/llvm-14.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: error: a function declaration without a prototype is
deprecated in all versions of C [-Werror,-Wstrict-prototypes]
 int main() {return 0;}
         ^
          void
```

Differential Revision: https://reviews.llvm.org/D137503
2022-11-08 01:37:04 +00:00
Nikolas Klauser 59ef4b3686 [libc++] Split __allocator_destructor out of shared_ptr.h
Reviewed By: ldionne, huixie90, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D134479
2022-11-05 21:25:54 +01:00
Nikolas Klauser 89b356f05a [libc++] Granularize <concept> includes
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D137283
2022-11-05 20:59:29 +01:00
Nikolas Klauser 660b243120 [libc++] Add [[nodiscard]] extensions to ranges algorithms
This mirrors what we have done in the classic algorithms

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D137186
2022-11-05 16:38:46 +01:00
Nikolas Klauser 777f034799 [libc++] inline more functions into basic_string
This removes a lot of boilerplate.

Reviewed By: ldionne, #libc, EricWF

Spies: EricWF, libcxx-commits

Differential Revision: https://reviews.llvm.org/D137025
2022-11-04 16:18:02 +01:00
varconst 76c0ee5cb7 [libcxx] Fix the support requirements for `std::function` Objective-C++ test.
The test requires two features to be supported but only checked for one
of them.

Differential Revision: https://reviews.llvm.org/D137294
2022-11-03 14:25:57 -07:00
Ryan Prichard 9e6049527f [libc++][Android] strong_order_long_double.verify.cpp: disable on i686
This target (as well as 32-bit ARM Android) have sizeof(long double)
equal to sizeof(double).

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D137135
2022-11-02 14:55:56 -07:00
Ryan Prichard cdde2706cf [libc++][Android] XFAIL aligned_alloc and timespec_get tests
Mark tests XFAIL that use APIs that are unsupported on old versions of
Android:
 - aligned_alloc isn't available until API 28.
 - timespec_get isn't available until API 29.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D137134
2022-11-02 14:53:51 -07:00
Mark de Wever c7576cb89d [libc++][test] Fixes transitive includes.
These were accidentally set to generating in
243da90ea5

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D137278
2022-11-02 22:12:13 +01:00
Nikolas Klauser 29378ab24b [libc++] Implement P2438R2 (std::string::substr() &&)
This doesn't affect our ABI because `std::string::substr()` isn't in the dylib and the mangling of `substr() const` and `substr() const&` are different.

Reviewed By: ldionne, Mordante, var-const, avogelsgesang, #libc

Spies: arphaman, huixie90, libcxx-commits

Differential Revision: https://reviews.llvm.org/D131668
2022-11-02 20:28:47 +01:00
Konstantin Varlamov aa2b05f0b9 [libc++] Use stack buffers for uninitialized storage in tests.
This makes the tests more minimal, and in particular it avoids relying on a complete `<cstdlib>`, which may not be available on all platforms.

Differential Revision: https://reviews.llvm.org/D137188
2022-11-01 19:21:11 -07:00
Mark de Wever ddcb2d19b3 [libc++] Improves modular build.
Makes sure headers having a xxx_result as return type export the proper
header. Without exporting these modularized headers are not self
contained.

This is related to D136045.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D136711
2022-11-01 20:24:33 +01:00
Mark de Wever 883b749779 [libc++][doc] Updates implementation status.
Claim some tasks for formatting and mark some parts as complete, which
was missed in the commits completing the task.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D137014
2022-11-01 20:22:57 +01:00
Mark de Wever 84cdfbcd55 [libc++][format] Fixes default string alignment.
Fixes https://llvm.org/PR58315

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D137017
2022-11-01 20:21:50 +01:00
Mark de Wever 45f81e904f [libc++] Validates valid weekday indexed range.
No code changes, but only increased the range in the tests.

Completes:
- LWG3273. Specify weekday_indexed to range of [0, 7]

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D137015
2022-11-01 20:20:57 +01:00
Nikolas Klauser 28e399fa1e [libc++][PMR] Deprecate the implementation in std::experimental
This commit deprecates <experimental/memory_resource> since we now ship the non-experimental
version of it. Per the libc++ policy [1], we are deprecating the experimental feature in
upcoming LLVM 16 and will remove it entirely in LLVM 18.

[1]: https://libcxx.llvm.org/DesignDocs/ExperimentalFeatures.html#id4

Reviewed By: ldionne, #libc

Spies: EricWF, libcxx-commits

Differential Revision: https://reviews.llvm.org/D136245
2022-11-01 00:37:08 +01:00
Nikolas Klauser 57215eda64 [libc++][PMR] Move the pmr::memory_resource destructor into the dylib
This avoids emitting the VTable of `pmr::memory_resource` in every TU.

Reviewed By: ldionne

Spies: EricWF, nemanjai, libcxx-commits

Differential Revision: https://reviews.llvm.org/D136196
2022-11-01 00:37:04 +01:00
Nikolas Klauser 35d0e27618 [libc++][PMR] Mark completed papers and issues as such
Reviewed By: ldionne, #libc

Spies: krytarowski, Quuxplusone, tschuett, libcxx-commits

Differential Revision: https://reviews.llvm.org/D136194
2022-11-01 00:37:01 +01:00
Nikolas Klauser f4ca5da2be [libc++][PMR] Add attributes
This allows the compiler to do more optimizations.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, krytarowski

Differential Revision: https://reviews.llvm.org/D136191
2022-11-01 00:36:58 +01:00
Nikolas Klauser 627465cf9f [libc++] Move preferred_name declarations into the forward declaring headers and add pmr preferred names
We currently define the preferred names in multiple places. `basic_string` and `basic_string_view` also have a lot of aliases, which makes the declarations quite long. So let's only add the preferred names in forward-declaring headers to make the implementation more readable and have all the preferred names in one place.

Reviewed By: ldionne

Spies: EricWF, krytarowski, libcxx-commits

Differential Revision: https://reviews.llvm.org/D135824
2022-11-01 00:36:54 +01:00
Evgeny Shulgin cc2cf8b22b [libc++] Add test for checking progress on P0533R9
This test checks progress on P0533R9 (https://wg21.link/p0533r9).
Whenever a desired function becomes constexpr, the programmer won't forget
to switch `ASSERT_NOT_CONSTEXPR_CXX23` to `ASSERT_CONSTEXPR_CXX23` and
eventually to change the paper's implementation status. The test also works
as a reference list of unimplemented functions.

Reviewed By: philnik, #libc

Differential Revision: https://reviews.llvm.org/D136538
2022-10-31 21:59:21 +00:00
Michael Platings 77793ee33a [libc++] newlib/xlocale.h: remove redundant includes
This permits using the <locale> header with newlib or picolibc when
LIBCXX_ENABLE_WIDE_CHARACTERS=FALSE.

Since D136682 the __support/xlocale headers themselves include the
headers they require, respecting the LIBCXX_ENABLE_WIDE_CHARACTERS
option.

Differential Revision: https://reviews.llvm.org/D136947
2022-10-31 07:40:37 +00:00
Nikolas Klauser f7b8f7273b [libc++][math.h] Remove unnecessary uses of __promote
Removes __promote when it's just the identity.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, michaelplatings

Differential Revision: https://reviews.llvm.org/D136868
2022-10-28 01:05:47 +02:00
Mark de Wever e70887ddcf [libc++][test] Don't use _LIBCPP macros.
This was discovered by @ldionne.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D136709
2022-10-26 17:42:11 +02:00
Louis Dionne fd5a2bfaad [libc++] Add missing includes to xlocale helpers
Also, make sure those are compatible with _LIBCPP_HAS_NO_WIDE_CHARACTERS.

Differential Revision: https://reviews.llvm.org/D136682
2022-10-25 14:06:17 -04:00
Nico Weber 60809cd293 Revert "[clang] Fix missing diagnostic of declaration use when accessing TypeDecls through typename access"
This reverts commit dc17043313.
Breaks building LLVM on mac when targeting macOS before 10.15, see
comments on https://reviews.llvm.org/D136533
2022-10-25 12:23:10 -04:00
Matheus Izvekov dc17043313
[clang] Fix missing diagnostic of declaration use when accessing TypeDecls through typename access
Fixes GH58547.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D136533
2022-10-25 02:46:35 +02:00
Kazu Hirata 3f8d2c917c Ensure newlines at the end of files (NFC) 2022-10-22 09:29:40 -07:00
Louis Dionne fc41512fd3 [libc++][NFC] Add documentation for _Or and _And 2022-10-21 12:25:29 -04:00
Aaron Jacobs a0549ee2a3 [libc++] type_traits: fix short-circuiting in std::conjunction.
Replace the two-level implementation with a simpler one that directly subclasses
the predicates, avoiding the instantiation of the template to get the `type`
member in a situation where we should short-circuit. This prevents incorrect
diagnostics when the instantiated predicate contains a static assertion.

Add a test case that reproduced the previous problem. The existing test case
involving `HasNoValue` didn't catch the problem because `HasNoValue` was in the
final position. The bug comes up when the predicate that shouldn't be
instantiated is after the short-circuit position but there is more to follow,
because then `__conjunction_impl<False, BadPredicate, ...>` instantiates
`__conjunction_impl<BadPredicate, ...>` (in order to obtain its `type` member),
which in turn instantiates `BadPredicate` in order to obtain its `value` member.

In contrast the new implementation doesn't recurse in instantiation any further
than it needs to, because it doesn't require particular members of the recursive
case.

I've also updated the test cases for `std::disjunction` to match,
although it doesn't have the same particular bug (its implementation is
quite different).

Fixes #58490.

Reviewed By: #libc, ldionne, philnik

Spies: philnik, ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D136318
2022-10-21 13:09:16 +02:00
Mark de Wever a48007355a [libc++][format] Implements string escaping.
Implements parts of
- P2286R8 Formatting Ranges

Reviewed By: #libc, tahonermann

Differential Revision: https://reviews.llvm.org/D134036
2022-10-20 17:29:34 +02:00
Mark de Wever 37fc37dd5d [libc++][CI] Reorder jobs.
In the second leg of the CI the steps take about:
- C++2b              10m
- C++11              8m
- C++03              6m
- Modular build      10m
- GCC 12 / C++latest 20m
So the slowest job is scheduled last. The CI will wait to start the
third leg until that job is done. The current order increases the
latency of the current job, instead start the slow jobs earlier.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D136276
2022-10-20 17:28:07 +02:00
Mark de Wever 8c489bd1f1 [libc++][doc] Fixes status pages.
Addresses post-commit review comment in D134742.
2022-10-19 19:26:37 +02:00
Nikolas Klauser dbe60caa92 [libc++] Remove std::function in C++03
We've said that we'll remove `std::function` from C++03 in LLVM 16, so we might as well do it now before we forget.

Reviewed By: ldionne, #libc, Mordante

Spies: jloser, Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D135868
2022-10-19 11:08:35 +02:00
Nancy Wang 8266eefd91 [SystemZ][z/OS][libcxx]: fix the mask in stage2_float_loop function
This patch is to fix issue related to __stage2_float_loop function, float point value comparison is not working on EBCDIC mode because the mask is hard-coded and assumes character is ASCII, fix is to use toupper function when do the comparison.

Differential Revision: https://reviews.llvm.org/D118930
2022-10-18 15:56:18 -04:00
Mark de Wever 9f8340eff3 [libc++][chrono] Fixes build.
Changes in D134742 were not properly propagated to D136037 before
landing.
2022-10-18 20:57:54 +02:00
Mark de Wever 566868cd82 [libc++][chrono] Implements formatter weekday.
Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters

Depends on D134742

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D136037
2022-10-18 20:40:06 +02:00
Mark de Wever 719c3dc6f2 [libc++][chrono] Implements formatter duration.
Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters
- LWG3270 Parsing and formatting %j with durations

Completes:
- P1650R0 std::chrono::days with 'd' suffix
- LWG3262 Formatting of negative durations is not specified
- LWG3314 Is stream insertion behavior locale dependent when Period::type is micro?

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D134742
2022-10-18 20:39:39 +02:00
Hui Xie 594fa1474f [libc++][ranges] implement `std::ranges::drop_while_view`
Differential Revision: https://reviews.llvm.org/D135460
2022-10-18 19:34:47 +01:00
Mark de Wever a469ce4f50 [libc++] Improves modular build.
Makes sure headers having a std::ranges::less as default argument export
the proper header. Without exporting these modularized headers are not
self contained.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D136045
2022-10-18 18:46:50 +02:00
Mark de Wever 91dd072354 [libc++][format] Move iterators when needed.
LWG-3539 was already implemented but not marked as done.
LWG-3567 is implemented in this commit.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D112368
2022-10-18 18:45:41 +02:00
Louis Dionne 0e4802bf45 [libc++] Fix std::function's handling of blocks under Objc ARC
Previously, some uses of std::function with blocks would crash when ARC was enabled.

rdar://100907096

Differential Revision: https://reviews.llvm.org/D135706
2022-10-17 18:36:08 -04:00
Joe Loser dd9afdbb2a [libc++] Fix missing requires clause on variant operator<=>
`std::variant::operator<=>` is missing a requires clause ensuring that
`operator<=>` only exists when all of the types in the variant are
`three_way_comparable`.

Add the missing requires clause and adjust the existing test which was
incorrect.

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

Differential Revision: https://reviews.llvm.org/D136050
2022-10-17 16:23:02 -06:00
Mark de Wever 7712ae0a02 [libc++] Adds missing includes.
Fixes breakage of modular builds when including sort.h directly.
2022-10-17 17:42:00 +02:00
Nikolas Klauser 8e892c9dd8 [libc++] Improve error message for invalid allocators
Reviewed By: ldionne, #libc

Spies: libcxx-commits, rupprecht

Differential Revision: https://reviews.llvm.org/D135803
2022-10-16 00:37:35 +02:00
Rupert Nash f793597f6d [libc++] <sstream>: update references to standard paragraphs
The paragraph numbers used previously did not match the C++20 nor
C++17 standards. I have updated them to the textual dotted names to
avoid this problem in future.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D135861
2022-10-13 07:23:22 -04:00
Louis Dionne 1e1c082f7e [libc++][NFC] Add missing SHA in ABI changelog 2022-10-12 17:46:08 -04:00
Louis Dionne b404a1bfac [libc++] Add missing UNSUPPORTED annotations for std::pmr tests that use RTTI
This is the equivalent of 340b48b267 applied to the non-experimental
std::pmr.
2022-10-12 16:47:33 -04:00
Louis Dionne 8f7ae24782 [libc++][NFC] Fix incorrect main signatures in tests 2022-10-12 16:47:32 -04:00
David Tenty 1379899518 [libc++] Replace some _LIBCPP_HIDDEN with _LIBCPP_HIDE_FROM_ABI
These "implementation detail" function templates were already
hidden and have no specializations in the dylib, so they seem like they can safely
use _LIBCPP_HIDE_FROM_ABI instead and have the abi tags applied as well.

Seems some of these got over looked (e.g. D129823) in various places, and they
won't be flagged by the new checks added in D129968, as they were
already hidden.

Reviewed by: ldionne

Differential Revision: https://reviews.llvm.org/D135504
2022-10-12 16:45:58 -04:00
Louis Dionne bb7069626c [libc++][NFC] Fix typo in comment 2022-10-12 16:06:21 -04:00
Haowei Wu a353909088 Revert "[runtimes] Always define cxx_shared, cxx_static & other targets"
This reverts commit 79ee0342db which
breaks the LLVM TSan bots.
2022-10-12 12:54:48 -07:00
Louis Dionne 9fa8f113f7 [libc++] Add test for bug that had been introduced in D98573 and fixed in D119633
Differential Revision: https://reviews.llvm.org/D135297
2022-10-12 15:05:04 -04:00
Nikolas Klauser ddeff232da [libc++][NFC] Remove __lcpp prefix in math.h
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D135774
2022-10-12 20:35:55 +02:00
Mark de Wever 040f50ad6b [NFC][libc++] Moves transitive includes location.
This moves some includes missed in D133212.

Reviewed By: ldionne, #libc, philnik

Differential Revision: https://reviews.llvm.org/D135180
2022-10-12 20:35:09 +02:00
Nikolas Klauser 4d189c40f8 [libc++][NFC] Replace _LIBCPP_INLINE_VISIBILITY in math.h
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D135773
2022-10-12 20:34:12 +02:00
Mark de Wever a1e13a80d0 [libc++] Implements constexpr <charconv>.
Implements:
- P2291R3 Add Constexpr Modifiers to Functions to_chars and from_chars for
  Integral Types in <charconv> Header

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D131317
2022-10-12 17:43:23 +02:00
Mark de Wever 261b5abf72 [libc++][format] Improves CTAD.
This partly reverts D133535 and enables CTAD for more parts in format.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D135292
2022-10-12 17:42:50 +02:00
Louis Dionne 3fe2db8cf9 [libc++] Remove _LIBCPP_HAS_NO_CXX20_COROUTINES
As far as I can tell, all the compilers we support have support for
C++20 coroutines now.

Differential Revision: https://reviews.llvm.org/D135274
2022-10-12 10:42:06 -04:00
Louis Dionne 1d29657acb [libc++] Disable the GDB pretty printer tests again, since they break the CI 2022-10-12 10:40:11 -04:00
Louis Dionne 79ee0342db [runtimes] Always define cxx_shared, cxx_static & other targets
However, mark them as EXCLUDE_FROM_ALL when we don't want to build them.
Simply declaring the targets should be of no harm, and it allows other
projects to mention these targets regardless of whether they end up
being built or not.

While the diff may not make that obvious, this patch basically
moves the definition of e.g. `cxx_shared` out of the `if (LIBCXX_ENABLE_SHARED)`
and instead marks it as `EXCLUDE_FROM_ALL` conditionally on whether
LIBCXX_ENABLE_SHARED is passed. It then does the same for libunwind
and libc++abi targets.

Differential Revision: https://reviews.llvm.org/D134221
2022-10-12 09:36:29 -04:00
Louis Dionne 52c7ffbe2e [libc++][NFC] Change _VSTD to std as a prereq for D122780 2022-10-11 15:58:42 -04:00
Sterling Augustine e4d5daaf91 Reenable gdb pretty printers, and update them.
Libcxx gdb pretty printers were disabled due to an old version
of gdb in the release testing. This reenables them, and fixes
various bit rot issues from not running them.
2022-10-11 12:28:34 -07:00
Louis Dionne 10378b3db1 [runtimes] Add the ability to customize the output name of libc++, libc++abi and libunwind
We already had the ability to do that for libc++.dylib, so this only adds
consistency for all the runtime libraries. This should allow working around
difficulties on AIX as described in https://llvm.org/D134221.

Differential Revision: https://reviews.llvm.org/D135669
2022-10-11 15:19:59 -04:00
Mark de Wever 6195bdb9f1 [NFC][libc++][format] Improves tests.
This is mainly to improve the readability of the tests. As a side
effects the tests run faster too,

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D135288
2022-10-11 19:23:29 +02:00
Nikolas Klauser d7d586e5a7 [libc++] static_assert that rebinding the allocator works as expected
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D133638
2022-10-11 16:47:42 +02:00
Arthur O'Dwyer 243da90ea5 [libc++] Add the C++17 <memory_resource> header (mono-patch)
This patch is the rebase and squash of three earlier patches.
It supersedes all three of them.

- D47111: experimental monotonic_buffer_resource.
- D47358: experimental pool resources.
- D47360: Copy std::experimental::pmr to std::pmr.

The significant difference between this patch and the-sum-of-those-three
is that this patch does not add `std::experimental::pmr::monotonic_buffer_resource`
and so on. This patch simply adds the C++17 standard facilities, and
leaves the `std::experimental` namespace entirely alone.

Differential Revision: https://reviews.llvm.org/D89057
2022-10-11 08:40:46 -04:00
Hui Xie a2c6a1193f [libc++][ranges]implement `std::views::take_while`
Differential Revision: https://reviews.llvm.org/D134952
2022-10-09 08:10:19 +01:00
Mark de Wever e17ec8e9ba [libc++] Make charconv require C++17 or later.
Implementing the paper
P2291R3 Add Constexpr Modifiers to Functions to_chars and from_chars for
        Integral Types in <charconv> Header

Gives issues in language versions prior to C++17. As suggested in
D131855 disable the code prior to C++17. This removes libc++'s
extension.

Reviewed By: ldionne, #libc_vendors, #libc, philnik

Differential Revision: https://reviews.llvm.org/D133216
2022-10-08 13:50:30 +02:00
Hui Xie 96a509bca2 implement `std::views::istream`
implement `std::ranges::basic_istream_view` and `std::views::istream`. Although the view itself is constexpr,
the constructor argument is a base class std::istream where its ctor/dtor are not constexpr. So no tests are performed in
constexpr

Differential Revision: https://reviews.llvm.org/D133317
2022-10-06 22:57:37 +01:00
Nikolas Klauser 79df8e19be [libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction)
Reviewed By: ldionne, #libc, huixie90

Spies: huixie90, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D131898
2022-10-06 16:58:51 +02:00
oToToT 0da59bb865 [libc++] Fix wrong implementation of CityHash
As PR56606 stated, the current implementation of CityHash in libc++
would drop some bits unintentionally. Cast the 32bit int to the 64bit
int to avoid this happened.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D134124
2022-10-06 04:32:04 +08:00
Mark de Wever a1beb0a382 [libc++][format] Implements formattable concept.
This concept is introduced in P2286, but was implemented in libc++
before. This implementation was used in the library internally. This
implementation lacked the resolution of LWG3636. The original formatter
had a non-const member function that wasn't trivial to make a const
member. The recent parser improvements made this member a const member
in preparation of LWG3636.

Note LWG3636 isn't voted in. Its status is Ready. P2286's concept has
been written as-if LWG3636 is accepted and refers to that LWG issue.

Updates some tests make format a const member function and removes a
tests that's mainly a duplicate of the formattable concept test.

Implements
- LWG3636 formatter<T>::format should be const-qualified

Implements parts of
- P2286R8 Formatting Ranges

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D134110
2022-10-05 22:21:00 +02:00
Mark de Wever 1522f190eb [libc++][chrono] Implements formatter month.
Partially implements:
- P1361 Integration of chrono with text formatting

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D134138
2022-10-05 18:35:50 +02:00
Louis Dionne bc8f007fe0 [libc++] Get rid of _LIBCPP_HAS_OPEN_WITH_WCHAR in the test suite
Differential Revision: https://reviews.llvm.org/D135163
2022-10-05 11:27:24 -04:00
Mark de Wever 3eb4f16b44 [libc++][chrono] Implements formatter year.
Partially implements:
- P1361 Integration of chrono with text formatting

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D133663
2022-10-05 17:01:19 +02:00
Mark de Wever deaad6a1b6 [libc++][format] Updates to Unicode 15.
This adds support for the new code points in the Extended Grapheme
Cluster algorithm. The algorithm itself has remained unchanged.

The width estimation still follows the rules of the Standard.
@cor3ntin filed
  LWG3780 format's width estimation is too approximate and not forward compatible
to improve the estimate.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D134106
2022-10-04 18:58:09 +02:00
Louis Dionne 258477ed0a [llvm] Remove libcxx, libcxxabi and libunwind from supported LLVM_ENABLE_PROJECTS
This is a breaking change. If you were passing one of those three runtimes
in LLVM_ENABLE_PROJECTS, you need to start passing them in LLVM_ENABLE_RUNTIMES
instead. The runtimes in LLVM_ENABLE_RUNTIMES will start being built using
the "bootstrapping build" instead, which means that they will be built
using the just-built Clang. This is usually what you wanted anyway.

If you were using LLVM_ENABLE_PROJECTS=all with the explicit goal of
building these three runtimes, you can now use LLVM_ENABLE_RUNTIMES=all
and these runtimes will be built using the bootstrapping build.

NOTE: This is a re-application of 887b8bd733 which had been reverted
      in 6b03a4fea0 because it broke the Sphinx documentation publishers.
      The Sphinx documentation publishers have now been moved to using
      the runtimes build, so this should not be an issue anymore.

Differential Revision: https://reviews.llvm.org/D132480
2022-10-04 09:04:12 -04:00
Zibi Sarbinowski 36dde913b0 [SystemZ][z/OS] Add ASCII and 32-bit variants for libc++.
This patch enables libc++ build as shared library in all combinations of ASCII/EBCDIC and 32-bit/64-bit variants. In particular it introduces:

  # ASCII version of libc++ named as libc++_a.so
  # Script to rename DLL name inside the generated side deck
  # Various names for dataset members where DLL libraries and their side decks will reside
  # Add the following options:

   - LIBCXX_SHARED_OUTPUT_NAME
   - LIBCXX_ADDITIONAL_COMPILE_FLAGS
   - LIBCXX_ADDITIONAL_LIBRARIES
   - LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
   - LIBCXXABI_ADDITIONAL_LIBRARIES

**Background and rational of this patch**

The linker on z/OS creates a list of exported symbols in a file called side deck. The list contains the symbol name as well as the name of the DLL which implements the symbol. The name of the DLL depends on what is specified in the -o command line option. If it points to a USS file, than the DLL name in the side deck will be the USS file name. If it points to a member of a dataset then the DLL name in the side deck is the member name.

If CMake could deal with z/OS datasets we could use -o that points to a dataset member name, but this does not seem to work so we have to produce a USS file as the DLL and then copy the content of the produced side deck to a dataset as well as rename the USS file name in the side deck to a dataset member name that corresponds to that DLL.

Reviewed By: muiez, SeanP, ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D118503
2022-10-03 17:24:02 -05:00
Louis Dionne c4ca3a2c4b [libc++] Simplify transitive includes test and fix a bug
This patch incorporates the "sanitize" step of the transitive includes
test into the CSV generator itself. In doing so, it removes complexity
in the test but also fixes a bug where we would filter out <__mutex>
from the output, leading to an incorrect list of includes for the
<shared_mutex> header.

Differential Revision: https://reviews.llvm.org/D134830
2022-10-03 16:09:07 -04:00
Louis Dionne c2df707666 [libc++] Suppress -Wctad-maybe-unsupported on types w/o deduction guides
There are a handful of standard library types that are intended
to support CTAD but don't need any explicit deduction guides to
do so.

This patch adds a dummy deduction guide to those types to suppress
-Wctad-maybe-unsupported (which gets emitted in user code).

This is a re-application of the original patch by Eric Fiselier in
fcd549a7d8 which had been reverted due to reasons lost at this point.
I also added the macro to a few more types. Reviving this patch was
prompted by the discussion on https://llvm.org/D133425.

Differential Revision: https://reviews.llvm.org/D133535
2022-10-03 14:05:08 -04:00