<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/libcxx/test/std/strings/basic.string, branch users/meinersbur/flang_runtime_split-headers</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++][C++03] Use `__cxx03/` headers in C++03 mode (#109002)</title>
<updated>2024-12-21T12:01:48+00:00</updated>
<author>
<name>Nikolas Klauser</name>
<email>nikolasklauser@berlin.de</email>
</author>
<published>2024-12-21T12:01:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b9a2658a3e8bd13b0f9e7a8a440832a95b377216'/>
<id>b9a2658a3e8bd13b0f9e7a8a440832a95b377216</id>
<content type='text'>
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 &lt;vector&gt;
#ifdef _LIBCPP_CXX03_LANG
#  include &lt;__cxx03/vector&gt;
#else
  // normal &lt;vector&gt; 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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;vector&gt;
#ifdef _LIBCPP_CXX03_LANG
#  include &lt;__cxx03/vector&gt;
#else
  // normal &lt;vector&gt; 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.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][test] Refactor increasing_allocator (#115671)</title>
<updated>2024-12-05T20:44:05+00:00</updated>
<author>
<name>Peng Liu</name>
<email>winner245@hotmail.com</email>
</author>
<published>2024-12-05T20:44:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a821937b6d29f874d2561c6ef073faeed302b1a9'/>
<id>a821937b6d29f874d2561c6ef073faeed302b1a9</id>
<content type='text'>
The increasing_allocator&lt;T&gt; class, originally introduced to test shrink_to_fit()
for std::vector, std::vector&lt;bool&gt;, and std::basic_string, has duplicated
definitions across several test files. Given the potential utility of this
class for capacity-related tests in various sequence containers, this patch
refactors the definition of increasing_allocator&lt;T&gt; into a single, reusable
location.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The increasing_allocator&lt;T&gt; class, originally introduced to test shrink_to_fit()
for std::vector, std::vector&lt;bool&gt;, and std::basic_string, has duplicated
definitions across several test files. Given the potential utility of this
class for capacity-related tests in various sequence containers, this patch
refactors the definition of increasing_allocator&lt;T&gt; into a single, reusable
location.</pre>
</div>
</content>
</entry>
<entry>
<title> [libcxx] Add testing configuration for GPU targets (#104515)</title>
<updated>2024-11-04T18:58:23+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2024-11-04T18:58:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=95a2eb70cf850597a5e871380807911e55f341a7'/>
<id>95a2eb70cf850597a5e871380807911e55f341a7</id>
<content type='text'>
Summary:
The GPU runs these tests using the files built from the `libc` project.
These will be placed in `include/&lt;triple&gt;` and `lib/&lt;triple&gt;`. We use
the `amdhsa-loader` and `nvptx-loader` tools, which are also provided by
`libc`. These launch a kernel called `_start` which calls `main` so we
can pretend like GPU programs are normal terminal applications.

We force serial exeuction here, because `llvm-lit` runs way too many
processes in parallel, which has a bad habit of making the GPU drivers
hang or run out of resources. This allows the compilation to be run in
parallel while the jobs themselves are serialized via a file lock.

In the future this can likely be refined to accept user specified
architectures, or better handle including the root directory by exposing
that instead of just `include/&lt;triple&gt;/c++/v1/`.

This currently fails ~1% of the tests on AMDGPU and ~3% of the tests on
NVPTX. This will hopefully be reduced further, and later patches can
XFAIL a lot of them once it's down to a reasonable number.

Future support will likely want to allow passing in a custom
architecture instead of simply relying on `-mcpu=native`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
The GPU runs these tests using the files built from the `libc` project.
These will be placed in `include/&lt;triple&gt;` and `lib/&lt;triple&gt;`. We use
the `amdhsa-loader` and `nvptx-loader` tools, which are also provided by
`libc`. These launch a kernel called `_start` which calls `main` so we
can pretend like GPU programs are normal terminal applications.

We force serial exeuction here, because `llvm-lit` runs way too many
processes in parallel, which has a bad habit of making the GPU drivers
hang or run out of resources. This allows the compilation to be run in
parallel while the jobs themselves are serialized via a file lock.

In the future this can likely be refined to accept user specified
architectures, or better handle including the root directory by exposing
that instead of just `include/&lt;triple&gt;/c++/v1/`.

This currently fails ~1% of the tests on AMDGPU and ~3% of the tests on
NVPTX. This will hopefully be reduced further, and later patches can
XFAIL a lot of them once it's down to a reasonable number.

Future support will likely want to allow passing in a custom
architecture instead of simply relying on `-mcpu=native`.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][test] Augment `test_alloc` in `deallocate_size.pass.cpp` (#113638)</title>
<updated>2024-10-29T23:16:03+00:00</updated>
<author>
<name>A. Jiang</name>
<email>de34@live.cn</email>
</author>
<published>2024-10-29T23:16:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f71ea0e72e2419691e3c67bdbbe338d314ee77c0'/>
<id>f71ea0e72e2419691e3c67bdbbe338d314ee77c0</id>
<content type='text'>
Making it meet the requirements for allocator since C++11. Fixes
#113609.

This PR doesn't make it meet the C++03 allocator requirements, because
that would make the type too verbose and libc++ has backported many
C++11 features to the C++03 mode.

Drive-by: Removes the `TEST_CONSTEXPR_CXX14` on `allocate`/`dealocate`
which is never in effect (and causes IFNDR-ness before C++23), since
these functions modify the namespace-scoped variable `allocated_`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Making it meet the requirements for allocator since C++11. Fixes
#113609.

This PR doesn't make it meet the C++03 allocator requirements, because
that would make the type too verbose and libc++ has backported many
C++11 features to the C++03 mode.

Drive-by: Removes the `TEST_CONSTEXPR_CXX14` on `allocate`/`dealocate`
which is never in effect (and causes IFNDR-ness before C++23), since
these functions modify the namespace-scoped variable `allocated_`.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][string] Add regression test for sized new/delete bug (#110210)</title>
<updated>2024-10-01T05:29:11+00:00</updated>
<author>
<name>Vitaly Buka</name>
<email>vitalybuka@google.com</email>
</author>
<published>2024-10-01T05:29:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=eea5e7e095f945329e9e71c9606075264df8d74f'/>
<id>eea5e7e095f945329e9e71c9606075264df8d74f</id>
<content type='text'>
This is regression test for #90292.

Allocator used in test is very similar to test_allocator.
However, reproducer requires size_type of the string
to be 64bit, but test_allocator uses 32bit.

32bit size_type makes `sizeof(string::__long)` to be 16,
but the alignment issue fixed with #90292 is only triggered
with default `sizeof(string::__long)` which is 24.

Fixes #92128.

---------

Co-authored-by: Louis Dionne &lt;ldionne.2@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is regression test for #90292.

Allocator used in test is very similar to test_allocator.
However, reproducer requires size_type of the string
to be 64bit, but test_allocator uses 32bit.

32bit size_type makes `sizeof(string::__long)` to be 16,
but the alignment issue fixed with #90292 is only triggered
with default `sizeof(string::__long)` which is 24.

Fixes #92128.

---------

Co-authored-by: Louis Dionne &lt;ldionne.2@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Fix several double-moves in the code base (#104616)</title>
<updated>2024-08-20T18:36:11+00:00</updated>
<author>
<name>Louis Dionne</name>
<email>ldionne.2@gmail.com</email>
</author>
<published>2024-08-20T18:36:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f73050e722dd2e484358d03674eb186f3a2f4799'/>
<id>f73050e722dd2e484358d03674eb186f3a2f4799</id>
<content type='text'>
This patch hardens the "test iterators" we use to test algorithms by
ensuring that they don't get double-moved. As a result of this
hardening, the tests started reporting multiple failures where we would
double-move iterators, which are being fixed in this patch.

In particular:
- Fixed a double-move in pstl.partition
- Add coverage for begin()/end() in subrange tests
- Fix tests for ranges::ends_with and ranges::contains, which were
  incorrectly calling begin() twice on the same subrange containing
  non-copyable input iterators.

Fixes #100709</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch hardens the "test iterators" we use to test algorithms by
ensuring that they don't get double-moved. As a result of this
hardening, the tests started reporting multiple failures where we would
double-move iterators, which are being fixed in this patch.

In particular:
- Fixed a double-move in pstl.partition
- Add coverage for begin()/end() in subrange tests
- Fix tests for ranges::ends_with and ranges::contains, which were
  incorrectly calling begin() twice on the same subrange containing
  non-copyable input iterators.

Fixes #100709</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Implements LWG3130. (#101889)</title>
<updated>2024-08-06T17:47:56+00:00</updated>
<author>
<name>Mark de Wever</name>
<email>koraq@xs4all.nl</email>
</author>
<published>2024-08-06T17:47:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4dee6411e0d993fd17099bd7564276474412383e'/>
<id>4dee6411e0d993fd17099bd7564276474412383e</id>
<content type='text'>
This adds addressof at the required places in [input.output]. Some of
the new tests failed since string used operator&amp; internally. These have
been fixed too.

Note the new fstream tests perform output to a basic_string instead of a
double. Using a double requires num_get specialization

num_get&lt;CharT, istreambuf_iterator&lt;CharT,
char_traits_operator_hijacker&lt;CharT&gt;&gt;

This facet is not present in the locale database so the conversion would
fail due to a missing locale facet. Using basic_string avoids using the
locale.

As a drive-by fixes several bugs in the ofstream.cons tests. These
tested ifstream instead of ofstream with an open mode.

Implements:
- LWG3130 [input.output] needs many addressof

Closes #100246.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds addressof at the required places in [input.output]. Some of
the new tests failed since string used operator&amp; internally. These have
been fixed too.

Note the new fstream tests perform output to a basic_string instead of a
double. Using a double requires num_get specialization

num_get&lt;CharT, istreambuf_iterator&lt;CharT,
char_traits_operator_hijacker&lt;CharT&gt;&gt;

This facet is not present in the locale database so the conversion would
fail due to a missing locale facet. Using basic_string avoids using the
locale.

As a drive-by fixes several bugs in the ofstream.cons tests. These
tested ifstream instead of ofstream with an open mode.

Implements:
- LWG3130 [input.output] needs many addressof

Closes #100246.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][NFC] Avoid opening namespace std in the tests (#94160)</title>
<updated>2024-08-01T08:57:21+00:00</updated>
<author>
<name>Nikolas Klauser</name>
<email>nikolasklauser@berlin.de</email>
</author>
<published>2024-08-01T08:57:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5dfdac74cadd9483a66eb17e51dc632b554cccb1'/>
<id>5dfdac74cadd9483a66eb17e51dc632b554cccb1</id>
<content type='text'>
This also adds a few FIXMEs where we use UB in the tests.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This also adds a few FIXMEs where we use UB in the tests.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][string] Fixes shrink_to_fit. (#97961)</title>
<updated>2024-07-23T16:13:22+00:00</updated>
<author>
<name>Mark de Wever</name>
<email>koraq@xs4all.nl</email>
</author>
<published>2024-07-23T16:13:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d0ca9f23e8f25b0509c3ff34ed215508b39ea6e7'/>
<id>d0ca9f23e8f25b0509c3ff34ed215508b39ea6e7</id>
<content type='text'>
This ensures that shrink_to_fit does not increase the allocated size.

Partly addresses #95161</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This ensures that shrink_to_fit does not increase the allocated size.

Partly addresses #95161</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][hardening] Use bounded iterators in std::vector and std::string (#78929)</title>
<updated>2024-07-23T05:44:25+00:00</updated>
<author>
<name>David Benjamin</name>
<email>davidben@google.com</email>
</author>
<published>2024-07-23T05:44:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=bcf9fb9802baad73e2f2acf142519e0dcfd3cc7f'/>
<id>bcf9fb9802baad73e2f2acf142519e0dcfd3cc7f</id>
<content type='text'>
~~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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
~~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
</pre>
</div>
</content>
</entry>
</feed>
