Commit Graph

9815 Commits

Author SHA1 Message Date
Alex Richardson 0a893cfb44 [libc++] Avoid relying on non-portable behaviour in std::align
Round-tripping pointers via size_t is not portable, the C/C++ standards
only require this to be valid when using (u)intptr_t.
Originally committed to the CHERI fork of LLVM as
dd01245185,
but I forgot to upstream the change. I rediscovered this issue due to a
compiler warning when building libc++ on a Arm Morello system.

Reviewed By: #libc, ldionne, philnik

Differential Revision: https://reviews.llvm.org/D134363
2022-10-03 12:45:21 +00:00
Vitaly Buka dd9dfb57da [libc++] Remove a part of reverted D131898 or D130695 2022-10-03 00:51:21 -07:00
Vitaly Buka 724af35849 Revert "[libc++] Updates generated transitve includes."
Looks like a part of reverted D131898.

This reverts commit cfd5b8f111.
2022-10-03 00:42:55 -07:00
Vitaly Buka 71410fd2c0 Revert "[libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction)"
Breaks ubsan tests https://lab.llvm.org/buildbot/#/builders/85/builds/11131

This reverts commit 099384dcea.
2022-10-02 18:40:43 -07:00
Vitaly Buka a6e1080b87 Revert "[libc++][ranges]Refactor `copy{,_backward}` and `move{,_backward}`"
Breaks msan, asan

https://lab.llvm.org/buildbot/#/builders/5/builds/27904

This reverts commit 005916de58.
2022-10-02 16:23:35 -07:00
Mark de Wever cfd5b8f111 [libc++] Updates generated transitve includes.
This should fix the CI.
2022-10-02 19:37:21 +02:00
Konstantin Varlamov 005916de58 [libc++][ranges]Refactor `copy{,_backward}` and `move{,_backward}`
Instead of using `reverse_iterator`, share the optimization between the 4 algorithms. The key observation here that `memmove` applies to both `copy` and `move` identically, and to their `_backward` versions very similarly. All algorithms now follow the same pattern along the lines of:
```
if constexpr (can_memmove<InIter, OutIter>) {
  memmove(first, last, out);
} else {
  naive_implementation(first, last, out);
}
```
A follow-up will delete `unconstrained_reverse_iterator`.

This patch removes duplication and divergence between `std::copy`, `std::move` and `std::move_backward`. It also improves testing:
- the test for whether the optimization is used only applied to `std::copy` and, more importantly, was essentially a no-op because it would still pass if the optimization was not used;
- there were no tests to make sure the optimization is not used when the effect would be visible.

Differential Revision: https://reviews.llvm.org/D130695
2022-10-01 17:35:12 -07:00
Nikolas Klauser 7e6a193f13 [libc++] Enable libc++-specific tests for constexpr string
Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D128578
2022-10-01 22:50:22 +02:00
Nikolas Klauser ed2d3644ab [libc++][NFC] Prefer type aliases over structs
Reviewed By: ldionne, #libc

Spies: sstefan1, libcxx-commits, jeroen.dobbelaere

Differential Revision: https://reviews.llvm.org/D134901
2022-10-01 22:49:36 +02:00
Nikolas Klauser 099384dcea [libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction)
Reviewed By: ldionne, #libc, huixie90

Spies: huixie90, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D131898
2022-10-01 15:18:06 +02:00
Jonathan Wakely ef843c8271 [libc++] Fix ADL for `make_error_{code,condition}`
Implement LWG 3629, by making lookup for make_error_code and
make_error_condition only consider names found by ADL. This is achieved
by adding a block scope using-declaration for a function that will be
found by unqualified lookup, preventing unqualified lookup from
continuing to enclosing scopes (the class scope, then enclosing
namespaces). The function named by the using declaration is not
viable, so overload resolution must select a candidate found by ADL.

This fixes https://github.com/llvm/llvm-project/issues/57614

Differential Revision: https://reviews.llvm.org/D134943
2022-09-30 17:23:45 -04:00
Louis Dionne a48f018bb7 [runtimes] Remove all traces of the legacy testing configuration system
Now that all jobs have moved over to the new style of Lit configuration,
we can remove all traces of the legacy testing configuration system.
This includes:
- Cache settings that are not honored or useful anymore
- Several CMake options that were only useful in the context of the
  legacy Lit configuration system
- A bunch of Python support code that is not used anymore
- The legacy lit.cfg.in files themselves

Differential Revision: https://reviews.llvm.org/D134650
2022-09-30 15:03:33 -04:00
Louis Dionne 3d118f2901 [libc++] Remove unique usage of the en_US locale in a test
Differential Revision: https://reviews.llvm.org/D134914
2022-09-30 14:59:55 -04:00
Louis Dionne fd4680fd2c [libc++] Include skipped headers in the --trace-includes output
By default, Clang does not include headers that are skipped due to
the include guard optimization in the --trace-includes output, which
breaks the use case that we were trying to use it for.

However, Clang does support the -fshow-skipped-includes flag, which
does exactly what we need and will result in an accurate include
graph.

As a fly-by fix, make sure that our includes don't differ between
-fexceptions and -fno-exceptions.

Differential Revision: https://reviews.llvm.org/D134829
2022-09-29 15:07:10 -04:00
Mark de Wever eb61cf373c [NFC][libc++][test] Enables variant test.
Noticed this while working on D133326. Let's see whehter all compilers
now support this feature.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D134818
2022-09-29 17:28:19 +02:00
Louis Dionne b9cba8ccd3 [libc++] Add missing return 0;'s to main() functions in tests 2022-09-29 10:35:00 -04:00
Louis Dionne ee8dd43c24 [libc++] Remove MSVC tests checked into the libc++ test suite
We should strive to have our own tests, except when there is overwhelming
value in using another standard library's existing tests. The reason is
that it ensures that implementations don't all start relying on the same
interpretation of the Standard.

The unique_ptr tests did not add any test coverage AFAICT, and the
forward_like tests were moved to the style used everywhere in the
libc++ test suite.

Note that I got to this because this actually broke a downstream
configuration where we use -ffreestanding. The signature of main()
was not consistent with the signature we (need to) use everywhere
in the test suite.

Differential Revision: https://reviews.llvm.org/D134767
2022-09-28 08:03:01 -04:00
Hui Xie 83ead2bbc5 [libc++] implement "pair" section of P2321R2 `zip`
Differential Revision: https://reviews.llvm.org/D131495
2022-09-28 11:24:54 +01:00
Nikolas Klauser 473a160506 [libc++][NFC] Fix some standard-mandated includes comments
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D134447
2022-09-27 21:11:53 +02:00
Gergely Nagy afec0f0ec3 [libcxx] Make stdatomic.h work when included from a C source file
If a C source file includes the libc++ stdatomic.h, compilation will
break because (a) the C++ standard check will fail (which is expected),
and (b) `_LIBCPP_COMPILER_CLANG_BASED` won't be defined because the
logic defining it in `__config` is guarded by a `__cplusplus` check, so
we'll end up with a blank header. Move the detection logic outside of
the `__cplusplus` check to make the second check pass even in a C context
when you're using Clang. Note that `_LIBCPP_STD_VER` is not defined when
in C mode, hence stdatomic.h needs to check if in C++ mode before using
that macro to avoid a warning.

In an ideal world, a C source file wouldn't be including the libc++
header directory in its search path, so we'd never have this issue.
Unfortunately, certain build environments make this hard to guarantee,
and in this case it's easy to tweak this header to make it work in a C
context, so I'm hoping this is acceptable.

Fixes https://github.com/llvm/llvm-project/issues/57710.

Differential Revision: https://reviews.llvm.org/D134591
2022-09-27 13:13:11 -04:00
Nikita Popov e911ece557 [libcxx] Support LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY + LIBCXX_ENABLE_ABI_LINKER_SCRIPT
Currently if both LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY (only
applies to static library) and LIBCXX_ENABLE_ABI_LINKER_SCRIPT (only
applies to shared library) are enabled, the former will be silently
ignored. The shared library will use a linker script, while the
static library fails to link libc++abi.a entirely.

This is caused by what appears to be an implementation bug: The
LIBCXX_STATICALLY_LINK_ABI_IN_*_LIBRARY options are declared as
dependent options of LIBCXX_ENABLE_STATIC_ABI_LIBRARY, rather than
simply using it as the default value.

Of course, the combination of
LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY and
LIBCXX_ENABLE_ABI_LINKER_SCRIPT still results in a cmake error,
because these would be conflicting requests for the shared library.

Differential Revision: https://reviews.llvm.org/D134644
2022-09-27 10:04:54 +02:00
Louis Dionne b6ff5b470d [libc++] Use XXYYZZ instead of XXYZZ for _LIBCPP_VERSION
As discussed on Discord.

Differential Revision: https://reviews.llvm.org/D134209
2022-09-26 11:22:04 -04:00
Louis Dionne f397775000 [libc++] Add release note about unary_function and binary_function being removed in >= C++17 2022-09-26 09:45:21 -04:00
Hui Xie 4851fbc3cf fix errors on passing input iterator to `std::views::take`
In the implementation of `std::views::take`, it uses `subrange<Iter>` as part of the return type. But in case of input iterator, `subrange<Iter>` can be ill-formed

Differential Revision: https://reviews.llvm.org/D133220
2022-09-25 15:41:13 +01:00
Mark de Wever ddb6c2b301 [libc++] Rewrites graph_header_deps.py.
The new version is a lot simpler and has less option which were not
used. This uses the CSV files as generated by D133127 as input data.

The current Python script has more features but uses a simple "grep"
making the output less accurate:
- Conditionally included header are always included. This is an issue
  since part of our includes are unneeded transitive includes. Based on
  the language version they may be omitted. The script however always
  includes them.
- Includes in comments are processed as-if they are includes. This is an
  issue when comments explain how certain data is generated; of course
  there are digraphs which the script omits.

This implementation uses Clang's --trace-includes to generate the includes
per header. This means the input of the generation script always has the
real list of includes.

