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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
This removes a lot of boilerplate code.
Reviewed By: ldionne, #libc
Spies: EricWF, libcxx-commits
Differential Revision: https://reviews.llvm.org/D128081
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
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
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
Replaces std::__format_context_create with the public wrapper
test_format_context_create.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D133781
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
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
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
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
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
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
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
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
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
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
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
We require rvalue support anyways, so let's use it.
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D133013
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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.
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
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
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
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
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
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
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
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
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
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
_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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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