<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/libcxx/test/std/strings/basic.string/string.capacity, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[libc++] Add availability markup for LLVM 19 and LLVM 20 (#140072)</title>
<updated>2025-11-03T01:24:30+00:00</updated>
<author>
<name>Louis Dionne</name>
<email>ldionne.2@gmail.com</email>
</author>
<published>2025-11-03T01:24:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3252e11da3ac990732d02d1a881b6544d81fe955'/>
<id>3252e11da3ac990732d02d1a881b6544d81fe955</id>
<content type='text'>
An LLVM 19-aligned libc++ was released with macOS 15.4 (and corresponding OSes),
and LLVM-20 aligned with macOS 26.0. This patch adds availability markup to
reflect that.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
An LLVM 19-aligned libc++ was released with macOS 15.4 (and corresponding OSes),
and LLVM-20 aligned with macOS 26.0. This patch adds availability markup to
reflect that.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][test] Make `deallocate_size.pass.cpp` MSVC-friendly (#165162)</title>
<updated>2025-10-31T02:07:38+00:00</updated>
<author>
<name>A. Jiang</name>
<email>de34@live.cn</email>
</author>
<published>2025-10-31T02:07:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=73b092ff3398321b91f913c66bf9fe3bbf4d097a'/>
<id>73b092ff3398321b91f913c66bf9fe3bbf4d097a</id>
<content type='text'>
This patch contains several changes to `deallocate_size.pass.cpp`:
1. `static_cast`-ing some parameters to `size_t` to avoid narrowing.
2. Changing the type of loop variable `i` to `unsigned int` avoid
signedness mismatch with the constructor parameter.
3. Separately counting allocations and deallocations in variables
`allocated_` and `deallocated_`, and changing their type to `uint64_t`.
4. Avoiding `assert`-ing count of allocations when a `basic_string` is
allocated, just `assert`-ing after destruction instead.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch contains several changes to `deallocate_size.pass.cpp`:
1. `static_cast`-ing some parameters to `size_t` to avoid narrowing.
2. Changing the type of loop variable `i` to `unsigned int` avoid
signedness mismatch with the constructor parameter.
3. Separately counting allocations and deallocations in variables
`allocated_` and `deallocated_`, and changing their type to `uint64_t`.
4. Avoiding `assert`-ing count of allocations when a `basic_string` is
allocated, just `assert`-ing after destruction instead.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][string] Assert resize_and_overwrite operation returns integer-like type (#162030)</title>
<updated>2025-10-09T23:32:50+00:00</updated>
<author>
<name>NagaChaitanya Vellanki</name>
<email>pnagato@protonmail.com</email>
</author>
<published>2025-10-09T23:32:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9146ef5df0543f08a86686cfeb3bd1ea7338f4c6'/>
<id>9146ef5df0543f08a86686cfeb3bd1ea7338f4c6</id>
<content type='text'>
Verify that the operation passed to resize_and_overwrite returns an
integer-like type, matching the behavior of other standard library
implementations like GCC's libstdc++

Fixes #160577</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Verify that the operation passed to resize_and_overwrite returns an
integer-like type, matching the behavior of other standard library
implementations like GCC's libstdc++

Fixes #160577</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][C++03] cherry-pick #125423 (#156824)</title>
<updated>2025-09-05T12:45:58+00:00</updated>
<author>
<name>Nikolas Klauser</name>
<email>nikolasklauser@berlin.de</email>
</author>
<published>2025-09-05T12:45:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2e6685c5c680cfeb7f7c0200a1bdc7c8f0b8a4d0'/>
<id>2e6685c5c680cfeb7f7c0200a1bdc7c8f0b8a4d0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][NFC] Use llvm.org/PR to link to bug reports (#156288)</title>
<updated>2025-09-04T07:20:02+00:00</updated>
<author>
<name>Nikolas Klauser</name>
<email>nikolasklauser@berlin.de</email>
</author>
<published>2025-09-04T07:20:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=34d4f0c13666ea25b4d27dcb96dfc70da005f286'/>
<id>34d4f0c13666ea25b4d27dcb96dfc70da005f286</id>
<content type='text'>
We've built up quite a few links directly to github within the code
base. We should instead use `llvm.org/PR&lt;issue-number&gt;` to link to bugs,
since that is resilient to the bug tracker changing in the future. This
is especially relevant for tests linking to bugs, since they will
probably be there for decades to come. A nice side effect is that these
links are significantly shorter than the GH links, making them much less
of an eyesore.

This patch also replaces a few links that linked to the old bugzilla
instance on llvm.org.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We've built up quite a few links directly to github within the code
base. We should instead use `llvm.org/PR&lt;issue-number&gt;` to link to bugs,
since that is resilient to the bug tracker changing in the future. This
is especially relevant for tests linking to bugs, since they will
probably be there for decades to come. A nice side effect is that these
links are significantly shorter than the GH links, making them much less
of an eyesore.

This patch also replaces a few links that linked to the old bugzilla
instance on llvm.org.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Fix `basic_string::shrink_to_fit` for constant evaluation (#142712)</title>
<updated>2025-06-04T23:23:49+00:00</updated>
<author>
<name>A. Jiang</name>
<email>de34@live.cn</email>
</author>
<published>2025-06-04T23:23:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=479f9922912e3385655f0ca6e6238aaf09e6320d'/>
<id>479f9922912e3385655f0ca6e6238aaf09e6320d</id>
<content type='text'>
Currently, when the string shrink into the SSO buffer, the `__rep_.__s`
member isn't activated before the `traits_type::copy` call
yet, so internal `__builtin_memmove` call writing to the buffer causes
constant evaluation failure. The existing test coverage seems a bit
defective and doesn't cover this case - `shrink_to_fit` is called on the
copy of string after erasure, not the original string object.

This PR reorders the `__set_short_size` call, which starts the lifetime
of the SSO buffer, before the copy operation. Test coverage is achieved
by calling `shrink_to_fit` on the original erased string.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, when the string shrink into the SSO buffer, the `__rep_.__s`
member isn't activated before the `traits_type::copy` call
yet, so internal `__builtin_memmove` call writing to the buffer causes
constant evaluation failure. The existing test coverage seems a bit
defective and doesn't cover this case - `shrink_to_fit` is called on the
copy of string after erasure, not the original string object.

This PR reorders the `__set_short_size` call, which starts the lifetime
of the SSO buffer, before the copy operation. Test coverage is achieved
by calling `shrink_to_fit` on the original erased string.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Bump OS version for macOS backdeployment CI jobs (#131883)</title>
<updated>2025-04-05T18:53:18+00:00</updated>
<author>
<name>Louis Dionne</name>
<email>ldionne.2@gmail.com</email>
</author>
<published>2025-04-05T18:53:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b4f7a2ab578957657336a598220fce6fc00f56b5'/>
<id>b4f7a2ab578957657336a598220fce6fc00f56b5</id>
<content type='text'>
In 0547e573c555, I introduced backdeployment testing on macOS using
Github-provided builders. This was done by basically building libc++ on
a slightly older macOS (like macOS 13) and then running against the
system library on that machine. However, that created a dependency that
libc++ must keep working on macOS 13, which doesn't support the
latest-released Xcode.

This patch solves that problem by moving the deployment testing to a
newer version of macOS which supports the latest-released version of
Xcode.

Sadly, that also reduces the backdeployment coverage we have since we're
not actually testing on older OSes, but is necessary to satisfy the
documented libc++ support policy. In the future, we could improve the
situation by providing a Lit configuration that allows compiling (but
not running) all the tests, building the tests on a supported macOS, and
then shipping those tests on an older backdeployment target in order to
run them against the system library. Since that requires significant
engineering, this isn't done at this time.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In 0547e573c555, I introduced backdeployment testing on macOS using
Github-provided builders. This was done by basically building libc++ on
a slightly older macOS (like macOS 13) and then running against the
system library on that machine. However, that created a dependency that
libc++ must keep working on macOS 13, which doesn't support the
latest-released Xcode.

This patch solves that problem by moving the deployment testing to a
newer version of macOS which supports the latest-released version of
Xcode.

Sadly, that also reduces the backdeployment coverage we have since we're
not actually testing on older OSes, but is necessary to satisfy the
documented libc++ support policy. In the future, we could improve the
situation by providing a Lit configuration that allows compiling (but
not running) all the tests, building the tests on a supported macOS, and
then shipping those tests on an older backdeployment target in order to
run them against the system library. Since that requires significant
engineering, this isn't done at this time.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Fix basic_string not allowing max_size() elements to be stored (#125423)</title>
<updated>2025-02-23T18:02:14+00:00</updated>
<author>
<name>Nikolas Klauser</name>
<email>nikolasklauser@berlin.de</email>
</author>
<published>2025-02-23T18:02:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=15860446a8c3db5c39f92bb371236778e8b00fb0'/>
<id>15860446a8c3db5c39f92bb371236778e8b00fb0</id>
<content type='text'>
Without this patch `basic_string` cannot be properly resized to be
`max_size()` elements in size, even if an allocation is successful.
`__grow_by` allocates one less element than required, resulting in an
out-of-bounds access. At the same time, `max_size()` has an off-by-one
error, since there has to be space to store the null terminator, which
is currently ignored.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Without this patch `basic_string` cannot be properly resized to be
`max_size()` elements in size, even if an allocation is successful.
`__grow_by` allocates one less element than required, resulting in an
out-of-bounds access. At the same time, `max_size()` has an off-by-one
error, since there has to be space to store the null terminator, which
is currently ignored.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Fix shrink_to_fit to swap buffer only when capacity is strictly smaller (#127321)</title>
<updated>2025-02-22T13:50:48+00:00</updated>
<author>
<name>Peng Liu</name>
<email>winner245@hotmail.com</email>
</author>
<published>2025-02-22T13:50:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=31824b2a11a8aa3e1d5c699cd0786ad666999abf'/>
<id>31824b2a11a8aa3e1d5c699cd0786ad666999abf</id>
<content type='text'>
The current implementation of the `shrink_to_fit()` function of
`basic_string` swaps to the newly allocated buffer when the new buffer
has the same capacity as the existing one. While this is not incorrect,
it is truly unnecessary to swap to an equally-sized buffer. With equal
capacity, we should keep using the existing buffer and simply deallocate
the new one, avoiding the extra work of copying elements.

The desired behavior was documented in the following comment within the
function:


https://github.com/llvm/llvm-project/blob/61ad08792a86e62309b982189a600f4342a38d91/libcxx/include/string#L3560-L3566

However, the existing implementation did not exactly conform to this
guideline, which is a QoI matter.

This PR modifies the `shrink_to_fit()` function to ensure that the
buffer is only swapped when the new allocation is strictly smaller than
the existing one. When the capacities are equal, the new buffer will be
discarded without copying the elements. This is achieved by including
the `==` check in the above conditional logic.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The current implementation of the `shrink_to_fit()` function of
`basic_string` swaps to the newly allocated buffer when the new buffer
has the same capacity as the existing one. While this is not incorrect,
it is truly unnecessary to swap to an equally-sized buffer. With equal
capacity, we should keep using the existing buffer and simply deallocate
the new one, avoiding the extra work of copying elements.

The desired behavior was documented in the following comment within the
function:


https://github.com/llvm/llvm-project/blob/61ad08792a86e62309b982189a600f4342a38d91/libcxx/include/string#L3560-L3566

However, the existing implementation did not exactly conform to this
guideline, which is a QoI matter.

This PR modifies the `shrink_to_fit()` function to ensure that the
buffer is only swapped when the new allocation is strictly smaller than
the existing one. When the capacities are equal, the new buffer will be
discarded without copying the elements. This is achieved by including
the `==` check in the above conditional logic.</pre>
</div>
</content>
</entry>
<entry>
<title>Reapply "[libc++] Simplify the implementation of reserve() and shrink_to_fit() (#113453)" (#125888)</title>
<updated>2025-02-06T08:35:24+00:00</updated>
<author>
<name>Nikolas Klauser</name>
<email>nikolasklauser@berlin.de</email>
</author>
<published>2025-02-06T08:35:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4562efc674a5b5e052abdfc40047e82a359d0df0'/>
<id>4562efc674a5b5e052abdfc40047e82a359d0df0</id>
<content type='text'>
The capacity is now passed correctly and a test for this path is added.

Since we changed the implementation of `reserve(size_type)` to only ever
extend,
it doesn't make a ton of sense anymore to have `__shrink_or_extend`,
since the code
paths of `reserve` and `shrink_to_fit` are now almost completely
separate.

This patch splits up `__shrink_or_extend` so that the individual parts
are in `reserve`
and `shrink_to_fit` depending on where they are needed.

This reverts commit 59f57be94f38758616b1339b293b43af845571af.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The capacity is now passed correctly and a test for this path is added.

Since we changed the implementation of `reserve(size_type)` to only ever
extend,
it doesn't make a ton of sense anymore to have `__shrink_or_extend`,
since the code
paths of `reserve` and `shrink_to_fit` are now almost completely
separate.

This patch splits up `__shrink_or_extend` so that the individual parts
are in `reserve`
and `shrink_to_fit` depending on where they are needed.

This reverts commit 59f57be94f38758616b1339b293b43af845571af.</pre>
</div>
</content>
</entry>
</feed>