Libc++ is moving from large monolithic Standard headers to more fine
grained headers. For example, algorithm includes every header in
`__algorithm`. Adding all these detail headers in the graph makes the
output unusable. Instead it only shows the Standard headers. The
transitive includes of the detail headers are parsed and "attributed" to
the Standard header including them. This gives an accurate include graph
without the unneeded clutter. Note that this graph is still big.

This changes fixes the cyclic dependency issue with the previous version
of the tool so the markers and its documentation is removed.

Since the input has no cycles the CI test is removed.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D134188
2022-09-25 15:06:21 +02:00
Mark de Wever 34dfdd17af [libc++][test] Improves transitive includes.
This test generates the include graph of the Standard headers of libc++ in
a CSV file. This was originally used to generate graphviz dot files. During
review it was noticed these files have all information needed to replace
the current transitive includes. Therefore the output, with the same information as the .dot file is stored in a .csv file. This removes
all the existing transitive include files.

The .cvs can be converted by a .dot file by the script in D134188.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133127
2022-09-25 13:20:27 +02:00
Louis Dionne 6b03a4fea0 Revert "[llvm] Remove libcxx, libcxxabi and libunwind from supported LLVM_ENABLE_PROJECTS"
This reverts commit 887b8bd733 while we
work on resolving issues brought up in https://reviews.llvm.org/D132480.
2022-09-21 08:38:00 -04:00
Mark de Wever 8b3a907fb8 [libc++] Use Clang-16 for c++17.
Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D132788
2022-09-21 07:48:06 +02:00
Mark de Wever 088c7f7e3c [libc++] Applies P0602R4 retro-actively.
While testing a test failure of C++17 with Clang ToT it was noticed the
paper
  P0602R4 variant and optional should propagate copy/move triviality
was not applied as a DR in libc++.

This was discovered while investigating the issue "caused by" D131479.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133326
2022-09-20 19:01:34 +02:00
Mark de Wever 7c932cdb10 [NFC][libc++][format] Uses ranges algorithm.
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D134060
2022-09-20 18:59:50 +02:00
Mark de Wever d23f609d9c [libc++][test] Adds format string helper.
Update the formatter day tests to the new style.
Other test will be done separately.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D134031
2022-09-20 18:58:37 +02:00
Mark de Wever f2a263512c [libc++][chrono] Removes format include.
Switch to the new granular format_functions header. Since the chrono's
format dependency in C++20 hasn't been in a release it's save to remove
it.

Depends on D133665

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133796
2022-09-20 18:58:13 +02:00
Mark de Wever 00798e5006 [libc++][format] Granularizes the format header.
Moves the last pieces of code to its own header.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D133665
2022-09-20 18:57:10 +02:00
Louis Dionne 887b8bd733 [llvm] Remove libcxx, libcxxabi and libunwind from supported LLVM_ENABLE_PROJECTS
This is a breaking change. If you were passing one of those three runtimes
in LLVM_ENABLE_PROJECTS, you need to start passing them in LLVM_ENABLE_RUNTIMES
instead. The runtimes in LLVM_ENABLE_RUNTIMES will start being built using
the "bootstrapping build" instead, which means that they will be built
using the just-built Clang. This is usually what you wanted anyway.

If you were using LLVM_ENABLE_PROJECTS=all with the explicit goal of
building these three runtimes, you can now use LLVM_ENABLE_RUNTIMES=all
and these runtimes will be built using the bootstrapping build.

Differential Revision: https://reviews.llvm.org/D132480
2022-09-20 11:12:51 -04:00
Nikolas Klauser 55158efe10 [libc++] Remove MSVC code
It's been one and a half months now and nobody said anything, so I guess this code can be removed.

Reviewed By: ldionne, #libc

Spies: Mordante, libcxx-commits, mgorny, mstorsjo

Differential Revision: https://reviews.llvm.org/D132943
2022-09-20 10:11:42 +02:00
Nikolas Klauser 54150e8257 [libc++][NFC] Refactor enable_ifs in vector
Using the `enable_if_t<..., int> = 0` style has the benefit that it works in all cases and makes function declarations easier to read because the function arguments and return type and SFINAE are separated. Unifying the style also makes it easier for people not super familiar with SFINAE to make sense of the code.

Reviewed By: Mordante, var-const, #libc, huixie90

Spies: huixie90, libcxx-commits

Differential Revision: https://reviews.llvm.org/D131868
2022-09-20 10:06:34 +02:00
Louis Dionne ad0dfb4f5e [libc++] Document the format of _LIBCPP_VERSION
Differential Revision: https://reviews.llvm.org/D134187
2022-09-19 15:31:02 -04:00
Louis Dionne f1a601fe88 [libc++] Always query the compiler to find whether a type is always lockfree
In https://llvm.org/D56913, we added an emulation for the __atomic_always_lock_free
compiler builtin when compiling in Freestanding mode. However, the emulation
did (and could not) give exactly the same answer as the compiler builtin,
which led to a potential ABI break for e.g. enum classes.

