Commit Graph

6216 Commits

Author SHA1 Message Date
Petr Hosek
02f95b7751 Revert "[libc++][format] P2637R3: Member visit (std::basic_format_arg) (#76449)"
This reverts commit 7d9b5aa65b since
std/utilities/format/format.arguments/format.arg/visit.return_type.pass.cpp
is failing on Windows when building with Clang-cl.
2024-01-22 17:23:05 +00:00
Dominik Wójt
a859df3b0a
[libc++] Add "using-if-exists" to timespec_get in modules (#78686)
Picolibc does not provide timespec_get function. Adding
"using-if-exists" attribute fixes the modules.

This is a follow up patch for
https://github.com/llvm/llvm-project/pull/78580
2024-01-22 18:09:14 +01:00
itrofimow
51e91b64d0
[libc++abi] Implement __cxa_init_primary_exception and use it to optimize std::make_exception_ptr (#65534)
This patch implements __cxa_init_primary_exception, an extension to the 
Itanium C++ ABI. This extension is already present in both libsupc++ and 
libcxxrt. This patch also starts making use of this function in 
std::make_exception_ptr: instead of going through a full throw/catch 
cycle, we are now able to initialize an exception directly, thus making 
std::make_exception_ptr around 30x faster.
2024-01-22 10:12:41 -05:00
Jan Kokemüller
4f4690530e
[libc++] Ensure that std::expected has no tail padding (#69673)
Currently std::expected can have some padding bytes in its tail due to
[[no_unique_address]]. Those padding bytes can be used by other objects.
For example, in the current implementation:

  sizeof(std::expected<std::optional<int>, bool>) == 
    sizeof(std::expected<std::expected<std::optional<int>, bool>, bool>)

As a result, the data layout of an
  std::expected<std::expected<std::optional<int>, bool>, bool> 
can look like this:

              +-- optional "has value" flag
              |        +--padding
  /---int---\ |        |
  00 00 00 00 01 00 00 00
                |  |
                |  +- "outer" expected "has value" flag
                |
                +- expected "has value" flag

This is problematic because `emplace()`ing the "inner" expected can not
only overwrite the "inner" expected "has value" flag (issue #68552) but
also the tail padding where other objects might live.

This patch fixes the problem by ensuring that std::expected has no tail
padding, which is achieved by conditional usage of [[no_unique_address]]
based on the tail padding that this would create.

This is an ABI breaking change because the following property changes:

  sizeof(std::expected<std::optional<int>, bool>) <
    sizeof(std::expected<std::expected<std::optional<int>, bool>, bool>)

Before the change, this relation didn't hold. After the change, the relation
does hold, which means that the size of std::expected in these cases increases
after this patch. The data layout will change in the following cases where
tail padding can be reused by other objects:

  class foo : std::expected<std::optional<int>, bool> {
    bool b;
  };

or using [[no_unique_address]]:

  struct foo {
    [[no_unique_address]] std::expected<std::optional<int>, bool> e;
    bool b;
  };

The vendor communication is handled in #70820.
Fixes: #70494

Co-authored-by: philnik777 <nikolasklauser@berlin.de>
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2024-01-22 09:05:39 -05:00
Michael Schellenberger Costa
ad01447d30
[libcxx] Fix typo in parallel for_each_n test (#78954)
This fixes a trivial copy and paste error where we forgot to change
`for_each` to `for_each_n`
2024-01-22 12:10:30 +01:00
Hristo Hristov
03c19e91e8
[libc++][numeric] P0543R3: Saturation arithmetic (#77967)
Implements: https://wg21.link/P0543R3
- https://eel.is/c++draft/numeric.sat

Additional references:
- Division: https://eel.is/c++draft/expr.mul#4
- Arithmetic conversions: https://eel.is/c++draft/expr.arith.conv#1
- Clang builtins:
https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions

Depends on: https://github.com/llvm/llvm-project/pull/78086

---------

Co-authored-by: Zingam <zingam@outlook.com>
Co-authored-by: Mark de Wever <zar-rpg@xs4all.nl>
2024-01-22 06:57:45 +02:00
Mark de Wever
04757337cd
[libc++][modules] Improves std.compat module. (#76330)
Let the std.compat module use the std module instead of duplicating the
exports.

Based on @ChuanqiXu9's suggestion in #71438.
2024-01-21 12:15:15 +01:00
Mark de Wever
1d6b6132ff [libc++] Reland CI module improvements.
Revert "Revert #76246 and #76083"

This reverts commit 5c150e7eeb.

Adds a small fix that should properly disable the tests on Windows.
Unfortunately the original poster has not provided feedback and the
original patch did not fail in the LLVM CI infrastructure.

Modules are known to fail on Windows due to non compliance of the
C library. Currently not having this patch prevents testing on other
platforms.
2024-01-21 12:10:36 +01:00
Hristo Hristov
7d9b5aa65b
[libc++][format] P2637R3: Member visit (std::basic_format_arg) (#76449)
Implements parts of: `P2637R3` https://wg21.link/P2637R3
(https://eel.is/c++draft/variant.visit)

Implements:
`basic_format_arg.visit()`
`basic_format_arg.visit<R>()`
Deprecates:
`std::visit_format_arg()`

The tests are as close as possible to the non-member function tests.

To land after: https://github.com/llvm/llvm-project/pull/76447,
https://github.com/llvm/llvm-project/pull/76268

---------

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-21 12:30:25 +02:00
Vitaly Buka
f0c920ffb7
[libc++][hardening] XFAIL tests with HWASAN (#78866)
Follow up to #78862

These tests control hardening mode with `ADDITIONAL_COMPILE_FLAGS`, and
always set modes which use on TRAP. So we don't need to check
`libcpp-hardening-mode=fast`, and they must always fail with the current
HWASAN implementation.
2024-01-20 23:26:48 -08:00
Hristo Hristov
3412bc7658
[libc++][variant] P2637R3: Member visit (std::variant) (#76447)
Implements parts of: `P2637R3` https://wg21.link/P2637R3
(https://eel.is/c++draft/variant.visit)

Implements:
`variant.visit()`
`variant.visit<R>()`

The tests are as close as possible to the non-member function.

To land after: https://github.com/llvm/llvm-project/pull/76268

---------

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-21 07:16:51 +02:00
ZhangYin
6bb5c989bd
[libc++] <experimental/simd> Add load constructor for class simd/simd_mask (#76610) 2024-01-21 12:48:30 +08:00
Hristo Hristov
07b5829fca
[libc++] FreeBSD CI: Adds <signal.h> to check_assertion.h (#78863)
...in attempt to fix the FreeBSD CI.

I noticed that suddenly some tests in the latest PRs fail to compile on
FreeBSD (`SIGILL` and `SIGTRAP` not defined). This tries to resolve
the issue.

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-20 13:48:48 -08:00
Vitaly Buka
aaa7de1fc9
[libc++][hardening] XFAIL test in fast mode under HWASAN (#78862)
After #77883, `fast` mode uses TRAP, and HWASAN
replaces TRAP with abort or error exit code.

On a quick looks it should be possible to avoid doing
that in HWASAN, but historically this is convention for all
sanitizers. Changing this behavior may break existing
users.

Other sanitizers are not affected because they don't
install TRAP handlers by default. But if they do, they also
replace TRAP with abort/exit.
2024-01-20 13:37:38 -08:00
Hui
85a8e5c3e0
[libc++] fix condition_variable_any hangs on stop_request (#77127)
When I implemented `condition_variable_any::wait`, I missed the most
important paragraph in the spec:

> The following wait functions will be notified when there is a stop
request on the passed stop_token.
> In that case the functions return immediately, returning false if the
predicate evaluates to false.

From
https://eel.is/c++draft/thread.condition#thread.condvarany.intwait-1.

Fixes #76807
2024-01-20 21:18:44 +00:00
Hristo Hristov
dbbeee6b83
[libc++][span] P2447R4: std::span over an initializer list (#78157)
Implements: https://wg21.link/P2447R6
- https://eel.is/c++draft/span.syn
- https://eel.is/c++draft/span.overview
- https://eel.is/c++draft/span.cons
- https://eel.is/c++draft/diff

---------

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-20 06:09:46 +02:00
Hristo Hristov
552f5549de
[libc++][any] LWG3305: any_cast<void> (#78215)
Implements: https://wg21.link/LWG3305
- https://eel.is/c++draft/any.nonmembers

---------

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-20 06:08:24 +02:00
Hristo Hristov
ed276dff46
[libc++][memory] P2868R1: Removing deprecated typedef std::allocator::is_always_equal (#78562)
Implements:
- https://wg21.link/P2868R1
- https://wg21.link/LWG3170

---------

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-20 06:07:19 +02:00
Stephan T. Lavavej
123ab34abc
[libc++][test] Move format.functions ASCII tests to libcxx/test/libcxx (#78661)
As @cpplearner explained in microsoft/STL#4328:

> libc++'s "ascii" mode (controlled by the `_LIBCPP_HAS_NO_UNICODE`
> macro) means "every code unit outside ASCII is treated as a valid
> printable character". AFAIK we \[MSVC's STL\] don't support such a mode.

Because these files are testing a non-Standard mode, they should be
moved from `libcxx/test/std` to `libcxx/test/libcxx`.
2024-01-19 16:17:03 -08:00
Konstantin Varlamov
58780b811c
[libc++][hardening] In production hardening modes, trap rather than abort (#78561)
In the hardening modes that can be used in production (`fast` and
`extensive`), make a failed assertion invoke a trap instruction rather
than calling verbose abort. In the debug mode, still keep calling
verbose abort to provide a better user experience and to allow us to
keep our existing testing infrastructure for verifying assertion
messages. Since the debug mode by definition enables all assertions, we
can be sure that we still check all the assertion messages in the
library when running the test suite in the debug mode.

The main motivation to use trapping in production is to achieve better
code generation and reduce the binary size penalty. This way, the
assertion handler can compile to a single instruction, whereas the
existing mechanism with verbose abort results in generating a function
call that in general cannot be optimized away (made worse by the fact
that it's a variadic function, imposing an additional penalty). See the
[RFC](https://discourse.llvm.org/t/rfc-hardening-in-libc/73925) for more
details. Note that this mechanism can now be completely [overridden at
CMake configuration
time](https://github.com/llvm/llvm-project/pull/77883).

This patch also significantly refactors `check_assertion.h` and expands
its test coverage. The main changes:
- when overriding `verbose_abort`, don't do matching inside the function
-- just print the error message to `stderr`. This removes the need to
set a global matcher and allows to do matching in the parent process
after the child finishes;
- remove unused logic for matching source locations and for using
wildcards;
- make matchers simple functors;
- introduce `DeathTestResult` that keeps data about the test run,
primarily to make it easier to test.

In addition to the refactoring, `check_assertion.h` can now recognize
when a process exits due to a trap.
2024-01-19 13:48:13 -08:00
Mital Ashok
924701311a
[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)
Closes #77638, #24186

Rebased from <https://reviews.llvm.org/D156032>, see there for more
information.

Implements wording change in [CWG2137](https://wg21.link/CWG2137) in the
first commit.

This also implements an approach to [CWG2311](https://wg21.link/CWG2311)
in the second commit, because too much code that relies on `T{ T_prvalue}` 
being an elision would break. Because that issue is still open and
the CWG issue doesn't provide wording to fix the issue, there may be
different behaviours on other compilers.
2024-01-19 21:10:51 +01:00
Twice
7ded34576f
[libc++] Implement LWG3940: std::expected<void, E>::value() also needs E to be copy constructible (#71819)
This patch includes the fix for
[LWG3940](https://cplusplus.github.io/LWG/issue3940)
(`std::expected<void, E>::value()` also needs `E` to be copy
constructible)
2024-01-19 10:06:11 +00:00
Vitaly Buka
2a54098de1
Revert "[ASan][libc++] Turn on ASan annotations for short strings" (#78627)
Reverts llvm/llvm-project#75882

To recover build bots :
https://lab.llvm.org/buildbot/#/builders/239/builds/5361
https://lab.llvm.org/buildbot/#/builders/168/builds/18126
2024-01-18 16:33:31 -08:00
Daniel Thornburgh
5c150e7eeb Revert #76246 and #76083
These cause test build failures on Windows.

This reverts the following commits:
  57ca748435
  d06ae33ec3
2024-01-18 15:07:33 -08:00
Dominik Wójt
7f05153236
[libc++] Un-xfail module tests in picolibc tests (#78580)
Some of the module tests now pass after picolibc update.
https://github.com/llvm/llvm-project/pull/77908

The remaining tests fail and are now set to xfail on picolibc
specifically.
2024-01-18 18:40:52 +01:00
Tacet
d06fb0b29c
[ASan][libc++] Turn on ASan annotations for short strings (#75882)
This commit turns on ASan annotations in `std::basic_string` for short
stings (SSO case).

Originally suggested here: https://reviews.llvm.org/D147680

String annotations added here:
https://github.com/llvm/llvm-project/pull/72677

Requires to pass CI without fails:
- https://github.com/llvm/llvm-project/pull/75845
- https://github.com/llvm/llvm-project/pull/75858

Annotating `std::basic_string` with default allocator is implemented in
https://github.com/llvm/llvm-project/pull/72677 but annotations for
short strings (SSO - Short String Optimization) are turned off there.
This commit turns them on. This also removes
`_LIBCPP_SHORT_STRING_ANNOTATIONS_ALLOWED`, because we do not plan to
support turning on and off short string annotations.

Support in ASan API exists since
dd1b7b797a.
You can turn off annotations for a specific allocator based on changes
from
2fa1bec7a2.

This PR is a part of a series of patches extending AddressSanitizer C++
container overflow detection capabilities by adding annotations, similar
to those existing in `std::vector` and `std::deque` collections. These
enhancements empower ASan to effectively detect instances where the
instrumented program attempts to access memory within a collection's
internal allocation that remains unused. This includes cases where
access occurs before or after the stored elements in `std::deque`, or
between the `std::basic_string`'s size (including the null terminator)
and capacity bounds.

The introduction of these annotations was spurred by a real-world
software bug discovered by Trail of Bits, involving an out-of-bounds
memory access during the comparison of two strings using the
`std::equals` function. This function was taking iterators
(`iter1_begin`, `iter1_end`, `iter2_begin`) to perform the comparison,
using a custom comparison function. When the `iter1` object exceeded the
length of `iter2`, an out-of-bounds read could occur on the `iter2`
object. Container sanitization, upon enabling these annotations, would
effectively identify and flag this potential vulnerability.

If you have any questions, please email:

    advenam.tacet@trailofbits.com
    disconnect3d@trailofbits.com
2024-01-18 05:55:34 +01:00
Konstantin Varlamov
8dfc67d672
[libc++][hardening] Rework how the assertion handler can be overridden. (#77883)
Previously there were two ways to override the verbose abort function
which gets called when a hardening assertion is triggered:
- compile-time: define the `_LIBCPP_VERBOSE_ABORT` macro;
- link-time: provide a definition of `__libcpp_verbose_abort` function.

This patch adds a new configure-time approach: the vendor can provide
a path to a custom header file which will get copied into the build by
CMake and included by the library. The header must provide a definition
of the
`_LIBCPP_ASSERTION_HANDLER` macro which is what will get called should
a hardening assertion fail. As of this patch, overriding
`_LIBCPP_VERBOSE_ABORT` will still work, but the previous mechanisms
will be effectively removed in a follow-up patch, making the
configure-time mechanism the sole way of overriding the default handler.

Note that `_LIBCPP_ASSERTION_HANDLER` only gets invoked when a hardening
assertion fails. It does not affect other cases where
`_LIBCPP_VERBOSE_ABORT` is currently used (e.g. when an exception is
thrown in the `-fno-exceptions` mode).

The library provides a default version of the custom header file that
will get used if it's not overridden by the vendor. That allows us to
always test the override mechanism and reduces the difference in
configuration between the pristine version of the library and
a platform-specific version.
2024-01-17 18:56:07 -08:00
Sanjay Marreddi
67f5df78d7
Revert "[libc++] Fix regex_search to match $ alone with match_default flag" (#78349)
The behavior of `std::regex_search` for patterns anchored both to the
start and to the end of the input went wrong after merging #77256 .
Patterns like `"^b*$"` started matching the strings such as `"a"`, which
is not expected.

Reverts the PR: #77256
2024-01-17 13:51:29 +01:00
Mark de Wever
fb79f80bf6
[libc++][modules] Fixes clang-tidy exports. (#76288)
As suggested in #71438 we should use
  export import std;
in the std.compat module.

Using this exports some named declarations from functions and records,
adding them to the global namespace. Clang correctly does not export
these and it's an issue in the declaration filtering. Declarations in
function or record context are not considered a global named
declaration.
2024-01-17 08:27:00 +01:00
Mark de Wever
e6ac33b936
[libc++][modules] Increase clang-tidy version used. (#76268)
As suggested in #71438 we should use
  export import std;
in the std.compat module.

Testing this locally failed when building with the clang-tidy-17 plugin.
The std module was considered corrupt in the test
  libcxx/test/libcxx/module_std_compat.gen.py
however the test
  libcxx/test/libcxx/module_std.gen.py
passed. Both test generated identical std.pcm files. Using the
clang-tidy-18 plugin solves the issue.
2024-01-17 08:18:36 +01:00
Mark de Wever
57ca748435
[libc++][modules] Adds module testing. (#76246)
This adds a new module test infrastructure. This requires tagging tests
using modules. The test runner uses this information to determine the
compiler flags needed to build and use the module.

Currently modules are build per test, which allows testing them for
tests with ADDITIONAL_COMPILE_FLAGS. At the moment only 4 tests use
modules. Therefore the performance penalty is not measurable. If in the
future more tests use modules it would be good to measure the overhead
and determine whether it's acceptable.
2024-01-17 08:15:18 +01:00
Mark de Wever
d06ae33ec3
[libc++][modules] Removes module testing. (#76083)
This removes the entire modules testing infrastructure.

The current infrastructure uses CMake to generate the std and std.compat
module. This requires quite a bit of plumbing and uses CMake. Since
CMake introduced module support in CMake 3.26, modules have a higher
CMake requirement than the rest of the LLVM project. (The LLVM project
requires 3.20.) The main motivation for this approach was how libc++
generated its modules. Every header had its own module partition. This
was changed to improve performance and now only two modules remain. The
code to build these can be manually crafted.

A followup patch will reenable testing modules, using a different
approach.
2024-01-17 08:11:25 +01:00
Mark de Wever
4a87db6b10
[libc++][print] Enables it on Apple backdeployment. (#76293)
As suggested in #73262 this enable the stream printing on Apple
backdeployment targets. This omits the check whether the file is a
terminal. This is not entirely conforming, but the differences should be
minor and are typically not observable.

Fixes https://github.com/llvm/llvm-project/issues/75225
2024-01-16 19:14:33 +01:00
Mark de Wever
e0443624b9
[libc++] Deprecate removed features macros. (#77879)
We discussed the removal of these enable-all macros in the libc++
monthly meeting and we agreed that we should deprecate these macros in
LLVM 18, and then remove them in LLVM 19 since they can silently enable
deprecated features that are implemented after the first release of the
macro.

This patch does the first part of this -- it deprecates the macro.

Note that the file
  test/libcxx/depr/enable_removed_cpp20_features.compile.pass.cpp
does not exist so this file is not adapted. Since the feature is
deprecated and slated for removal soon the missing test is not
implemented.

Partly addresses: https://github.com/llvm/llvm-project/issues/75976

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2024-01-16 19:12:59 +01:00
Mark de Wever
82d21814e6
[libc++][print] Includes <format>. (#76333)
The overloads of `println` are specified in terms of `format`. The
function `format` is specified to work with ranges.

The implementations for `println` do not include `<format>`, but
libc++'s granularized header. This means the following example does not
work

  #include <vector>
  #include <print>

  int main() {
      std::vector<int> v{1, 2, 3};
      std::println("{}", v);
  }

(The other print functions also require this to work, they are specified
in terms of other format functions.)

Fixes: https://github.com/llvm/llvm-project/issues/71925
2024-01-16 17:33:01 +01:00
Hristo Hristov
bddd8f46f8
[libc++][concepts] Implements concept helper __libcpp_integer (#78086)
...and tests.

---------

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-15 00:00:57 +02:00
Tacet
60ac394dc9
[ASan][libc++] Annotating std::basic_string with all allocators (#75845)
This commit turns on ASan annotations in `std::basic_string` for all
allocators by default.

Originally suggested here: https://reviews.llvm.org/D146214

String annotations added here:
https://github.com/llvm/llvm-project/pull/72677

This commit is part of our efforts to support container annotations with
(almost) every allocator. Annotating `std::basic_string` with default
allocator is implemented in
https://github.com/llvm/llvm-project/pull/72677.

Additionally it removes `__begin != nullptr` because `data()` should
never return a nullptr.

Support in ASan API exists since
1c5ad6d2c0.
This patch removes the check in std::basic_string annotation member
function (__annotate_contiguous_container) to support different
allocators.

You can turn off annotations for a specific allocator based on changes
from
2fa1bec7a2.

The motivation for a research and those changes was a bug, found by
Trail of Bits, in a real code where an out-of-bounds read could happen
as two strings were compared via a call to `std::equal` that took
`iter1_begin`, `iter1_end`, `iter2_begin` iterators (with a custom
comparison function). When object `iter1` was longer than `iter2`, read
out-of-bounds on `iter2` could happen. Container sanitization would
detect it.

If you have any questions, please email:
- advenam.tacet@trailofbits.com
- disconnect3d@trailofbits.com
2024-01-13 18:11:53 +01:00
Will Hawkins
882b4fccd2
[libc++][NFC] Make AssertionInfoMatcher::CheckMessageMatches Stricter (#77721)
Rather than allow for a message to be considered a match for the actual
assertion if it is anywhere in the assertion text, make sure that the
expected and the actual assertion are identical.

Addresses #77701
2024-01-12 14:45:52 -05:00
Wu Yingcong
dc1ae83789
[libc++][test] Fix a logical mistake introduced by #77058 (#77867)
A logical mistake is made in #77058, we should try to find a new file
path for socket creation when the path's length generated is bigger than
the socket length limit.
2024-01-12 17:48:34 +01:00
Louis Dionne
8751bbe7d3
[libc++] Deprecate the _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS macro (#77692)
As described in #69994, using the escape hatch makes us non-conforming
in C++20 due to incorrect constexpr-ness. It also leads to bad
diagnostics as reported by #63900. We discussed the issue in the libc++
monthly meeting and we agreed that we should deprecate the macro in LLVM
18, and then remove it in LLVM 19 since it causes too many problems.

This patch does the first part of this -- it deprecates the macro.

Fixes #69994
Fixes #63900
Partially addresses #75975
2024-01-12 09:51:14 -05:00
S. B. Tam
e0c734561d
[libc++][test] Replace uses of _LIBCPP_ABI_MICROSOFT in tests (#77233) 2024-01-11 10:55:52 +08:00
Christopher Di Bella
98e3d98bf3
[libc++] Rename local variable to avoid shadowing error (#77672)
Due to the inclusion of a header, a global type is was being shadowed,
which upset GCC.
2024-01-10 17:28:22 -05:00
Louis Dionne
5c9b713394 [libc++][NFC] Fix typo in comments 2024-01-10 13:41:59 -05:00
Louis Dionne
f502b981b4 [libc++][NFC] Add comment in test to explain the presence of some assertions 2024-01-10 13:02:50 -05:00
Will Hawkins
e07a2f49e3
[libc++][NFC] Create and use test-defined simple_view concept (#77334)
Instead of using a concept defined in the internal implementation, use a
definition of the simple_view ranges concept separately defined and
included in test code.
2024-01-09 14:07:32 -08:00
James Touton
65a1efc60c
Fixed shared_ptr comparisons with nullptr_t when spaceship is unavailable. (#76781)
This was causing compilation errors when attempting to compare a
`shared_ptr<T[]>` with `nullptr`, as `get()` returns `T*` rather than `T
(*)[]`. `unique_ptr` did not have this issue, but I've added tests to
make sure.
2024-01-09 20:41:24 +01:00
Sanjay Marreddi
0804ef2d15
[libc++] Fix regex_search to match $ alone with match_default flag (#77256)
Using `regex_search` with the regex_constant `match_default` and a
simple regex pattern `$` is expected to match general strings such as
_"a", "ab", "abc"..._ at `[last, last)` positions. But, the current
implementation fails to do so.

Fixes #75042
2024-01-09 20:39:36 +01:00
Wu Yingcong
a43e0f90b6
[libc++][test] try to directly create socket file in /tmp when filepath is too long (#77058)
If TMP is set to a folder which path is too long, the current libcxx
test helper function `create_socket()` will fail because of the test
temp folder `test_root`'s path is too long to be used in socket
creation.
In such case, this patch will try to create the socket file directly in
`/tmp` folder.

This patch also add an assertion for `bind()`.
2024-01-09 20:15:44 +01:00
Mark de Wever
d29297239f
[libc++] Implements P2517R1. (#77239)
As pointed out by @Zingam the paper was implemented in libc++ as an
extension. This patch does the bookkeeping. The inital release version
is based on historical release dates.

Completes:
- Add a conditional noexcept specification to std::apply
2024-01-09 19:11:40 +01:00
Louis Dionne
ca06c330fd
[libc++] Allow running the test suite with optimizations (#68753)
This patch adds a configuration of the libc++ test suite that enables
optimizations when building the tests. It also adds a new CI
configuration to exercise this on a regular basis. This is added in the
context of [1], which requires building with optimizations in order to
hit the bug.

[1]: https://github.com/llvm/llvm-project/issues/68552
2024-01-09 10:39:14 -05:00