Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

199 lines
5.7 KiB
Plaintext
Raw Normal View History

[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// WARNING, this entire header is generated by
// utils/generate_libcxx_cppm_in.py
// DO NOT MODIFY!
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
module;
#include <__config>
// The headers of Table 24: C++ library headers[tab:headers.cpp]
// and the headers of Table 25: C++ headers for C library facilities[tab:headers.cpp.c]
#include <algorithm>
#include <any>
#include <array>
#if _LIBCPP_HAS_ATOMIC_HEADER
# include <atomic>
#endif
#include <barrier>
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <bit>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <charconv>
#include <chrono>
#include <cinttypes>
#include <climits>
#if _LIBCPP_HAS_LOCALIZATION
# include <clocale>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <cmath>
#if _LIBCPP_HAS_LOCALIZATION
# include <codecvt>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <compare>
#include <complex>
#include <concepts>
#include <condition_variable>
#include <coroutine>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cuchar>
#include <cwchar>
#include <cwctype>
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <deque>
#include <exception>
#include <execution>
#include <expected>
#include <filesystem>
#include <flat_map>
#include <flat_set>
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <format>
#include <forward_list>
#if _LIBCPP_HAS_LOCALIZATION
# include <fstream>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <functional>
#include <future>
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <initializer_list>
#if _LIBCPP_HAS_LOCALIZATION
# include <iomanip>
#endif
#if _LIBCPP_HAS_LOCALIZATION
# include <ios>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <iosfwd>
#if _LIBCPP_HAS_LOCALIZATION
# include <iostream>
#endif
#if _LIBCPP_HAS_LOCALIZATION
# include <istream>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <iterator>
#include <latch>
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <limits>
#include <list>
#if _LIBCPP_HAS_LOCALIZATION
# include <locale>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <map>
#include <mdspan>
#include <memory>
#include <memory_resource>
#include <mutex>
#include <new>
#include <numbers>
#include <numeric>
#include <optional>
#if _LIBCPP_HAS_LOCALIZATION
# include <ostream>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <print>
#include <queue>
#include <random>
#include <ranges>
#include <ratio>
#if _LIBCPP_HAS_LOCALIZATION
# include <regex>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <scoped_allocator>
#include <semaphore>
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <set>
#include <shared_mutex>
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <source_location>
#include <span>
#if _LIBCPP_HAS_LOCALIZATION
# include <sstream>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <stack>
#include <stdexcept>
#include <stop_token>
#if _LIBCPP_HAS_LOCALIZATION
# include <streambuf>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <string>
#include <string_view>
#if _LIBCPP_HAS_LOCALIZATION
# include <strstream>
#endif
#if _LIBCPP_HAS_LOCALIZATION
# include <syncstream>
#endif
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <system_error>
#include <thread>
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <variant>
#include <vector>
#include <version>
// *** Headers not yet available ***
//
// This validation is mainly to catch when a new header is added but adding the
// corresponding .inc file is forgotten. However, the check based on __has_include
// alone doesn't work on Windows because the Windows SDK is on the include path,
// and that means the MSVC STL headers can be found as well, tricking __has_include
// into thinking that libc++ provides the header.
//
#ifndef _WIN32
# if __has_include(<debugging>)
# error "please update the header information for <debugging> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<debugging>)
# if __has_include(<generator>)
# error "please update the header information for <generator> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<generator>)
# if __has_include(<hazard_pointer>)
# error "please update the header information for <hazard_pointer> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<hazard_pointer>)
# if __has_include(<inplace_vector>)
# error "please update the header information for <inplace_vector> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<inplace_vector>)
# if __has_include(<linalg>)
# error "please update the header information for <linalg> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<linalg>)
# if __has_include(<rcu>)
# error "please update the header information for <rcu> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<rcu>)
# if __has_include(<spanstream>)
# error "please update the header information for <spanstream> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<spanstream>)
# if __has_include(<stacktrace>)
# error "please update the header information for <stacktrace> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<stacktrace>)
# if __has_include(<stdfloat>)
# error "please update the header information for <stdfloat> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<stdfloat>)
# if __has_include(<text_encoding>)
# error "please update the header information for <text_encoding> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<text_encoding>)
#endif // _WIN32
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
export module std;
[libc++][modules] Removes the module partitions. 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
2023-08-02 08:16:09 +02:00
@LIBCXX_MODULE_STD_INCLUDE_SOURCES@