It's important that the arch directory be included first so that
its header files which interpose on the default include dir
be included instead of the default ones. The clang driver [1] does
this when not building with -nostdinc, the libcxx build should
do the same.
We found this after https://reviews.llvm.org/D154282 when cross
compiling from non Linux to Linux. If the host machine was not
Linux, _LIBCPP_HAS_NO_TIME_ZONE_DATABASE would be defined in
the default include dir __config_site, while it was undefined
in the arch specific one causing build failures.
Fixes a conflict with adding the no experimental module build.
Disables some tests that need further investigation, this should fix the
CI runners.
These issues were reported on Discord and in D154282.
This is the first step to implement time zone support in libc++. This
adds the complete tzdb_list class and a minimal tzdb class. The tzdb
class only contains the version, which is used by reload_tzdb.
Next to these classes it contains documentation and build system support
needed for time zone support. The code depends on the IANA Time Zone
Database, which should be available on the platform used or provided by
the libc++ vendors.
The code is labeled as experimental since there will be ABI breaks
during development; the tzdb class needs to have the standard headers.
Implements parts of:
- P0355 Extending <chrono> to Calendars and Time Zones
Addresses:
- LWG3319 Properly reference specification of IANA time zone database
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D154282
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.
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 fixes some missing #ifndef and implements the header restrictions
in the modules script.
Depends on D158192
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D158330
This takes the header restrictions into account instead of manually
duplicating this build information. This is a preparation to properly
support the libc++ disabled parts in the std module.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D158192
This patch is based on the suggestion by @ChuanqiXu on discourse
(https://discourse.llvm.org/t/alternatives-to-the-implementation-of-std-modules/71958)
Instead of making a module partition per header every header gets an inc
file which contains the exports per header. The std module then includes
all public headers and these inc files. The one file per header is
useful for testing purposes. The CI tests whether the exports of a
header's module partition matches the "public" named declarations in the
header. With one file per header this can still be done.
The patch improves compilation time of files using "import std;" and the
size of the std module.
A comparision of the compilation speed using a libc++ test
build/bin/llvm-lit -a -Dstd=c++23 -Denable_modules=std libcxx/test/std/modules/std.pass.cpp
Which boils down to
import std;
int main(int, char**) {
std::println("Hello modular world");
return 0;
}
and has -ftime-report enabled
Before
===-------------------------------------------------------------------------===
Clang front-end time report
===-------------------------------------------------------------------------===
Total Execution Time: 8.6585 seconds (8.6619 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
4.5041 ( 57.2%) 0.4264 ( 54.4%) 4.9305 ( 56.9%) 4.9331 ( 57.0%) Clang front-end timer
3.2037 ( 40.7%) 0.2408 ( 30.7%) 3.4445 ( 39.8%) 3.4452 ( 39.8%) Reading modules
0.1665 ( 2.1%) 0.1170 ( 14.9%) 0.2835 ( 3.3%) 0.2837 ( 3.3%) Loading .../build/test/__config_module__/CMakeFiles/std.dir/std.pcm
7.8744 (100.0%) 0.7842 (100.0%) 8.6585 (100.0%) 8.6619 (100.0%) Total
After
===-------------------------------------------------------------------------===
Clang front-end time report
===-------------------------------------------------------------------------===
Total Execution Time: 1.2420 seconds (1.2423 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.8892 ( 84.6%) 0.1698 ( 88.8%) 1.0590 ( 85.3%) 1.0590 ( 85.2%) Clang front-end timer
0.1533 ( 14.6%) 0.0168 ( 8.8%) 0.1701 ( 13.7%) 0.1704 ( 13.7%) Reading modules
0.0082 ( 0.8%) 0.0047 ( 2.5%) 0.0129 ( 1.0%) 0.0129 ( 1.0%) Loading .../build/test/__config_module__/CMakeFiles/std.dir/std.pcm
1.0507 (100.0%) 0.1913 (100.0%) 1.2420 (100.0%) 1.2423 (100.0%) Total
Using "include <print>" instead of "import module;"
===-------------------------------------------------------------------------===
Clang front-end time report
===-------------------------------------------------------------------------===
Total Execution Time: 2.1507 seconds (2.1517 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
1.9714 (100.0%) 0.1793 (100.0%) 2.1507 (100.0%) 2.1517 (100.0%) Clang front-end timer
1.9714 (100.0%) 0.1793 (100.0%) 2.1507 (100.0%) 2.1517 (100.0%) Total
It's possible to use the std module in external projects
(https://libcxx.llvm.org/Modules.html#using-in-external-projects)
Tested this with a private project to validate the size of the generated files:
Before
$ du -sch std-*
448M std-build
508K std-src
120K std-subbuild
449M total
After
$ du -sch std-*
29M std-build
1004K std-src
132K std-subbuild
30M total
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D156907
@ChuanqiXu noticed std::atomic was not properly exported in the std module.
Investigation showed other named declarations were not exported either. This
fixes the issue.
Depends on D156550
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D156592
This implements P0009 std::mdspan ((https://wg21.link/p0009)),
a multidimensional span with customization points for
layouts and data access.
Co-authored-by: Damien L-G <dalg24@gmail.com>
Differential Revision: https://reviews.llvm.org/154367
Drive-by fix to make sure the __retarget_buffer works correctly whan
using a hint of 1. This was discovered in one of the new tests.
Drive-by fixes __retarget_buffer when initialized with size 1.
Implements parts of
- P2093R14 Formatted output
- P2539R4 Should the output of std::print to a terminal be
synchronized with the underlying stream?
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D150044
This commit implements default_accessor in support of C++23 mdspan
(https://wg21.link/p0009). default_accessor is the trivial accessor
using plain pointers and reference to element types.
Co-authored-by: Damien L-G <dalg24@gmail.com>
Differential Revision: https://reviews.llvm.org/D153935
Remove spaces between operator"" and identifier to suppress
-Wdeprecated-literal-operator, and between operator and ""
like how they are written in [string.view.literals] and [basic.string.literals].
Differential Revision: https://reviews.llvm.org/D155200
This is a preparation for
P2093R14 Formatted output
When the output of print is to the terminal it needs to use the native
API. This means transcoding UTF-8 to UTF-16 on Windows. The encoder's
interface is modeled after
P2728 Unicode in the Library, Part 1: UTF Transcoding
But only the required part for P2093R14 is implemented.
On Windows wchar_t is 16 bits, in order to test on platforms where
wchar_t is 32 bits the transcoder has support for char16_t. It also adds
and UTF-8 to UTF-32 encoder which is useful for other tests.
Note it is possible to use <codecvt> for transcoding, but that header is
deprecated. So rather write new code that is not deprecated; the hard
part, decoding, has already been done. The <codecvt> header also
requires locale support while the new code works without including
<locale>.
Note the current transcoder implementation can be optimized since it
basically does UTF-8 -> UTF-32 -> UTF-16. The first goal is to have a
working implementation. Since it's not part of the ABI it's possible to
do the optimization later.
Depends on D149672
Reviewed By: ldionne, tahonermann, #libc
Differential Revision: https://reviews.llvm.org/D150031
The first issue was found by @ldionne, upon further investigation there
were more duplicates. This removes the duplicates and updates the
clang-tidy test to detect duplicates.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D154723
This commit implements layout_left in support of C++23 mdspan
(https://wg21.link/p0009). layout_left is a layout mapping policy
whose index mapping corresponds to the memory layout of Fortran arrays.
Thus the left most index has stride-1 access, and the right most index
is associated with the largest stride.
Co-authored-by: Damien L-G <dalg24@gmail.com>
Differential Revision: https://reviews.llvm.org/D153783
This commit implements layout_right in support of C++23 mdspan
(https://wg21.link/p0009). layout_right is a layout mapping policy
whose index mapping corresponds to the memory layout of multidimensional
C-arrays, and is thus also referred to as the C-layout.
Co-authored-by: Damien L-G <dalg24@gmail.com>
Differential Revision: https://reviews.llvm.org/D151267
This updates:
- The status tables
- Feature test macros
- New headers for modules
The latter avoids forgetting about modules when implementing the feature
in a new header.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D153192
The patch is based on D144994.
D151030 added the module definitions for the module std.
This patch wires in the module and enables the basic testing.
Some notable features are missing:
- There is no test that libc++ can be fully imported as a module.
- This lacks the parts for the std.compat module.
- The module is not shipped with libc++.
Implements parts of
- P2465R3 Standard Library Modules std and std.compat
Reviewed By: ldionne, aaronmondal, #libc
Differential Revision: https://reviews.llvm.org/D151814
This adds the cppm files of D144994. These files by themselves will do
nothing. The goal is to reduce the size of D144994 and making it easier
to review the real changes of the patch.
Implements parts of
- P2465R3 Standard Library Modules std and std.compat
Reviewed By: ldionne, ChuanqiXu, aaronmondal, #libc
Differential Revision: https://reviews.llvm.org/D151030