After speaking to the original author of D56913, we agree that the correct
behavior is to instead always use the compiler builtin, since that provides
a more accurate answer, and __atomic_always_lock_free is a purely front-end
builtin which doesn't require any runtime support. Furthermore, it is
available regardless of the Standard mode (see https://godbolt.org/z/cazf3ssYY).

However, this patch does constitute an ABI break. As shown by https://godbolt.org/z/1eoex6zdK:
- In LLVM <= 11.0.1, an atomic<enum class with 1 byte> would not contain a lock byte.
- In LLVM >= 12.0.0, an atomic<enum class with 1 byte> would contain a lock byte.

This patch breaks the ABI again to bring it back to 1 byte, which seems
like the correct thing to do.

Fixes #57440

Differential Revision: https://reviews.llvm.org/D133377
2022-09-19 11:10:02 -04:00
Nikolas Klauser 7afa1598a3 [libc++] Avoid including <tuple> in compressed_pair.h
compressed_pair is widely used in the library, but most of the uses don't use the tuple parts. To avoid including <tuple> everywhere, use the forward declaration instead in compressed_pair.h

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D133331
2022-09-18 10:49:35 +02:00
Nikolas Klauser 87abc5013a [libc++][NFC] Inline the string constructors
This removes a lot of boilerplate code.

Reviewed By: ldionne, #libc

Spies: EricWF, libcxx-commits

Differential Revision: https://reviews.llvm.org/D128081
2022-09-17 18:00:11 +02:00
Nikolas Klauser d3a0ac92e9 [libc++] Add test to ensure that type trait aliases in dependent return types can be mangled
Reviewed By: ldionne, #libc

Spies: libcxx-commits, jeroen.dobbelaere

Differential Revision: https://reviews.llvm.org/D133196
2022-09-17 14:25:09 +02:00
Xing Xue 8ace9ea258 [libc++][lit][AIX] Enable test case last_write_time.pass.cpp for AIX
Summary:
This patch enables libc++ LIT test case last_write_time.pass.cpp for AIX. Because system call utimensat() of AIX which is used in the libc++ implementation of last_write_time() does not accept the times parameter with a negative tv_sec or tv_nsec field, testing of setting file time to before epoch time is excluded for AIX.

Reviewed by: ldionne, libc++

Differential Revision: https://reviews.llvm.org/D133124
2022-09-16 16:08:40 -04:00
Muiez Ahmed 1b445cada5 [SystemZ][z/OS] define REMOVE_ALL_USE_DIRECTORY_ITERATOR (libc++)
This patch fixes the z/OS build by using the first implementation of __remove_all since we don't have access to the openat() family of POSIX functions.

Differential Revision: https://reviews.llvm.org/D132948
2022-09-16 10:22:21 -04:00
Mark de Wever c632ee1c5d [libc++] Shows the detailed compiler version info.
The libc++ pre-commit CI uses Clang nightly builds. Currently it's not
possible to determine the exact version used since CMake doesn't show
this information by default. Instead use the --version flag to get this
information.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133122
2022-09-16 16:15:36 +02:00
Mark de Wever c0ac3c1142 [NFC][libc++][test] Uses public functions.
Replaces std::__format_context_create with the public wrapper
test_format_context_create.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133781
2022-09-16 14:57:21 +02:00
Matheus Izvekov 55e6078d21
NFC: remove accidental inclusion of libcxx test changes
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
2022-09-16 11:39:49 +02:00
Matheus Izvekov 989f76ce90
[clang] template / auto deduction deduces common sugar
After upgrading the type deduction machinery to retain type sugar in
D110216, we were left with a situation where there is no general
well behaved mechanism in Clang to unify the type sugar of multiple
deductions of the same type parameter.

So we ended up making an arbitrary choice: keep the sugar of the first
deduction, ignore subsequent ones.

In general, we already had this problem, but in a smaller scale.
The result of the conditional operator and many other binary ops
could benefit from such a mechanism.

This patch implements such a type sugar unification mechanism.

The basics:

This patch introduces a `getCommonSugaredType(QualType X, QualType Y)`
method to ASTContext which implements this functionality, and uses it
for unifying the results of type deduction and return type deduction.
This will return the most derived type sugar which occurs in both X and
Y.

Example:

Suppose we have these types:
```
using Animal = int;
using Cat = Animal;
using Dog = Animal;

using Tom = Cat;
using Spike = Dog;
using Tyke = Dog;
```
For `X = Tom, Y = Spike`, this will result in `Animal`.
For `X = Spike, Y = Tyke`, this will result in `Dog`.

How it works:

We take two types, X and Y, which we wish to unify as input.
These types must have the same (qualified or unqualified) canonical
type.

We dive down fast through top-level type sugar nodes, to the
underlying canonical node. If these canonical nodes differ, we
build a common one out of the two, unifying any sugar they had.
Note that this might involve a recursive call to unify any children
of those. We then return that canonical node, handling any qualifiers.

If they don't differ, we walk up the list of sugar type nodes we dived
through, finding the last identical pair, and returning that as the
result, again handling qualifiers.

Note that this patch will not unify sugar nodes if they are not
identical already. We will simply strip off top-level sugar nodes that
differ between X and Y. This sugar node unification will instead be
implemented in a subsequent patch.

This patch also implements a few users of this mechanism:
* Template argument deduction.
* Auto deduction, for functions returning auto / decltype(auto), with
  special handling for initializer_list as well.

Further users will be implemented in a subsequent patch.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D111283
2022-09-16 11:20:10 +02:00
Nikita Popov 57c7bb3ec8 [libcxx] Use interface library for libcxx-abi-shared
The libc++.so linker script generation uses the IMPORTED_LIBNAME
target property on libcxx-abi-shared. However, libcxx-abi-shared
is not an interface library and as such cannot have an
IMPORTED_LIBNAME target property.

Convert libcxx-abi-shared into an imported interface library
and use IMPORTED_LIBNAME in place of IMPORTED_LOCATION. This makes
linker script generation work correctly with system-libcxxabi.

I believe this fixes the issue that D131037 was intended to fix.

Differential Revision: https://reviews.llvm.org/D133566
2022-09-16 10:13:39 +02:00
Colin Cross 13c6828bed Fix std::fpos pretty printer on musl
The mbstate_t field in std::fpos is an opaque type provied by libc,
and musl's implementation does not match the one used by glibc.
Change StdFposPrinter to verify its assumptions about the layout
of mbstate_t, and leave out the state printing if it doesn't match.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D132983
2022-09-15 21:58:24 +00:00
Joe Loser f97cc6b712 [libc++] Clean up `_LIBCPP_HAS_NO_PLATFORM_WAIT` macro
As the comment suggests, `_LIBCPP_HAS_NO_PLATFORM_WAIT` is not documented or
defined anywhere internally in the build system. It's a direct define in terms
of `_LIBCPP_HAS_NO_THREADS`. So, remove `_LIBCPP_HAS_NO_PLATFORM_WAIT` and use
`_LIBCPP_HAS_NO_THREADS` instead to control the desired behavior.

Differential Revision: https://reviews.llvm.org/D132715
2022-09-15 09:45:21 -06:00
Louis Dionne 7ecd4d2b7c [libc++] Add LLDB data formatters dependencies to the CI image
This will be required in order to add a CI job running the LLDB
data formatters.
2022-09-12 10:56:54 -04:00
Tom Honermann 946849f6d0 [libc++] Workaround the absence of the __GLIBC_USE macro in glibc versions prior to 2.25.
This change correct a configuration check that relies on the glibc __GLIBC_USE
macro being defined. Previously, the function-like macro was expanded without
ensuring it was actually defined. This resulted in compilation failures for
glibc versions prior to 2.25 (the glibc version in which the macro was added).

Differential Revision: https://reviews.llvm.org/D130946
2022-09-11 16:39:37 -04:00
Mark de Wever 24e1736d84 [libc++][random] Removes transitive includes.
It seems these includes are still provided by the sub headers, so it only
removes the duplicates.

There is no change in the list of includes, but the change affects the
modular build. By not having the includes in the top-level header the
module map has changed. This uncovers missing includes in the tests
and missing exports in the module map. This causes the huge amount of
changes in the patch.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133252
2022-09-11 17:39:27 +02:00
Mark de Wever 52a374e938 [libc++][doc] Updates format status page. 2022-09-11 12:12:22 +02:00
Tom Honermann 7e7013c5d4 [libc++][cuchar] Declare std::c8rtomb and std::mbrtoc8 in <cuchar> if available.
This change implements the C library dependent portions of P0482R6
(char8_t: A type for UTF-8 characters and strings (Revision 6)) by
declaring std::c8rtomb() and std::mbrtoc8() in the <cuchar> header
when implementations are provided by the C library as specified by
WG14 N2653 (char8_t: A type for UTF-8 characters and strings
(Revision 1)) as adopted for C23.

A _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 macro is defined by the libc++ __config
header unless it is known that the C library provides these functions
in the current compilation mode. This macro is used for testing purposes
and may be of use to libc++ users. At present, the only C library known
to implement these functions is GNU libc as of its 2.36 release.

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D130946
2022-09-10 21:10:33 -04:00
Nikolas Klauser 860753934c [libc++] Bump _LIBCPP_STD_VER to the next expected C++ version
We've decided to use `_LIBCPP_STD_VER >= xy` while discussing to change the constexpr macros, so let's finally bump the version macro to match that.

Reviewed By: ldionne, Mordante, huixie90, #libc, avogelsgesang

Spies: avogelsgesang, libcxx-commits

Differential Revision: https://reviews.llvm.org/D133323
2022-09-10 09:53:20 +02:00
Louis Dionne d529e8110b [libc++] Fix compilation error on platforms that don't implement std::tm
Instead of mentioning tm directly in the definition of __convert_to_tm,
take it as a template argument. As a fly-by also fix incorrect Lit feature
(should have been no-localization instead of libcpp-has-no-localization).

Differential Revision: https://reviews.llvm.org/D133490
2022-09-08 18:10:53 -04:00
Mark de Wever 3695cf2065 [libc++] Removes Clang 13 support.
Reviewed By: #libc, ldionne, jloser

Differential Revision: https://reviews.llvm.org/D133435
2022-09-08 17:51:52 +02:00
Mark de Wever de4a2b7381 [libc++] Fixes CI.
It seems merging the changes in transitive macros and recent commits
conflicted.
2022-09-07 19:58:21 +02:00
Mark de Wever ab7b776cf9 [libc++][locale] Removes an transitive include.
Removes <cstdarg> transitive include from <locale> in C++23.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133254
2022-09-07 18:54:26 +02:00
Mark de Wever e5d2d3eafb [libc++][chrono] Implements formatter day.
This implements the enabled specializaton
template<class charT> struct formatter<chrono::day, charT>;

and
template<class charT, class traits>
    basic_ostream<charT, traits>&
      operator<<(basic_ostream<charT, traits>& os, const day& d);

Implements:
- LWG 3241 chrono-spec grammar ambiguity in §[time.format]

Partially implements:
- P1361 Integration of chrono with text formatting

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D128577
2022-09-07 18:44:04 +02:00
Mark de Wever b490c8a662 [libc++][format] Updates feature-test macros.
During the discussion on the SG-10 mailinglist regarding the format
feature-test macros voted in during the last plenary it turns out libc++
can't mark the format feature-test macro as implemented.

According to
  https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#__cpp_lib_format
the not yet implemented paper
  P1361R2 Integration of chrono with text formatting
affects the feature test macro.

Note that P1361R2 doesn't mention the feature-test macro nor is there an
LWG-issue to address the issue. The reporter of the issue didn't recall
where this requirement exactly has been decided.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D133271
2022-09-07 18:39:39 +02:00
Vitaly Buka beb413acce [test][libcxx] Mark ubsan test as UNSUPPORTED
It inconsistently fails on bots.
2022-09-06 13:44:28 -07:00
Matheus Izvekov 94c6dfbaeb
[clang] Implement setting crash_diagnostics_dir through env variable
This implements setting the equivalent of `-fcrash-diagnostics-dir`
through the environment variable `CLANG_CRASH_DIAGNOSTICS_DIR`.
If present, the flag still takes precedence.

This helps integration with test frameworks and pipelines.

With this feature, we change the libcxx bootstrapping build
pipeline to produce clang crash reproducers as artifacts.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D133082
2022-09-06 19:27:37 +02:00
Nikolas Klauser 5fab33af7f [libc++] Avoid instantiating type_trait classes
Use `using` aliases to avoid instantiating lots of types

Reviewed By: ldionne, #libc

Spies: libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D132785
2022-09-06 19:09:42 +02:00
Nikolas Klauser 2d52c6bfae [libc++] Granularize __tuple
Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D133081
2022-09-05 16:36:24 +02:00
Nikolas Klauser e0b3356e67 [libc++] Enable rvalue overloads for pair in C++03
We require rvalue support anyways, so let's use it.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D133013
2022-09-05 14:40:17 +02:00
Nikolas Klauser d5e26775d0 [libc++] Granularize the rest of memory
Reviewed By: ldionne, #libc

Spies: vitalybuka, paulkirth, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D132790
2022-09-05 12:36:41 +02:00
Igor Zhukov 30dadaa2eb [libc++] Implement P2273R3 (`constexpr` `unique_ptr`)
Reviewed By: mordante, #libc

Differential Revision: https://reviews.llvm.org/D131315
2022-09-03 18:49:50 +07:00
Mark de Wever 4004fb6453 [NFC][libc++] Uses the new way to mark Standard includes. 2022-09-03 13:35:48 +02:00
Mark de Wever 49c3c40cc0 [NFC][libc++][format] Removes unused code.
The code was for backwards compatibility with code no longer present in
format.
2022-09-03 13:34:14 +02:00
Mark de Wever 56065c4c8e [NFC][libc++] Removes GCC-11 support.
GCC-11 isn't supported in libc++ so remove UNSUPPORTED directives.
2022-09-03 13:20:10 +02:00
Mark de Wever ba6ad62081 [libc++] Fixes generated output CI job.
It seems there was another file with the same issue, which didn't show
up initially.
2022-09-03 10:19:35 +02:00
Mark de Wever e31c2a1b1a [NFC][libc++] Moves transitive includes location.
As discussed in D132284 they will be moved to the end.

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D133212
2022-09-03 10:06:16 +02:00
Mark de Wever ff06c2ded3 [libc++] Fixes generated output CI job. 2022-09-03 10:04:44 +02:00
Vitaly Buka bc8fd9c633 Revert "[libc++] Granularize the rest of memory"
Breaks buildbots.

This reverts commit 30adaa730c.
2022-09-02 19:42:49 -07:00
Igor Zhukov 3a49cffe3a [libc++] Implement P2445R1 (`std::forward_like`)
Co-authored-by: A. Jiang <de34@live.cn>

Reviewed By: philnik, huixie90, #libc

Differential Revision: https://reviews.llvm.org/D132327
2022-09-03 09:17:53 +07:00
Nikolas Klauser c747bd0e23 [libc++][NFC] Copy the whole union instead of a member; also remove __zero()
This doesn't affect code-gen

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132951
2022-09-02 21:44:57 +02:00
Nikolas Klauser 30adaa730c [libc++] Granularize the rest of memory
Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D132790
2022-09-02 21:42:41 +02:00
Nikolas Klauser cac9a6fb0e [libc++] Remove noexcept specifier from operator""s
For some reason `operator""s(const char8_t*, size_t)` was marked `noexcept`. Remove it and add regression tests.

Reviewed By: ldionne, huixie90, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132340
2022-09-02 21:37:32 +02:00
Nikolas Klauser 84fc2c3cd6 [libc++] Make the naming of private member variables consistent and enforce it through readability-identifier-naming
Reviewed By: ldionne, #libc

Spies: aheejin, sstefan1, libcxx-commits

Differential Revision: https://reviews.llvm.org/D129386
2022-09-02 21:36:36 +02:00
Nikolas Klauser 3c355e2881 [libc++] Enable [[nodiscard]] extensions by default
Adding `[[nodiscard]]` to functions is a conforming extension and done extensively in the MSVC STL.

Reviewed By: ldionne, EricWF, #libc

Spies: #libc_vendors, cjdb, mgrang, jloser, libcxx-commits

Differential Revision: https://reviews.llvm.org/D128267
2022-09-02 21:34:20 +02:00
Mark de Wever 9185d6e6bc [libc++] Avoids self references in transitive include test.
The output of --trace-includes starts with the header whose includes are
being processed. Since the sanitize script processed all lines this
include was added to the list of transitive includes. This looks odd
since it implies all headers have a cyclic dependency on themselves.
This change removes this self-include.

Instead of just dropping the first line extract that header and use it
to guard against cyclic dependencies in the header itself.

The regex used has a small improvement; don't capture groups that aren't
extracted.

Depends on D132284

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D132787
2022-09-01 20:33:37 +02:00
Mark de Wever 2928b230ce [NFC][libc++] char_traits code cleanups.
These cleanups were identified while working on D130295.

Reviewed By: #libc, ldionne, philnik

Differential Revision: https://reviews.llvm.org/D131185
2022-08-31 22:18:10 +02:00
Mark de Wever 37c98da395 [libc++][format] Fixes broken CI.
Some of the merged patches didn't have conflicts but were not
compatible. This should fix it.
2022-08-31 20:14:10 +02:00
Mark de Wever 8ff2d6af69 [libc++] Reduces the number of transitive includes.
This defines a new policy for removal of transitive includes.
The goal of the policy it to make it relatively easy to remove
headers when needed, but avoid breaking developers using and
vendors shipping libc++.

The method used is to guard transitive includes based on the
C++ language version. For the upcoming C++23 we can remove
headers when we want, but for other language versions we try
to keep it to a minimum.

In this code the transitive include of `<chrono>` is removed
since D128577 introduces a header cycle between `<format>`
and `<chrono>`. This cycle is indirectly required by the
Standard. Our cycle dependency tool basically is a grep based
tool, so it needs some hints to ignore cycles. With the input
of our transitive include tests we can create a better tool.
However that's out of the scope of this patch.

Note the flag `_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` remains
unchanged. So users can still opt-out of transitives includes
entirely.

Reviewed By: #libc, ldionne, philnik

Differential Revision: https://reviews.llvm.org/D132284
2022-08-31 19:50:03 +02:00
Mark de Wever f92c733cc2 [libc++][format] Fixes floating-point formatting.
Formatting the alternate form for the general categories should keep the
trailing zeros. This was reported by @fsb4000 in D131336.

The default format uses general formatting but this should not keep the
trailing zeros so the default format is not passed to the formatter.

While testing I found an off by one error; finding the exponent character
`e` in 1e+03 will start at after the `1` so a size of `4` can contain an
exponent.

Reviewed By: fsb4000, ldionne, #libc

Differential Revision: https://reviews.llvm.org/D131417
2022-08-31 19:25:53 +02:00
Mark de Wever a595fcf9b4 [NFC][libc++][format] Renames __char_type concept.
Move the concept to the concepts header and uses a name in the style of
P2286.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D131176
2022-08-31 19:21:01 +02:00
Mark de Wever 36e0e2c485 [libc++][format] Allows width arg-id with value 0.
Implements:
- LWG3721 Allow an arg-id with a value of zero for width in std-format-spec

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D130649
2022-08-31 19:19:13 +02:00
Mark de Wever 87dd8c7289 [libc++][CI] increases constexpr evaluation limit.
This was discovered as an issue in D131317.

Depends on D131835

Reviewed By: #libc, var-const, ldionne, philnik

Differential Revision: https://reviews.llvm.org/D131836
2022-08-31 19:16:40 +02:00
Mark de Wever 722ee9049d [libc++] Tests transitive includes for all C++03.
A followup of D132534 with C++03 enabled after fixing the experimental
PMR issues.

Depends on D132582

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D132584
2022-08-31 19:16:01 +02:00
Mark de Wever 982287a29b [libc++][experimental] Disables PMR in C++03.
While working on D132534 it appeared the experimental PMR code doesn't
have version guards and fails to compile on C++03. This adds the guards
for that version. It seems the tests already were only disabled for
C++03.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D132582
2022-08-31 19:15:36 +02:00
Mark de Wever 308a5b1a32 [libc++] Inlines format_error for clang-cl DLL.
This version is build without support for the experimental library but
the code still wants to link this function. Inlining the function solves
the issue.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D132667
2022-08-31 19:13:19 +02:00
Muiez Ahmed e1e9961f76 [SystemZ][z/OS] Account for renamed parameter name (libc++)
The following patch (https://reviews.llvm.org/D129051) broke z/OS builds by renaming the parameter name. This patch accounts for that change.

Differential Revision: https://reviews.llvm.org/D132946
2022-08-30 14:18:44 -04:00
Mark de Wever a72f6b032c [libc++] Improves feature-test macro diagnostics.
This was mentioned in review D131326.

Reviewed By: var-const, #libc, philnik

Differential Revision: https://reviews.llvm.org/D132293
2022-08-30 17:56:35 +02:00
Matheus Izvekov 3012a0c373
[libcxx] CI: set symbolizer for bootstrapping build
Setting the symbolizer is required for getting a pretty
stack trace when Clang crashes.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D132807
2022-08-30 15:00:41 +02:00
Martin Storsjö 8e29e379b0 [libcxx] [test] Remove an unnecessary condition in a feature check
We don't need to check for `_LIBCPP_HAS_NO_LOCALIZATION` here;
this was copied over by mistake from the test above (which does
use locale.h).

Differential Revision: https://reviews.llvm.org/D132834
2022-08-30 10:06:52 +03:00
Mark de Wever a6ce0d087a [NFC][libc++][format] Use ranges in the output.
This should avoid some copies of the output iterator.

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D132812
2022-08-29 18:13:30 +02:00
Nikolas Klauser 640e2bae50 [libc++] Mark everything in <deque> as _LIBCPP_HIDE_FROM_ABI and replace _LIBCPP_INLINE_VISIBILITY
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132320
2022-08-27 22:01:00 +02:00
Mark de Wever ca04b49597 [libc++][CI] Increases the Clang version used.
Changes the CI to use the Clang 16 nightly builds instead of Clang 14.
(The libc++15 branch was accidentally build using Clang 14 instead of
Clang 15; hence the skipping of a number.)

Also adds a Clang 15 build to the test matrix.

Based on the private discussion with @ldionne we decided to move
the configuration parameters from the `run-buildbot` script to the
CI configuration `buildkite-pipeline.yml`. Other hard-coded values
from the Dockerfile should be move to the CI configuration too. That
will be done in another commit.

C++17 will use Clang-15 since D131479 causes a test to fail.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D131174
2022-08-27 13:42:38 +02:00
Nikolas Klauser a13822b35d [libc++] Simplify type_traits a bit more
Reviewed By: ldionne, #libc

Spies: STL_MSFT, CaseyCarter, huixie90, libcxx-commits

Differential Revision: https://reviews.llvm.org/D129094
2022-08-27 10:19:11 +02:00
Nikolas Klauser 59d246e55f [libc++] Remove __deque_base
This patch simplifies the implementation of `deque` by removing the `__deque_base` class which results in a lot less indirections and removes the need for `__base::`.

Reviewed By: ldionne, #libc

Spies: AdvenamTacet, libcxx-commits

Differential Revision: https://reviews.llvm.org/D132081
2022-08-26 21:59:33 +02:00
Nikolas Klauser 786366b18f [libc++][NFC] Remove some of the code duplication in the string tests
Reviewed By: ldionne, #libc, huixie90

Spies: huixie90, libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D131856
2022-08-26 21:57:42 +02:00
Nikolas Klauser 98f6a56f5e [libc++] Enable hash only for the correct types
Also implement LWG3705.
Fixes https://github.com/llvm/llvm-project/issues/55823

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132338
2022-08-26 17:40:23 +02:00
Nikolas Klauser 56e1f0f056 [libc++][NFC] Remove reserved names from support/constexpr_char_traits.h
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132341
2022-08-26 17:37:47 +02:00
Joe Loser eb1ceb17ae [libc++][test] Use TEST_HAS_NO_CHAR8_T to simplify #ifdefs. NFCI.
Many tests in `libcxx/test/std/strings` use
`#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L`
which can be replaced with the more terse `#ifndef TEST_HAS_NO_CHAR8_T`.

Differential Revision: https://reviews.llvm.org/D132626
2022-08-25 21:09:10 -06:00
Louis Dionne f2d957f036 [libc++] Allow specifying conditional compile flags dependent on basic Lit features
This patch adds support for passing basic Lit features to the
ADDITIONAL_COMPILE_FLAGS keyword by enclosing them in parentheses.
This is done to support https://llvm.org/D131836.

In the future, we should instead add proper support for conditional
keywords in Lit, so that we can evaluate arbitrary Lit boolean
expressions such as `ADDITIONAL_COMPILE_FLAGS(x && !y): -flag`.

Note that I can see this being exceptionally useful when combined
with RUN commands, which would allow using different commands on
different systems. For example:

     RUN(!buildhost=windows): something
     RUN(buildhost=windows): something-else

Differential Revision: https://reviews.llvm.org/D132575
2022-08-25 17:33:44 -04:00
Nikolas Klauser 6ffd39731a [libc++][NFC] Remove tab in filebuf/traits_mismatch.fail.cpp 2022-08-25 22:46:17 +02:00
Nikolas Klauser 36aea61587 [libc++][NFC] Remove mentions of warn_unused_result
We don't use `clang::warn_unused_result` anymore, so let's remove the mentions of it from the tests

Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132339
2022-08-25 22:27:50 +02:00
Nikolas Klauser b978dfbf74 [libc++] Consolidate the different [[nodiscard]] configuration options into a single one
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D129054
2022-08-25 22:01:34 +02:00
Nikolas Klauser 4262b523ff [libc++][NFC] Enable modernize-use-override
Reviewed By: Mordante, #libc

Spies: aheejin, libcxx-commits, smeenai

Differential Revision: https://reviews.llvm.org/D124714
2022-08-25 20:55:08 +02:00
Louis Dionne b50f02490e [libc++] Fix .compile.fail.cpp tests that should have been marked as UNSUPPORTED in C++03/11
Differential Revision: https://reviews.llvm.org/D132595
2022-08-25 09:00:43 -04:00
Mark de Wever 3d68a67fe6 [libc++] Tests transitive includes for all C++ versions.
D132284 has an approach to reduce the number of transitive includes
based on the language version used. This requires to be able to validate
changes in transitive includes in all language versions.

Due to issues in the experimental library c++03 will be done separately.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D132534
2022-08-24 19:23:23 +02:00
Louis Dionne 690a4692d1 [runtimes] Don't link against compiler-rt when we don't find it
Otherwise, we would end up passing `-lNOTFOUND` to the compiler, which
caused various compiler checks to fail and ended up breaking the build
in the most obscure ways. For example, checks for -faligned-allocation
would fail because the compiler would complain about an unknown library
called NOTFOUND, and we would end up not passing -faligned-allocation
anywhere in our build. This is madness.

An even better alternative would be to simply FATAL_ERROR if we don't
find the builtins library. However, it seems like our build has been
working fine without finding it for a while, so instead of making a
bunch of builds fail, we can figure out why linking against compiler-rt
doesn't actually seem to be required in a follow-up, and perhaps
relax that.
2022-08-24 10:33:10 -04:00
Louis Dionne 355e0ce3c5 [libc++] Extend check for non-ASCII characters to src/, test/ and benchmarks/
Differential Revision: https://reviews.llvm.org/D132180
2022-08-23 18:36:38 -04:00
Louis Dionne 89469df8ba [libc++] Remove trailing whitespace from libcxx includes, source, tests and benchmarks
Differential Revision: https://reviews.llvm.org/D132175
2022-08-23 18:25:54 -04:00
Louis Dionne fb8351d43b [libc++] Update oss-fuzz.sh to use LLVM_ENABLE_RUNTIMES 2022-08-23 10:06:25 -04:00
Louis Dionne 342e0ebd0b Revert the removal of LLVM_ENABLE_PROJECTS for libc++ and libc++abi
This commit reverts the following commits:

- 952f90b72b
- e6a0800532 (D132298)
- 176db3b3ab (D132324)

These commits caused CI instability and need to be reverted in order
to figure things out again. See the discussion in https://llvm.org/D132324
for more information.
2022-08-23 09:58:30 -04:00
Christopher Di Bella e137fb6fb8 [clang][libcxx] renames `__remove_reference`
libc++ prior to LLVM 15 has a bug in it due to it excluding
`remove_reference_t` when `__remove_reference` is available as a
compiler built-in. This went unnoticed until D116203 because it wasn't
available in any compiler.

To work around this, we're renaming `__remove_reference` to
`__remove_reference_t`.

TEST=Tested locally, tested using emscripten
2022-08-22 23:15:10 +00:00
Christopher Di Bella 0e7971154e [libcxx][NFC] utilises compiler builtins for unary transform type-traits
Depends on D116203

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D131732
2022-08-22 03:03:32 +00:00
Mark de Wever d49a82fafe [NFC][libc++][doc] Improves rst formatting. 2022-08-21 17:16:14 +02:00
Joe Loser 6ebc2a189d
[libc++] Fix typos in deprecation messages for experimental searchers
Fix the typo in the deprecated messages for these searchers:
`s/exprerimental/experimental`.

Differential Revision: https://reviews.llvm.org/D132317
2022-08-21 07:55:14 -06:00
John Ericson 176db3b3ab [RFC] Remove support for building C++ with `LLVM_ENABLE_PROJECTS`
This has been officially deprecated since D112724, meaning the
deprecation warning is present in released 14 and 15.

This makes me think that now, shortly after the 15 release is branched,
is a good time to pull the trigger.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D132324
2022-08-21 08:10:56 -04:00
Mark de Wever 00da9e9a07 [libc++][string] Removes obsolete constexpr.
Addresses the final review comment of D131421.

Reviewed By: philnik, #libc

Differential Revision: https://reviews.llvm.org/D131857
2022-08-20 20:42:46 +02:00
Mark de Wever 2ede992c01 [libc++][doc] Updates status of P2291R3.
Work on the paper has started but it's blocked by PR52954.
Updating the status to avoid duplicated effort implementing this paper.
2022-08-20 14:45:17 +02:00
Adrian Vogelsgesang ae071a59bc [libc++][NFC][spaceship] Update status doc 2022-08-19 17:32:05 -07:00
Martin Storsjö 8a002ab99e [libcxx] [test] Fix the transitive_includes test on Windows
Look for both kinds of slashes in include paths output from the
compiler.

Use "diff -w" to do a whitespace insensitive comparison, to ignore
differences in line endings (the python script writes to stdout
in text mode, with crlf newlines).

Differential Revision: https://reviews.llvm.org/D129428
2022-08-19 23:12:54 +03:00
Nikolas Klauser 5146b57b40 [libc++][NFC] Rename the constexpr macros
This was discussed on Discord with the consensus that we should rename the macros.

Reviewed By: ldionne, Mordante, var-const, avogelsgesang, jloser, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D131498
2022-08-19 15:35:02 +02:00
Martin Storsjö 8437c8ff42 [libcxx] [test] Mark the libcxx/selftest/remote-substitutions.sh.cpp test as requiring bash in the executor
It's unclear to me why this wasn't tagged this way already in
87fe0709d4 / D114612 where the
feature flag executor-has-no-bash was added, as this test did exist
in its current form already at that time.

Differential Revision: https://reviews.llvm.org/D131446
2022-08-19 11:42:56 +03:00
Martin Storsjö 81e55ff473 [libcxx] [test] Make some threading tests more robust
Increase the timeout tolerance if TEST_IS_EXECUTED_IN_A_SLOW_ENVIRONMENT
is set, similarly to how it's done in a couple other tests.

Use `std::this_thread::yield();` instead of busylooping. When multiple
threads are busylooping, it's plausible that not all threads even get
started running before the timeout runs out.

This makes the threading tests succeed if run in Windows runners on
Github Actions.

Differential Revision: https://reviews.llvm.org/D131483
2022-08-19 11:42:35 +03:00
Martin Storsjö 63d88ed5bf [libcxx] [test] Split the TEST_HAS_SANITIZERS define into TEST_IS_EXECUTED_IN_A_SLOW_ENVIRONMENT
This makes its role clearer. It's plausible that one may want to manually
define TEST_IS_EXECUTED_IN_A_SLOW_ENVIRONMENT when running the tests in
some environments - in particular, it seems to be necessary to use the
higher tolerance timeouts if running the tests on Windows runners
on Github Actions.

Also add the descriptive comment in one file where it was missing.

Differential Revision: https://reviews.llvm.org/D131484
2022-08-19 11:41:43 +03:00
Martin Storsjö e78223e79e [libcxx] [test] Remove --env PATH from the static clangcl config
The PATH is set in order to be able to find the tested DLL at runtime.
When linking statically, it's not necessary to set the PATH.

Setting PATH in the executor has the downside that it clears the
existing path (it's not prepended/appended to it), which means
that the executed tools can't find other tools - which sets the
executor-has-no-bash flag.

By removing the unnecessary setting of PATH, we have a properly
working bash even when wrapped by the executor, which gets rid
of the executor-has-no-bash flag in this test configuration, which
makes 9 more testcases be executed.

Differential Revision: https://reviews.llvm.org/D131481
2022-08-19 11:40:58 +03:00
John Ericson e941b031d3 Revert "[cmake] Use `CMAKE_INSTALL_LIBDIR` too"
This reverts commit f7a33090a9.

Unfortunately this causes a number of failures that didn't show up in my
local build.
2022-08-18 22:46:32 -04:00
Adrian Vogelsgesang f1974f039f [libc++] Implement `operator<=>` for `filesystem::directory_entry`
Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D130860
2022-08-18 14:46:13 -07:00
Adrian Vogelsgesang b3ab3bece0 [libc++] Implement `operator<=>` for `filesystem::path`
Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D130859
2022-08-18 14:13:48 -07:00
Louis Dionne b8cb1dc9ea [libc++] Make <ranges> non-experimental
When we ship LLVM 16, <ranges> won't be considered experimental anymore.
We might as well do this sooner rather than later.

Differential Revision: https://reviews.llvm.org/D132151
2022-08-18 16:59:58 -04:00
Nikolas Klauser 8fc23c9b45 [libc++] Mark everything inside vector as _LIBCPP_HIDE_FROM_ABI
Reviewed By: ldionne, huixie90, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132016
2022-08-18 22:41:27 +02:00
John Ericson f7a33090a9 [cmake] Use `CMAKE_INSTALL_LIBDIR` too
We held off on this before as `LLVM_LIBDIR_SUFFIX` conflicted with it.
Now we return this.

`LLVM_LIBDIR_SUFFIX` is kept as a deprecated way to set
`CMAKE_INSTALL_LIBDIR`. The other `*_LIBDIR_SUFFIX` are just removed
entirely.

I imagine this is too potentially-breaking to make LLVM 15. That's fine.
I have a more minimal version of this in the disto (NixOS) patches for
LLVM 15 (like previous versions). This more expansive version I will
test harder after the release is cut.

Reviewed By: sebastian-ne, ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D130586
2022-08-18 15:33:35 -04:00
Nikolas Klauser 1db43b7ba9 [libc++] Replace _LIBCPP_INLINE_VISIBILITY and mark all functions _LIBCPP_HIDE_FROM_ABI in __split_buffer
Reviewed By: ldionne, huixie90, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132028
2022-08-18 19:50:57 +02:00
Mark de Wever 750ee8d56d [NFC][libc++] Fixes a typo.
Discovered by phosek in D126971.
2022-08-18 17:27:43 +02:00
Nikolas Klauser dea4386749 [libc++][NFC] Add a short description for __split_buffer
Reviewed By: Mordante, huixie90, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132032
2022-08-18 16:16:20 +02:00
Paul Kirth 56a34451e1 [libcxx] Fix using the vcruntime ABI with _HAS_EXCEPTIONS=0 defined
_HAS_EXCEPTIONS=0 allows disabling the exception parts of the MS STL
and vcruntime, and e.g. compiler-rt/lib/fuzzer sets this define (to
work around issues with MS STL). If using libc++ instead of MS STL,
this define previously broke the libc++ headers.

If _HAS_EXCEPTIONS is set to 0, the vcruntime_exception.h header
doesn't define the ABI base class std::exception. If no exceptions
are going to be thrown, this probably is fine (although it also
breaks using subclasses of it as regular objects that aren't thrown),
but it requires ifdeffing out all subclasses of all exception/error
derived objects (which are sprinkled throughout the headers).

Instead, libc++ will supply an ABI compatible definition when
_HAS_EXCEPTIONS is set to 0, which will make the class hierarchies
complete.

In this build configuration, one can still create instances of
exception subclasses, and those objects will be ABI incompatible
with the ones from when _HAS_EXCEPTIONS isn't defined to 0 - but
one may argue that's a pathological/self-imposed problem in that case.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D103947
2022-08-17 21:14:25 +00:00
Kent Ross 081dad9e9e [libcxx][spaceship][doc] Repair links and clean up spaceship progress doc
Previously the specification was in a table in paragraph 14 of [container.requirements.general] but it has since been given its own sub section header, 24.2.2.4 [container.opt.reqmts].

This happened in 93ff092d1c

This update also includes misc. other cleanups of the spaceship projects sheet.

Reviewed By: Mordante, avogelsgesang, #libc

Differential Revision: https://reviews.llvm.org/D131928
2022-08-17 12:14:32 -07:00
Louis Dionne 8cedff10a1 [libc++] Diagnose when header search paths are set up incorrectly
An issue I often see in codebases compiled for unusual platforms is
that header search paths are specified manually and are subtly wrong.
For example, people will manually add `-isystem <some-toolchain>/usr/include`,
which ends up messing up the layering of header search paths required by
libc++ (because the C Standard Library now appears *before* libc++ in
the search paths). Without this patch, this will end up causing
compilation errors that are pretty inscrutable. This patch aims to
improve the user experience by diagnosing this issue explicitly.

In all cases I can think of, I would expect that a compilation error
occur if these header search paths are not layered properly. This
should only provide an explicit diagnostic instead of failing due
to seemingly unrelated compilation errors.

Differential Revision: https://reviews.llvm.org/D131441
2022-08-17 14:05:26 -04:00
Dominic Chen 5a42e2bc28 Revert "[libcxx] Resolve warnings for Wshift-sign-overflow"
This reverts commit 774c39313e.
2022-08-17 10:37:24 -07:00
Dominic Chen 774c39313e [libcxx] Resolve warnings for Wshift-sign-overflow
These warning were identified while debugging modules with Wsystem-headers.

Differential Revision: https://reviews.llvm.org/D131999
2022-08-17 10:31:25 -07:00
Mark de Wever da6ff3aecb [libc++][format] Uglyfies format buffer.
While working on D129964 I noticed some code hadn't been uglyfied, this
rectifies the issue.

Depends on D129964

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D131834
2022-08-17 17:50:24 +02:00
Mark de Wever 4761a74fd8 [libc++][CI] Updates and improves the Docker image.
Since we branched LLVM install Clang 16 and remove Clang 12.

Currently our Docker installs 4 versions of Clang so our CI can use the
same image for both the main and the release branch. This wasn't done for
the other Clang tools so they always use the same version for testing
the main and the release branch. Instead install 2 versions for the
tools.

However it seems the default for Clang and its tools were the latest
released version instead of the ToT. To lessen the risk of breaking the
release CI, version 14 is installed hard-coded as a temporary solution.

Updating the main branch to use the Clang 16 compiler will be done in a
separate patch.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D131324
2022-08-17 17:48:06 +02:00
Mark de Wever 130b1816c5 [libc++] Improve updating data files.
This changes makes it easier to update the Unicode data files used for
the Extended Graphme Clustering as added in D126971.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D129668
2022-08-16 18:55:46 +02:00
Mark de Wever f7c0df002a [libc++][format] Improve format buffer.
Allow bulk output operations on the buffer instead of adding one
code unit at a time. This has a huge performance benefit at the cost of
larger binary. This doesn't implement @vitaut's earlier suggestion to
avoid buffering for std::string when writing a strings. That can be done
in a follow-up patch.

There are some minor complications for the non-buffered format_to_n.
When writing one character at a time it's easy to detect when reaching
the limit n. This is solved by adding a small overhead for format_to_n.
When the next write would overflow it stores the data in the internal
buffer and copies that up-to n code units. The overhead isn't measured,
but it's expected to only be an issue for small values of n; for larger
values the general improvements will outweight the new overhead.

```
   text	   data	    bss	    dec	    hex	filename
 349081	   6096	    440	 355617	  56d21	format.libcxx.out-baseline
 344442	   6088	    440	 350970	  55afa	formatted_size.libcxx.out-baseline
4567980	  57272	    424	4625676	 46950c	formatter_float.libcxx.out-baseline
 718800	  12472	    488	 731760	  b2a70	formatter_int.libcxx.out-baseline
 376341	   6096	    552	 382989	  5d80d	format_to.libcxx.out-beaseline

 370169	   6096	    440	 376705	  5bf81	format.libcxx.out
 365530	   6088	    440	 372058	  5ad5a	formatted_size.libcxx.out
4575116	  57272	    424	4632812	 46b0ec	formatter_float.libcxx.out
 725936	  12472	    488	 738896	  b4650	formatter_int.libcxx.out
 397429	   6096	    552	 404077	  62a6d	format_to.libcxx.out
```

For very small strings the new method is slower, from 4 characters
there's already a small gain.

```
Comparing ./format.libcxx.out-baseline to ./format.libcxx.out
Benchmark                                           Time             CPU      Time Old      Time New       CPU Old       CPU New
--------------------------------------------------------------------------------------------------------------------------------
BM_format_string<char>/1                         +0.0268         +0.0268            43            44            43            44
BM_format_string<char>/2                         +0.0133         +0.0133            22            22            22            22
BM_format_string<char>/4                         -0.0248         -0.0248            12            11            12            11
BM_format_string<char>/8                         -0.0831         -0.0831             6             6             6             6
BM_format_string<char>/16                        -0.2976         -0.2976             4             3             4             3
BM_format_string<char>/32                        -0.4369         -0.4369             3             2             3             2
BM_format_string<char>/64                        -0.6375         -0.6375             3             1             3             1
BM_format_string<char>/128                       -0.7685         -0.7685             2             1             2             1

```

The int benchmark has benefits for the simple formatting, but shines for
the complex formatting:
```
Comparing ./formatter_int.libcxx.out-baseline to ./formatter_int.libcxx.out
Benchmark                                                               Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------------
BM_Basic<uint32_t>                                                   -0.2307         -0.2307            60            46            60            46
BM_Basic<int32_t>                                                    -0.1985         -0.1985            61            49            61            49
BM_Basic<uint64_t>                                                   -0.3478         -0.3479            81            53            81            53
BM_Basic<int64_t>                                                    -0.3475         -0.3475            81            53            81            53
BM_BasicLow<__uint128_t>                                             -0.3388         -0.3388            86            57            86            57
BM_BasicLow<__int128_t>                                              -0.3431         -0.3431            86            57            86            57
BM_Basic<__uint128_t>                                                -0.2822         -0.2822           236           170           236           170
BM_Basic<__int128_t>                                                 -0.3107         -0.3107           219           151           219           151
Integral_LocFalse_BaseBin_AlignNone_Int64                            -0.5781         -0.5781           178            75           178            75
Integral_LocFalse_BaseBin_AlignmentLeft_Int64                        -0.9231         -0.9231          1156            89          1156            89
Integral_LocFalse_BaseBin_AlignmentCenter_Int64                      -0.9179         -0.9179          1107            91          1107            91
Integral_LocFalse_BaseBin_AlignmentRight_Int64                       -0.9238         -0.9238          1147            87          1147            87
Integral_LocFalse_BaseBin_ZeroPadding_Int64                          -0.9170         -0.9170          1137            94          1137            94
Integral_LocFalse_BaseBin_AlignNone_Uint64                           -0.5923         -0.5923           175            71           175            71
Integral_LocFalse_BaseBin_AlignmentLeft_Uint64                       -0.9251         -0.9251          1154            86          1154            86
Integral_LocFalse_BaseBin_AlignmentCenter_Uint64                     -0.9204         -0.9204          1105            88          1105            88
Integral_LocFalse_BaseBin_AlignmentRight_Uint64                      -0.9242         -0.9242          1125            85          1125            85
Integral_LocFalse_BaseBin_ZeroPadding_Uint64                         -0.9232         -0.9232          1139            88          1139            88
Integral_LocFalse_BaseOct_AlignNone_Int64                            -0.3241         -0.3241           100            67           100            67
Integral_LocFalse_BaseOct_AlignmentLeft_Int64                        -0.9322         -0.9322          1166            79          1166            79
Integral_LocFalse_BaseOct_AlignmentCenter_Int64                      -0.9251         -0.9251          1108            83          1108            83
Integral_LocFalse_BaseOct_AlignmentRight_Int64                       -0.9303         -0.9303          1136            79          1136            79
Integral_LocFalse_BaseOct_ZeroPadding_Int64                          -0.9264         -0.9264          1156            85          1156            85
Integral_LocFalse_BaseOct_AlignNone_Uint64                           -0.3116         -0.3116            96            66            96            66
Integral_LocFalse_BaseOct_AlignmentLeft_Uint64                       -0.9310         -0.9310          1168            81          1168            81
Integral_LocFalse_BaseOct_AlignmentCenter_Uint64                     -0.9281         -0.9281          1128            81          1128            81
Integral_LocFalse_BaseOct_AlignmentRight_Uint64                      -0.9299         -0.9299          1148            80          1148            80
Integral_LocFalse_BaseOct_ZeroPadding_Uint64                         -0.9288         -0.9288          1153            82          1153            82
Integral_LocFalse_BaseDec_AlignNone_Int64                            -0.3342         -0.3342            95            63            95            63
Integral_LocFalse_BaseDec_AlignmentLeft_Int64                        -0.9360         -0.9360          1157            74          1157            74
Integral_LocFalse_BaseDec_AlignmentCenter_Int64                      -0.9303         -0.9303          1128            79          1128            79
Integral_LocFalse_BaseDec_AlignmentRight_Int64                       -0.9369         -0.9369          1164            73          1164            73
Integral_LocFalse_BaseDec_ZeroPadding_Int64                          -0.9323         -0.9323          1157            78          1157            78
Integral_LocFalse_BaseDec_AlignNone_Uint64                           -0.3198         -0.3198            93            63            93            63
Integral_LocFalse_BaseDec_AlignmentLeft_Uint64                       -0.9351         -0.9351          1158            75          1158            75
Integral_LocFalse_BaseDec_AlignmentCenter_Uint64                     -0.9298         -0.9298          1128            79          1128            79
Integral_LocFalse_BaseDec_AlignmentRight_Uint64                      -0.9361         -0.9361          1157            74          1157            74
Integral_LocFalse_BaseDec_ZeroPadding_Uint64                         -0.9333         -0.9333          1151            77          1151            77
Integral_LocFalse_BaseHex_AlignNone_Int64                            -0.3020         -0.3020            89            62            89            62
Integral_LocFalse_BaseHex_AlignmentLeft_Int64                        -0.9357         -0.9357          1174            75          1174            75
Integral_LocFalse_BaseHex_AlignmentCenter_Int64                      -0.9319         -0.9319          1129            77          1129            77
Integral_LocFalse_BaseHex_AlignmentRight_Int64                       -0.9350         -0.9350          1161            75          1161            75
Integral_LocFalse_BaseHex_ZeroPadding_Int64                          -0.9293         -0.9293          1150            81          1150            81
Integral_LocFalse_BaseHex_AlignNone_Uint64                           -0.3056         -0.3057            86            59            86            59
Integral_LocFalse_BaseHex_AlignmentLeft_Uint64                       -0.9378         -0.9378          1174            73          1174            73
Integral_LocFalse_BaseHex_AlignmentCenter_Uint64                     -0.9341         -0.9341          1129            74          1130            74
Integral_LocFalse_BaseHex_AlignmentRight_Uint64                      -0.9361         -0.9361          1157            74          1157            74
Integral_LocFalse_BaseHex_ZeroPadding_Uint64                         -0.9315         -0.9315          1147            79          1147            79
Integral_LocFalse_BaseHexUpper_AlignNone_Int64                       -0.0019         -0.0019            91            90            91            90
Integral_LocFalse_BaseHexUpper_AlignmentLeft_Int64                   -0.9099         -0.9099          1162           105          1162           105
Integral_LocFalse_BaseHexUpper_AlignmentCenter_Int64                 -0.9041         -0.9041          1121           108          1121           108
Integral_LocFalse_BaseHexUpper_AlignmentRight_Int64                  -0.9086         -0.9086          1162           106          1162           106
Integral_LocFalse_BaseHexUpper_ZeroPadding_Int64                     -0.9057         -0.9057          1164           110          1164           110
Integral_LocFalse_BaseHexUpper_AlignNone_Uint64                      +0.0110         +0.0110            86            87            86            87
Integral_LocFalse_BaseHexUpper_AlignmentLeft_Uint64                  -0.9136         -0.9136          1161           100          1161           100
Integral_LocFalse_BaseHexUpper_AlignmentCenter_Uint64                -0.9078         -0.9078          1133           104          1133           104
Integral_LocFalse_BaseHexUpper_AlignmentRight_Uint64                 -0.9132         -0.9132          1177           102          1177           102
Integral_LocFalse_BaseHexUpper_ZeroPadding_Uint64                    -0.9091         -0.9091          1160           105          1160           105
```
Other benchmarks give similar results.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D129964
2022-08-16 18:54:10 +02:00
Vitaly Buka 69c09d11f8 [test][libcxx] Don't XFAIL passing test with HWASAN 2022-08-16 09:37:16 -07:00
Vitaly Buka e6933044a7 [test][libcxx] Use own feature for HWAsan 2022-08-16 00:05:48 -07:00
Vitaly Buka 06d16eb9e6 [test][libcxx] Disable new.delete.array tests for HWAsan 2022-08-16 00:05:48 -07:00
David Blaikie c63f2581f4 Enable -Wctad-maybe-unsupported in LLVM build
Warns on potentially unintended use of C++17 Class Template Argument
Deduction. Use of this feature with types that aren't intended to
support it may may future refactorings of those types more difficult -
so this warning fires whenever the feature is used with a type that may
not have intended to be used with CTAD (the warning uses the existence
of at least one explicit deduction guide to indicate that a type
intentionally supports CTAD - absent that, it's assumed to not be
intended to support CTAD & produces a warning).

This is disabled in libcxx because lots of the standard library is
assumed to provide ctad-usable APIs and the false positive suppression
in the diagnostic is based on system header classification which doesn't
apply in the libcxx build itself.

Differential Revision: https://reviews.llvm.org/D131727
2022-08-15 23:28:51 +00:00
Adrian Vogelsgesang 877620bd96 [libc++] Implement `operator<=>` for `error_{code,condition}`
Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D131371
2022-08-15 16:05:53 -07:00
Adrian Vogelsgesang 0e876eda26 [libc++] Implement `operator<=>` for `error_category`
Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D131363
2022-08-15 16:05:08 -07:00
Vitaly Buka ace3ce8ad7 [test][libc++][hwasan] Handle hwaddress_sanitizer 2022-08-15 13:50:54 -07:00
Igor Zhukov f7f5308b82 [libc++][test] Fix conversion signed/unsigned in test/support/MoveOnly.h
Reviewed By: jloser, philnik

Differential Revision: https://reviews.llvm.org/D131889
2022-08-15 22:09:54 +07:00
Kent Ross c4566cac49 [libc++][spaceship] Implement std::variant::operator<=>
Implements [variant.relops] and [variant.monostate.relops] for P1614R2

Reviewed By: Mordante, #libc, avogelsgesang

Differential Revision: https://reviews.llvm.org/D131372
2022-08-14 16:16:52 -07:00
Nico Weber aacf1a9742 Revert "[clang] adds unary type transformations as compiler built-ins"
This reverts commit bc60cf2368.
Doesn't build on Windows and breaks gcc 9 build, see
https://reviews.llvm.org/D116203#3722094 and
https://reviews.llvm.org/D116203#3722128

Also revert two follow-ups. One fixed a warning added in
bc60cf2368, the other
makes use of the feature added in bc60cf2368
in libc++:

Revert "[libcxx][NFC] utilises compiler builtins for unary transform type-traits"
This reverts commit 06a1d917ef.

Revert "[Sema] Fix a warning"
This reverts commit c85abbe879.
2022-08-14 15:58:21 -04:00
Christopher Di Bella 06a1d917ef [libcxx][NFC] utilises compiler builtins for unary transform type-traits
Depends on D116203

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D131732
2022-08-14 17:32:38 +00:00
Igor Zhukov 0c90d5f7e9 [libc++][test] fix C4267 warning in bitset.members\to_ulong.pass.cpp
Reviewed By: philnik

Differential Revision: https://reviews.llvm.org/D131854
2022-08-14 22:24:58 +07:00
Mark de Wever 22b5adff71 [libc++] Uses operator<=> in string.
Implements part of:
- P1614R2 The Mothership has Landed

Reviewed By: avogelsgesang, #libc, philnik

Differential Revision: https://reviews.llvm.org/D131421
2022-08-14 14:05:05 +02:00
Mark de Wever 3ec6900298 [libc++][test] Disables clang-tidy test for GCC.
Increasing the constexpr evaluation limit breaks this clang-tidy test
for GCC. As discussed in D131317 disable the test in GCC.

Reviewed By: philnik, #libc

Differential Revision: https://reviews.llvm.org/D131835
2022-08-14 13:39:12 +02:00
Nikolas Klauser f02120fba2 [libc++] Implement P2417R2 (A more constexpr bitset)
Reviewed By: ldionne, #libc

Spies: jloser, arichardson, libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D131218
2022-08-14 10:34:01 +02:00
Nikolas Klauser 7ae66e5e95 [libc++] Granularize the rest of type_traits
Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D130471
2022-08-14 10:30:48 +02:00
Adrian Vogelsgesang 41e7665c4b [libc++] Implement `operator<=>` for `thread::id`
The new operator<=> is mapped onto the existing functions
__libcpp_thread_id_equal and __libcpp_thread_id_less. Introducing a
new __libcpp_thread_id_compare_three_way might lead to more efficient
code. Given that we can still introduce __libcpp_thread_id_compare_three_way
later, for this commit I opted to not break ABI. If requested, I will
add __libcpp_thread_id_compare_three_way in a follow-up commit.

Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D131362
2022-08-13 17:30:55 -07:00
Nikolas Klauser 80c7e93a2a [libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI
Reviewed By: ldionne, Mordante, var-const, huixie90, #libc

Spies: jloser, libcxx-commits, arichardson, miyuki

Differential Revision: https://reviews.llvm.org/D129968
2022-08-13 22:41:22 +02:00
Nikolas Klauser ae87a3bf0a [libc++] Simplify __config a bit more and add underscores to attributes
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D129457
2022-08-13 12:43:26 +02:00
Vitaly Buka 18014fe0a9 [libcxx][hwasan] Add basic HWAddress support 2022-08-13 00:04:55 -07:00
Adrian Vogelsgesang d7e0cec60e [libc++][test] Mark `test_comparisons.h` helpers as nodiscard
I accidentally wrote `testComparisons(...)` instead of
`assert(testComparisons(...))`. This compiled without issues, but
did not provide the intended test coverage. By adding a `nodiscard`,
we can make sure that the compiler catches such mistakes for us.

Differential Revision: https://reviews.llvm.org/D131364
2022-08-12 03:30:33 -07:00
Amy Kwan e2e9e2ce8e [libcxx] [test] Fix max_size.pass.cpp for PowerPC targets
This patch fixes the max_size.pass.cpp test for PowerPC targets, depending on
endianness.

We will exhibit the full_size() behaviour for little endian
(where __endian_factor = 2 ), and the half_size() behaviour for
big endian (where __endian_factor = 1).

Differential Revision: https://reviews.llvm.org/D131682
2022-08-11 21:39:29 -05:00
Louis Dionne 8c6319e30a [libc++] Add a missing assertion in std::span's constructor
Also, add missing tests for assertions in span constructors. Now I
believe that all of std::span's API should be hardened, and all the
assertions should have a corresponding test.

Differential Revision: https://reviews.llvm.org/D131681
2022-08-11 15:31:46 -04:00
Nikolas Klauser 499fca3cfc [libc++][NFC] Replace macros in vector
Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D130848
2022-08-11 20:22:58 +02:00
Martin Storsjö b8717d19cf [libcxx] [test] Merge the experimental-lib-exports testcases into static-lib-exports
Since bb939931a1, the c++experimental
library is always built, so these tested files should always be built
(even if they aren't used in tests).

Differential Revision: https://reviews.llvm.org/D129399
2022-08-11 10:15:12 +03:00
Louis Dionne 497705ff27 [libc++] Reorganize the documentation of extensions for integral types 2022-08-10 17:35:08 -04:00
Adrian Vogelsgesang 2d34cb74b5 [libc++] Implement `thread::id` comparators as free functions
So far, the `thread::id` comparators were implemented as hidden friends.
This was non-conforming and lead to incorrectly rejected C++ code, as
can be seen in the linked Github issue.

Fixes https://github.com/llvm/llvm-project/issues/56187

Differential Revision: https://reviews.llvm.org/D131430
2022-08-10 11:39:50 -07:00
Mark de Wever 70074cf397 [libc++] Fixes string_view comparison operators.
While implementing `operator<=>` for `string_view` (D130295) @philnik
pointed out `common_type` should be `type_identity`. Since it was an
existing issue that wasn't addressed.

This addresses the issue for both the new and existing equality and
comparison operators. The test is based on the example posted in
D130295.

Reviewed By: philnik, #libc, huixie90

Differential Revision: https://reviews.llvm.org/D131322
2022-08-10 19:38:50 +02:00
Mark de Wever 35bb1f5f34 [NFC][libc++][test] Removes unneeded code.
In D130295 @mumbleskates wondered why `std::strong_ordering::equal` had
special code since it's the same as `std::strong_ordering::equivalent`.

This is indeed the case so the special case can be removed.

Reviewed By: mumbleskates, #libc, avogelsgesang, ldionne

Differential Revision: https://reviews.llvm.org/D131419
2022-08-10 19:00:55 +02:00
Louis Dionne b1009bbd9e [libc++] Add missing includes of <cstddef> 2022-08-10 11:35:41 -04:00
Louis Dionne f5738c5145 [libc++] Make __libcpp_verbose_abort [[noreturn]]
This will allow using it in functions that are [[noreturn]] themselves.

Differential Revision: https://reviews.llvm.org/D131408
2022-08-10 10:37:15 -04:00
Adrian Vogelsgesang 9df5892804 [libc++] Implement `operator<=>` for `type_index`
Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D131357
2022-08-09 16:35:17 -07:00
Adrian Vogelsgesang cfefee87c2 [libc++][NFC] Remove TEST_HAS_NO_SPACESHIP_OPERATOR
The corresponding _LIBCPP_HAS_NO_SPACESHIP_OPERATOR macro was already
removed in commit c0f87e8382

Differential Revision: https://reviews.llvm.org/D131215
2022-08-09 16:32:54 -07:00
Mark de Wever 195287d90a [libc++][ranges] Sets ranges feature-test macro.
D131234 marked the ranges papers as complete, but it didn't set the
feature-test macro.

Reviewed By: ldionne, var-const, #libc

Differential Revision: https://reviews.llvm.org/D131326
2022-08-09 17:20:36 +02:00
Adrian Vogelsgesang 706b3951b3 [libc++] Implement `operator==` for `filesystem::space_info`
Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D130861
2022-08-08 10:05:47 -07:00
Adrian Vogelsgesang 3354644aad [libc++][doc] Update `SpaceshipProjects` status to reflect in-flight reviews 2022-08-08 06:39:12 -07:00
Louis Dionne 27442728cd [libc++][NFC] Fix signature of main in test 2022-08-08 09:30:29 -04:00
Louis Dionne 0a5c344a84 [libc++] Add missing <stdbool.h> to the modulemap
It used to be defined by the compiler, but libc++ now provides it.

Differential Revision: https://reviews.llvm.org/D131201
2022-08-08 09:00:57 -04:00
Louis Dionne e36f9e13bc [libc++] Allow enabling assertions when back-deploying
When back-deploying to older platforms, we can still provide assertions,
but we might not be able to provide a great implementation for the verbose
handler. Instead, we can just call ::abort().

Differential Revision: https://reviews.llvm.org/D131199
2022-08-08 08:43:34 -04:00
Adrian Vogelsgesang fc40804a5a [libc++][NFC] Fix `the the` in comment in `__format/buffer.h`
I made this commit primarily to test my commit access to the LLVM repo

Differential Revision: https://reviews.llvm.org/D131365
2022-08-07 11:14:43 -07:00
Igor Zhukov 6bb51bf062 [libc++][test] Fix MSVC warnings C6054, C6001, C4242 in format_tests.h
Reviewed By: Mordante

Differential Revision: https://reviews.llvm.org/D131336
2022-08-07 16:55:50 +07:00
Adrian Vogelsgesang 619e8f46f3 [libc++] Remove `operator!=` from `type_info` in C++20
Implements part of:

* P1614R2 The Mothership has Landed

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D130853
2022-08-06 15:10:38 +02:00
Adrian Vogelsgesang 735240b38f [libc++] Implement `operator<=>` for `unique_ptr`
Implements part of:

  - P1614R2 The Mothership has Landed

Fixes LWG3426

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D130838
2022-08-06 15:09:16 +02:00
Konstantin Varlamov 3fa291fa92 [libc++][ranges][NFC] Mark the completed Ranges papers and issues as done.
The newly-completed papers:
- P0896R4 ("The One Ranges Proposal");
- P1243R4 ("Rangify New Algorithms");
- P1252R2 ("Ranges Design Cleanup");
- P1716R3 ("Range Comparison Algorithms Are Over-Constrained");
- P1871R1 ("Concept traits should be named after concepts");
- P2106R0 ("Alternative wording for GB315 and GB316").

Differential Revision: https://reviews.llvm.org/D131234
2022-08-05 14:03:02 -07:00
Konstantin Varlamov 8ac015caf6 [libc++][ranges][NFC] Make sure all implemented algorithms are enabled in "robust" tests.
Also fix `std::find_first_of` (which accidentally copied the predicate
in the implementation).

Differential Revision: https://reviews.llvm.org/D131235
2022-08-05 14:02:12 -07:00
Louis Dionne cf08452e91 [libc++] Clarify comment in CI pipeline definition
This partially reverts commit 7d855bb8e1. The comments were actually
not outdated, they were simply unclear.
2022-08-04 14:08:07 -04:00
Louis Dionne 7d855bb8e1 [libc++][NFC] Remove outdated comment in CI pipeline definition 2022-08-04 14:03:23 -04:00
Konstantin Varlamov 52d4c5016c [libc++] Fix a hard error in `contiguous_iterator<NoOperatorArrowIter>`.
Evaluating `contiguous_iterator` on an iterator that satisfies all the
constraints except the `to_address` constraint and doesn't have
`operator->` defined results in a hard error. This is because
instantiating `to_address` ends up instantiating templates
dependent on the given type which might lead to a hard error even
in a SFINAE context.

Differential Revision: https://reviews.llvm.org/D130835
2022-08-04 10:58:21 -07:00
Nikolas Klauser 4038c859e5 [libc++][ranges] Implement `ranges::is_permutation`
Co-authored-by: Konstantin Varlamov <varconst@apple.com>

Differential Revision: https://reviews.llvm.org/D127194
2022-08-04 10:54:37 -07:00
Mark de Wever 3818b4df1e [libc++] Uses operator<=> in string_view
Implements:
- LWG3432 Missing requirement for comparison_category

Implements part of:
- P1614R2 The Mothership has Landed

Reviewed By: #libc, ldionne, jloser, philnik

Differential Revision: https://reviews.llvm.org/D130295
2022-08-04 19:13:47 +02:00