This is a followup of D157625. Using the name clang-modules-build makes
it clear this is regarding the clang modules and not the C++23 std or
std.compat module.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D158927
This should fix CI issues introduced by 065dc485bd where the std.cppm
module won't build in C++20 mode because views::chunk_by was added in
C++23 but wasn't marked as such in ranges.inc.
When a handle to an error_category singleton object is used during the
termination phase of a program, the destruction of the error_category
object may have occurred prior to execution of the current destructor
or function registered with atexit, because the singleton object may
have been constructed after the corresponding initialization or call
to atexit. For example, the updated tests from this patch will fail if
using a libc++ built using a compiler that updates the vtable of the
object on destruction.
This patch attempts to avoid the issue by causing the destructor to not
be called in the style of ResourceInitHelper in src/experimental/memory_resource.cpp.
This approach might not work if object lifetime is strictly enforced.
Differential Revision: https://reviews.llvm.org/D65667
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
The vendors of the MSVC STL, libstdc++ and libc++ have agreed [1] to
make the C++23 modules std and std.compat available in C++20. This
provides the std module; libc++ has not implemented the std.compat
module yet.
[1] https://github.com/microsoft/STL/issues/3945
Depends on D158357
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D158358
When the modules are used in a bootstrap build the paths
${LIBCXX_GENERATED_INCLUDE_DIR} and
${LIBCXX_GENERATED_INCLUDE_TARGET_DIR} have a different value and both
are needed to build modules.
This issue has been reported on Slack.
This brings most of the enable_ifs in libc++ to the same style. It also has the nice side-effect of reducing the size of names of these symbols, since the depedent return type is shorter.
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D157787
This brings most of the enable_ifs in libc++ to the same style.
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D157753
Both Clang and GCC always define __BYTE_ORDER__, so there is no need to test the byte order a million different ways.
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits, krytarowski
Differential Revision: https://reviews.llvm.org/D158216
This is to prevent a GCC warning (
https://github.com/llvm/llvm-project/issues/65132). It looks like
`__at_first` is always assigned before it's used, but all other member
variables of this struct are initialized in the constructor, so there is
no reason not to initialize `__at_first` as well.
Differential Revision: https://reviews.llvm.org/D159249
This allows including once_flag directly from <__locale> instead of
depending on all of <mutex>, which requires threading. In turn, this
makes it easier to support locales on platforms without threading.
Drive-by change: clang-format once_flag.h and use _LIBCPP_HIDE_FROM_ABI
Differential Revision: https://reviews.llvm.org/D155487
The summary flag causes a progress bar to appear and be rewritten using
a curses like interface. This works great for interactive sessions, but
produces line after line of garbage in the logs.
This should cause the logs to be much smaller and more readable.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D159120
We only support Clang on windows, so this code path is never taken.
Reviewed By: #libc, Mordante
Spies: Mordante, libcxx-commits
Differential Revision: https://reviews.llvm.org/D158230
This reverts commit 014830193b21ff87639762cbb89dad79ae5831ec.
and ce12d6563e84c209c7200de3bfbf84c5d349824c.
Differential Revision: https://reviews.llvm.org/D158754
This was mention in D150044 and D154995 that this would be useful.
This addresses the last review coment of D150044.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D156019
This adds more information regarding the libc++ coding style and
reference that are useful when working on a standard library
implementation.
This information is based on review comments and tips I give to new
contributors an information I wish I'd know when I started working on
libc++.
Depends on D156051
Reviewed By: #libc, jloser, var-const, ldionne
Differential Revision: https://reviews.llvm.org/D156052
This patch and D154984 were discussed in
<https://discourse.llvm.org/t/rfc-improving-lits-debug-output/72839>.
Motivation
----------
D154984 removes the "Script:" section that lit prints along with a
test's output, and it makes -v and -a imply -vv. For example, after
D154984, the "Script:" section below is never shown, but -v is enough
to produce the execution trace following it:
```
Script:
--
: 'RUN: at line 1'; echo hello | FileCheck bogus.txt && echo success
--
Exit Code: 2
Command Output (stdout):
--
$ ":" "RUN: at line 1"
$ "echo" "hello"
# command output:
hello
$ "FileCheck" "bogus.txt"
# command stderr:
Could not open check file 'bogus.txt': No such file or directory
error: command failed with exit status: 2
--
```
In the D154984 review, some reviewers point out that they have been
using the "Script:" section for copying and pasting a test's shell
commands to a terminal window. The shell commands as printed in the
execution trace can be harder to copy and paste for the following
reasons:
- They drop redirections and break apart RUN lines at `&&`, `|`, etc.
- They add `$` at the start of every command, which makes it hard to
copy and paste multiple commands in bulk.
- Command stdout, stderr, etc. are interleaved with the commands and
are not clearly delineated.
- They don't always use proper shell quoting. Instead, they blindly
enclose all command-line arguments in double quotes.
Changes
-------
D154984 plus this patch converts the above example into:
```
Exit Code: 2
Command Output (stdout):
--
# RUN: at line 1
echo hello | FileCheck bogus-file.txt && echo success
# executed command: echo hello
# .---command stdout------------
# | hello
# `-----------------------------
# executed command: FileCheck bogus-file.txt
# .---command stderr------------
# | Could not open check file 'bogus-file.txt': No such file or directory
# `-----------------------------
# error: command failed with exit status: 2
--
```
Thus, this patch addresses the above issues as follows:
- The entire execution trace can be copied and pasted in bulk to a
terminal for correct execution of the RUN lines, which are printed
intact as they appeared in the original RUN lines except lit
substitutions are expanded. Everything else in the execution trace
appears in shell comments so it has no effect in a terminal.
- Each of the RUN line's commands is repeated (in shell comments) as
it executes to show (1) that the command actually executed (e.g.,
`echo success` above didn't) and (2) what stdout, stderr, non-zero
exit status, and output files are associated with the command, if
any. Shell quoting in the command is now correct and minimal but is
not necessarily the original shell quoting from the RUN line.
- The start and end of the contents of stdout, stderr, or an output
file is now delineated clearly in the trace.
To help produce some of the above output, this patch extends lit's
internal shell with a built-in `@echo` command. It's like `echo`
except lit suppresses the normal execution trace for `@echo` and just
prints its stdout directly. For now, `@echo` isn't documented for use
in lit tests.
Without this patch, libcxx's custom lit test format tries to parse the
stdout from `lit.TestRunner.executeScriptInternal` (which runs lit's
internal shell) to extract the stdout and stderr produced by shell
commands, and that parse no longer works after the above changes.
This patch makes a small adjustment to
`lit.TestRunner.executeScriptInternal` so libcxx can just request
stdout and stderr without an execution trace.
(As a minor drive-by fix that came up in testing: lit's internal `not`
command now always produces a numeric exit status and never `True`.)
Caveat
------
This patch only makes the above changes for lit's internal shell. In
most cases, we do not know how to force external shells (e.g., bash,
sh, window's `cmd`) to produce execution traces in the manner we want.
To configure a test suite to use lit's internal shell (which is
usually better for test portability than external shells anyway), add
this to the test suite's `lit.cfg` or other configuration file:
```
config.test_format = lit.formats.ShTest(execute_external=False)
```
Reviewed By: MaskRay, awarzynski
Differential Revision: https://reviews.llvm.org/D156954
Since C++14 has been released for about nine years and most standard
libraries have implemented sized deallocation functions, it's time to
make this feature default again.
Reviewed By: rnk, aaron.ballman, #libc, ldionne, Mordante, MaskRay
Differential Revision: https://reviews.llvm.org/D112921
GNU/Hurd does have clock_gettime, it just doesn't define _POSIX_TIMERS because its support for timers is not complete.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D158584
PowerPC on linux currently don't have support for lowering long double for
frexp(). Removing the tests until implementation is provided.
Reviewed By: #libc, amyk, Mordante
Differential Revision: https://reviews.llvm.org/D158547
`__assign_view__` is declared as a noexcept function in `libcxx/include/__filesystem/path.h` however internally it calls `std::basic_string<char>::basic_string<char>(std::string_view)` which is not a noexcept function this may lead to a `std::terminate()` call when allocation of a new string fails.
Fixes : https://github.com/llvm/llvm-project/issues/64858
Reviewed By: Mordante, #libc
Differential Revision: https://reviews.llvm.org/D158826
When `__locale_dir/locale_base_api/locale_guard.h is` compiled independently, as it is when it's in its own clang module, it fails to compile due to `locale_t` being undefined. It needs to include `__locale` to get that, instead of just `clocale`.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D158669
This is obviously a hack, but it's too late at night to figure out the
exact issue and which commit introduced it, and I want to get the CI
back to green for contributors overnight.
Note that there is a Differential revision for the stride ranges
view implementation and the names of the people who are developing
it.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D158446
With C++20 modules in libc++ the old name modules is ambiguous. This
rename makes it clear this is regarding the clang modules.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D153042
The std module can be tested in the generic C++23 build. This removes the
special module build.
Note it is possible to enable modules automatically in CMake, but that
would fail in the "parts disabled" builds; they have not been properly
been converted to modules yet.
Depends on D157625
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D157744