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
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
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
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
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
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
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
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
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
This mirrors what we have done in the classic algorithms
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D137186
This removes a lot of boilerplate.
Reviewed By: ldionne, #libc, EricWF
Spies: EricWF, libcxx-commits
Differential Revision: https://reviews.llvm.org/D137025
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
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
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
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
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
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
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
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
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
This allows the compiler to do more optimizations.
Reviewed By: ldionne, #libc
Spies: libcxx-commits, krytarowski
Differential Revision: https://reviews.llvm.org/D136191
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
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
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
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
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
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
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
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
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
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
Previously, some uses of std::function with blocks would crash when ARC was enabled.
rdar://100907096
Differential Revision: https://reviews.llvm.org/D135706
`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
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
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
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
This partly reverts D133535 and enables CTAD for more parts in format.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D135292
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
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.
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
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
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
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
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
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
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
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
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
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
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
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