Commit Graph

9746 Commits

Author SHA1 Message Date
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