|
Revision tags: llvmorg-21-init, llvmorg-19.1.7 |
|
| #
b9a2658a |
| 21-Dec-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++][C++03] Use `__cxx03/` headers in C++03 mode (#109002)
This patch implements the forwarding to frozen C++03 headers as discussed in https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-
[libc++][C++03] Use `__cxx03/` headers in C++03 mode (#109002)
This patch implements the forwarding to frozen C++03 headers as discussed in https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc. In the RFC, we initially proposed selecting the right headers from the Clang driver, however consensus seemed to steer towards handling this in the library itself. This patch implements that direction.
At a high level, the changes basically amount to making each public header look like this:
``` // inside <vector> #ifdef _LIBCPP_CXX03_LANG # include <__cxx03/vector> #else // normal <vector> content #endif ```
In most cases, public headers are simple umbrella headers so there isn't much code in the #else branch. In other cases, the #else branch contains the actual implementation of the header.
show more ...
|
|
Revision tags: llvmorg-19.1.6 |
|
| #
c166a9c7 |
| 10-Dec-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++] Add #if 0 block to all the top-level headers (#119234)
Including The frozen C++03 headers results in a lot of formatting changes in the main headers, so this splits these changes into a sep
[libc++] Add #if 0 block to all the top-level headers (#119234)
Including The frozen C++03 headers results in a lot of formatting changes in the main headers, so this splits these changes into a separate commit instead.
This is part of https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
show more ...
|
|
Revision tags: llvmorg-19.1.5, llvmorg-19.1.4 |
|
| #
c6f3b7bc |
| 06-Nov-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++] Refactor the configuration macros to being always defined (#112094)
This is a follow-up to #89178. This updates the `<__config_site>` macros.
|
|
Revision tags: llvmorg-19.1.3 |
|
| #
2e43a304 |
| 25-Oct-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++] Granularize <vector> (#99705)
| | old time | new time |
| ------------------ | -------- | -------- |
| functional - c++23 | 416ms | 225ms |
| random - c++23
[libc++] Granularize <vector> (#99705)
| | old time | new time |
| ------------------ | -------- | -------- |
| functional - c++23 | 416ms | 225ms |
| random - c++23 | 513ms | 392ms |
| vector - c++17 | 206ms | 100ms |
show more ...
|
| #
8a7318eb |
| 24-Oct-2024 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++] Refactor vector::push_back to use vector::emplace (#113481)
This removes some duplicate code. I suspect this was originally written
that way because vector::emplace didn't exist in C++03 m
[libc++] Refactor vector::push_back to use vector::emplace (#113481)
This removes some duplicate code. I suspect this was originally written
that way because vector::emplace didn't exist in C++03 mode, which
stopped being relevant when Clang implemented rvalue references in
C++03.
show more ...
|
| #
b263a71c |
| 22-Oct-2024 |
Peng Liu <winner245@hotmail.com> |
[libc++] Refactor vector constructors to eliminate code duplication (#113193)
This PR refactors the std::vector's initializer_list constructors to
reduce code duplication. The constructors now call
[libc++] Refactor vector constructors to eliminate code duplication (#113193)
This PR refactors the std::vector's initializer_list constructors to
reduce code duplication. The constructors now call `__init_with_size`
directly, reducing code duplication and improving readability and
maintainability.
show more ...
|
|
Revision tags: llvmorg-19.1.2 |
|
| #
8f9cce0b |
| 12-Oct-2024 |
Hui <hui.xie1990@gmail.com> |
[libc++] Add container_traits (prework for `std::flat_map`) (#109578)
This PR is extracted from
https://github.com/llvm/llvm-project/pull/98643, as per code review
request
https://github.com/llvm
[libc++] Add container_traits (prework for `std::flat_map`) (#109578)
This PR is extracted from
https://github.com/llvm/llvm-project/pull/98643, as per code review
request
https://github.com/llvm/llvm-project/pull/98643#discussion_r1768967793
show more ...
|
| #
ba87515f |
| 12-Oct-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++][RFC] Always define internal feature test macros (#89178)
Currently, the library-internal feature test macros are only defined if
the feature is not available, and always have the prefix
`
[libc++][RFC] Always define internal feature test macros (#89178)
Currently, the library-internal feature test macros are only defined if
the feature is not available, and always have the prefix
`_LIBCPP_HAS_NO_`. This patch changes that, so that they are always
defined and have the prefix `_LIBCPP_HAS_` instead. This changes the
canonical use of these macros to `#if _LIBCPP_HAS_FEATURE`, which means
that using an undefined macro (e.g. due to a missing include) is
diagnosed now. While this is rather unlikely currently, a similar change
in `<__configuration/availability.h>` caught a few bugs. This also
improves readability, since it removes the double-negation of `#ifndef
_LIBCPP_HAS_NO_FEATURE`.
The current patch only touches the macros defined in `<__config>`. If
people are happy with this approach, I'll make a follow-up PR to also
change the macros defined in `<__config_site>`.
show more ...
|
|
Revision tags: llvmorg-19.1.1, llvmorg-19.1.0 |
|
| #
09e3a360 |
| 16-Sep-2024 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++][modules] Fix missing and incorrect includes (#108850)
This patch adds a large number of missing includes in the libc++ headers
and the test suite. Those were found as part of the effort to
[libc++][modules] Fix missing and incorrect includes (#108850)
This patch adds a large number of missing includes in the libc++ headers
and the test suite. Those were found as part of the effort to move
towards a mostly monolithic top-level std module.
show more ...
|
| #
27c83382 |
| 16-Sep-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++] Replace `__compressed_pair` with `[[no_unique_address]]` (#76756)
This significantly simplifies the code, improves compile times and improves the object layout of types using `__compressed_
[libc++] Replace `__compressed_pair` with `[[no_unique_address]]` (#76756)
This significantly simplifies the code, improves compile times and improves the object layout of types using `__compressed_pair` in the unstable ABI. The only downside is that this is extremely ABI sensitive and pedantically breaks the ABI for empty final types, since the address of the subobject may change. The ABI of the whole object should not be affected.
Fixes #91266 Fixes #93069
show more ...
|
| #
17e0686a |
| 12-Sep-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++][NFC] Use [[__nodiscard__]] unconditionally (#80454)
`__has_cpp_attribute(__nodiscard__)` is always true now, so we might as
well replace `_LIBCPP_NODISCARD`. It's one less macro that can r
[libc++][NFC] Use [[__nodiscard__]] unconditionally (#80454)
`__has_cpp_attribute(__nodiscard__)` is always true now, so we might as
well replace `_LIBCPP_NODISCARD`. It's one less macro that can result in
bad diagnostics.
show more ...
|
| #
748023dc |
| 11-Sep-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++][NFC] Replace _LIBCPP_NORETURN and TEST_NORETURN with [[noreturn]] (#80455)
`[[__noreturn__]]` is now always available, so we can simply use the
attribute directly instead of through a macr
[libc++][NFC] Replace _LIBCPP_NORETURN and TEST_NORETURN with [[noreturn]] (#80455)
`[[__noreturn__]]` is now always available, so we can simply use the
attribute directly instead of through a macro.
show more ...
|
| #
c1a8283f |
| 04-Sep-2024 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++][modules] Move __noexcept_move_assign_container out of __type_traits (#107140)
That header depends on allocator traits, which is fundamentally tied to
`<memory>`, not to `<type_traits>`. Th
[libc++][modules] Move __noexcept_move_assign_container out of __type_traits (#107140)
That header depends on allocator traits, which is fundamentally tied to
`<memory>`, not to `<type_traits>`. This breaks a cycle betweeen
__type_traits and __memory.
show more ...
|
|
Revision tags: llvmorg-19.1.0-rc4 |
|
| #
348e7413 |
| 30-Aug-2024 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++][NFC] Run clang-format on libcxx/include
This re-formats a few headers that had become out-of-sync with respect to formatting since we ran clang-format on the whole codebase. There's surpris
[libc++][NFC] Run clang-format on libcxx/include
This re-formats a few headers that had become out-of-sync with respect to formatting since we ran clang-format on the whole codebase. There's surprisingly few instances of it.
show more ...
|
| #
85561dd5 |
| 26-Aug-2024 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++] Fix bounded iterator hardening mode in C++03 mode
|
| #
71066434 |
| 26-Aug-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++][NFC] Don't explicitly provide propagate_on_container_swap when calling __swap_allocator (#105980)
`__swap_allocator` does this automatically when not providing it
explicitly, so this is ju
[libc++][NFC] Don't explicitly provide propagate_on_container_swap when calling __swap_allocator (#105980)
`__swap_allocator` does this automatically when not providing it
explicitly, so this is just more code without any benefit.
show more ...
|
|
Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1 |
|
| #
6cea8189 |
| 23-Jul-2024 |
Mark de Wever <koraq@xs4all.nl> |
[libc++][vector] Updates LWG3778 status. (#99818)
The work was done in a8ae392718313e64e2d7bc092b00f51476c074b2 which
implements parts of
N4258: Cleaning-up noexcept in the Library
However
[libc++][vector] Updates LWG3778 status. (#99818)
The work was done in a8ae392718313e64e2d7bc092b00f51476c074b2 which
implements parts of
N4258: Cleaning-up noexcept in the Library
However that's paper Summary of Proposed Changes contains
No change in vector<bool>
This patch updates the status and as a few NFC cleanups. The fixed
version is based on the release page and might be off.
Updates
- LWG3778 vector<bool> missing exception specifications
show more ...
|
|
Revision tags: llvmorg-20-init |
|
| #
bcf9fb98 |
| 23-Jul-2024 |
David Benjamin <davidben@google.com> |
[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 resolve
[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
show more ...
|
| #
f65d7fdc |
| 20-Jul-2024 |
Mark de Wever <koraq@xs4all.nl> |
[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
---------
[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>
show more ...
|
| #
d043e4c3 |
| 07-Jul-2024 |
Hristo Hristov <hghristov.rmm@gmail.com> |
[libc++] Restore `__synth_three_way` lambda (#90398)
Restore `__synth_three_way` lambda to match the Standard.
GH-57222 is done, restoring the Standard wording implementation should
be possible.
[libc++] Restore `__synth_three_way` lambda (#90398)
Restore `__synth_three_way` lambda to match the Standard.
GH-57222 is done, restoring the Standard wording implementation should
be possible.
https://github.com/llvm/llvm-project/blob/df28d4412c1d21b0e18896c92ac77d2fac7729f1/libcxx/include/__compare/synth_three_way.h#L28
According to comment
https://github.com/llvm/llvm-project/issues/59513#issuecomment-2068338762,
GH-59513 is not a blocker.
Co-authored-by: Hristo Hristov <zingam@outlook.com>
show more ...
|
| #
79e8a595 |
| 25-Jun-2024 |
Hui <hui.xie1990@gmail.com> |
[libc++] Move allocator assertion into allocator_traits (#94750)
There is code duplication in all containers that static_assert the
allocator matches the allocator requirements in the spec. This ch
[libc++] Move allocator assertion into allocator_traits (#94750)
There is code duplication in all containers that static_assert the
allocator matches the allocator requirements in the spec. This check can
be moved into a more centralised place.
show more ...
|
| #
e2c2ffbe |
| 18-Jun-2024 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++][NFC] Run clang-format on libcxx/include again (#95874)
As time went by, a few files have become mis-formatted w.r.t.
clang-format. This was made worse by the fact that formatting was not
[libc++][NFC] Run clang-format on libcxx/include again (#95874)
As time went by, a few files have become mis-formatted w.r.t.
clang-format. This was made worse by the fact that formatting was not
being enforced in extensionless headers. This commit simply brings all
of libcxx/include in-line with clang-format again.
We might have to do this from time to time as we update our clang-format
version, but frankly this is really low effort now that we've formatted
everything once.
show more ...
|
| #
cb417401 |
| 18-Jun-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++] Refactor<__type_traits/is_swappable.h> (#86822)
This changes the `is_swappable` implementation to use variable templates
first and basing the class templates on that. This avoids instantia
[libc++] Refactor<__type_traits/is_swappable.h> (#86822)
This changes the `is_swappable` implementation to use variable templates
first and basing the class templates on that. This avoids instantiating
them when the `_v` versions are used, which are generally less resource
intensive.
show more ...
|
| #
bbe4a806 |
| 18-Jun-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++] Enable modernize-use-equals-delete (#93293)
Differential Revision: https://reviews.llvm.org/D121213
|
| #
6b4b29f8 |
| 18-Jun-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++][NFC] Remove unnecessary parens in static_asserts (#95605)
These were required a long time ago due to `static_assert` not actually
being available in C++03. Now `static_assert` is simply ma
[libc++][NFC] Remove unnecessary parens in static_asserts (#95605)
These were required a long time ago due to `static_assert` not actually
being available in C++03. Now `static_assert` is simply mapped to
`_Static_assert` in C++03, making the additional parens unnecessary.
show more ...
|