[llvm-branch-commits] [libcxx] [libc++][modules] Improves std.compat module. (PR #76330)
https://github.com/mordante created https://github.com/llvm/llvm-project/pull/76330 Let the std.compat module use the std module instead of duplicating the exports. Based on @ChuanqiXu9's suggestion in #71438. >From 246a8a14f125934b5e8c84b2d391db72ee4dc647 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sun, 24 Dec 2023 12:13:00 +0100 Subject: [PATCH] [libc++][modules] Improves std.compat module. Let the std.compat module use the std module instead of duplicating the exports. Based on @ChuanqiXu9's suggestion in #71438. --- libcxx/modules/std.compat.cppm.in | 125 +- libcxx/modules/std.cppm.in| 1 + libcxx/test/libcxx/module_std_compat.gen.py | 25 +--- .../header_exportable_declarations.cpp| 2 +- libcxx/utils/generate_libcxx_cppm_in.py | 6 +- libcxx/utils/libcxx/header_information.py | 25 libcxx/utils/libcxx/test/format.py| 21 ++- 7 files changed, 45 insertions(+), 160 deletions(-) diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in index f199e194e60b16..651d6ec7b9fe26 100644 --- a/libcxx/modules/std.compat.cppm.in +++ b/libcxx/modules/std.compat.cppm.in @@ -17,38 +17,17 @@ module; // 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 -#include -#include -#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include #include #include #include #include #include -#include -#include #include #include #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include #endif #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#include -#include -#include #include #include #include @@ -65,107 +44,6 @@ module; #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include #endif -#include -#include -#include -#include -#include -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#include -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // *** Headers not yet available *** #if __has_include() @@ -203,6 +81,7 @@ module; #endif // __has_include() export module std.compat; +export import std; + -@LIBCXX_MODULE_STD_INCLUDE_SOURCES@ @LIBCXX_MODULE_STD_COMPAT_INCLUDE_SOURCES@ \ No newline at end of file diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in index b46c52e781f82f..6ce8e287737b88 100644 --- a/libcxx/modules/std.cppm.in +++ b/libcxx/modules/std.cppm.in @@ -204,4 +204,5 @@ module; export module std; + @LIBCXX_MODULE_STD_INCLUDE_SOURCES@ diff --git a/libcxx/test/libcxx/module_std_compat.gen.py b/libcxx/test/libcxx/module_std_compat.gen.py index 63fdd8188937e1..033ec34513c572 100644 --- a/libcxx/test/libcxx/module_std_compat.gen.py +++ b/libcxx/test/libcxx/module_std_compat.gen.py @@ -21,6 +21,7 @@ import sys sys.path.append(sys.argv[1]) +from libcxx.header_information import module_c_headers from libcxx.test.modules import module_test_generator generator = module_test_generator( @@ -37,27 +38,5 @@ print("//--- module_std_compat.sh.cpp") generator.write_test( "std.compat", -[ -"cassert", -"cctype", -"cerrno", -"cfenv", -"cfloat", -"cinttypes", -"climits", -"clocale", -"cmath", -"csetjmp", -"csignal", -"cstdarg", -
[llvm-branch-commits] [libcxx] [libc++][modules] Improves std.compat module. (PR #76330)
llvmbot wrote: @llvm/pr-subscribers-libcxx Author: Mark de Wever (mordante) Changes Let the std.compat module use the std module instead of duplicating the exports. Based on @ChuanqiXu9's suggestion in #71438. --- Full diff: https://github.com/llvm/llvm-project/pull/76330.diff 7 Files Affected: - (modified) libcxx/modules/std.compat.cppm.in (+2-123) - (modified) libcxx/modules/std.cppm.in (+1) - (modified) libcxx/test/libcxx/module_std_compat.gen.py (+2-23) - (modified) libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp (+1-1) - (modified) libcxx/utils/generate_libcxx_cppm_in.py (+4-2) - (modified) libcxx/utils/libcxx/header_information.py (+25) - (modified) libcxx/utils/libcxx/test/format.py (+10-11) ``diff diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in index f199e194e60b16..651d6ec7b9fe26 100644 --- a/libcxx/modules/std.compat.cppm.in +++ b/libcxx/modules/std.compat.cppm.in @@ -17,38 +17,17 @@ module; // 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 -#include -#include -#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include #include #include #include #include #include -#include -#include #include #include #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include #endif #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#include -#include -#include #include #include #include @@ -65,107 +44,6 @@ module; #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include #endif -#include -#include -#include -#include -#include -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#include -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // *** Headers not yet available *** #if __has_include() @@ -203,6 +81,7 @@ module; #endif // __has_include() export module std.compat; +export import std; + -@LIBCXX_MODULE_STD_INCLUDE_SOURCES@ @LIBCXX_MODULE_STD_COMPAT_INCLUDE_SOURCES@ \ No newline at end of file diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in index b46c52e781f82f..6ce8e287737b88 100644 --- a/libcxx/modules/std.cppm.in +++ b/libcxx/modules/std.cppm.in @@ -204,4 +204,5 @@ module; export module std; + @LIBCXX_MODULE_STD_INCLUDE_SOURCES@ diff --git a/libcxx/test/libcxx/module_std_compat.gen.py b/libcxx/test/libcxx/module_std_compat.gen.py index 63fdd8188937e1..033ec34513c572 100644 --- a/libcxx/test/libcxx/module_std_compat.gen.py +++ b/libcxx/test/libcxx/module_std_compat.gen.py @@ -21,6 +21,7 @@ import sys sys.path.append(sys.argv[1]) +from libcxx.header_information import module_c_headers from libcxx.test.modules import module_test_generator generator = module_test_generator( @@ -37,27 +38,5 @@ print("//--- module_std_compat.sh.cpp") generator.write_test( "std.compat", -[ -"cassert", -"cctype", -"cerrno", -"cfenv", -"cfloat", -"cinttypes", -"climits", -"clocale", -"cmath", -"csetjmp", -"csignal", -"cstdarg", -"cstddef", -"cstdint", -"cstdio", -"cstdlib", -"cstring", -"ctime", -"cuchar", -"cwchar", -"cwctype", -], +module_c_headers, ) diff --git a/libcxx/test/tools/cla
[llvm-branch-commits] [libcxx] [libc++][modules] Improves std.compat module. (PR #76330)
https://github.com/mordante updated https://github.com/llvm/llvm-project/pull/76330 >From 6134779ac0f53ed22d8ddfc14908e595eb94fb65 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sun, 24 Dec 2023 12:13:00 +0100 Subject: [PATCH] [libc++][modules] Improves std.compat module. Let the std.compat module use the std module instead of duplicating the exports. Based on @ChuanqiXu9's suggestion in #71438. --- libcxx/modules/std.compat.cppm.in | 125 +--- libcxx/modules/std.cppm.in | 1 + libcxx/test/libcxx/module_std_compat.gen.py | 25 +--- libcxx/utils/generate_libcxx_cppm_in.py | 6 +- libcxx/utils/libcxx/header_information.py | 25 libcxx/utils/libcxx/test/format.py | 21 ++-- 6 files changed, 44 insertions(+), 159 deletions(-) diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in index f199e194e60b16..651d6ec7b9fe26 100644 --- a/libcxx/modules/std.compat.cppm.in +++ b/libcxx/modules/std.compat.cppm.in @@ -17,38 +17,17 @@ module; // 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 -#include -#include -#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include #include #include #include #include #include -#include -#include #include #include #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include #endif #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#include -#include -#include #include #include #include @@ -65,107 +44,6 @@ module; #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include #endif -#include -#include -#include -#include -#include -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#include -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include -#endif -#include -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // *** Headers not yet available *** #if __has_include() @@ -203,6 +81,7 @@ module; #endif // __has_include() export module std.compat; +export import std; + -@LIBCXX_MODULE_STD_INCLUDE_SOURCES@ @LIBCXX_MODULE_STD_COMPAT_INCLUDE_SOURCES@ \ No newline at end of file diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in index b46c52e781f82f..6ce8e287737b88 100644 --- a/libcxx/modules/std.cppm.in +++ b/libcxx/modules/std.cppm.in @@ -204,4 +204,5 @@ module; export module std; + @LIBCXX_MODULE_STD_INCLUDE_SOURCES@ diff --git a/libcxx/test/libcxx/module_std_compat.gen.py b/libcxx/test/libcxx/module_std_compat.gen.py index 63fdd8188937e1..033ec34513c572 100644 --- a/libcxx/test/libcxx/module_std_compat.gen.py +++ b/libcxx/test/libcxx/module_std_compat.gen.py @@ -21,6 +21,7 @@ import sys sys.path.append(sys.argv[1]) +from libcxx.header_information import module_c_headers from libcxx.test.modules import module_test_generator generator = module_test_generator( @@ -37,27 +38,5 @@ print("//--- module_std_compat.sh.cpp") generator.write_test( "std.compat", -[ -"cassert", -"cctype", -"cerrno", -"cfenv", -"cfloat", -"cinttypes", -"climits", -"clocale", -"cmath", -"csetjmp", -"csignal", -"cstdarg", -"cstddef", -"cstdint", -"cstdio", -"cstdlib", -"cstring", -"ctime", -"cuchar", -"cwchar", -"cwctype", -], +module_c_hea
[llvm-branch-commits] [libcxx] [libc++][modules] Adds module testing. (PR #76246)
mordante wrote: > > > If you are okay with the suggestions that I made for some typos in the > > > documentation, I will preemptively incorporate it into my documentation > > > PR. > > > > > > Thanks for the suggestions! Please do no incorporate these in your PR. > > Other reviewers may have other suggestions which you then need to > > incorporate too. It's a lot easier, for both of us, when you finish the > > documentation PR and after you merged your branch I move the comments of > > this patch to the new location. I left this comment for other reviewers so > > they don't need to comment on it. This is how we typically resolve > > conflicts between patches. > > That makes total sense. I had already added the following to my PR (in case > you are interested in incorporating here): > > but I will gladly revert that if you think it's a good idea. Yes otherwise we need to block your patch on this patch. > Sorry for the confusion -- just trying to be helpful! No problem, I appreciate your help! https://github.com/llvm/llvm-project/pull/76246 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++][modules] Increase clang-tidy version used. (PR #76268)
mordante wrote: It's the line `export import std;` in https://github.com/llvm/llvm-project/pull/76330/files#diff-e881fdd0e6e66610142a28228b2bbf0e38520ee7186946bca06cb8d195dcd2b4 This works with Clang-17, Clang-18, and clang-tidy-18. It fails with clang-tidy-17. Clang-tidy tests that directly use the `std` module work. When importing `std` clang-tidy complains about a corrupt AST in the `std` module. So this sounds like a clang-tidy-17 but that has been fixed in clang-tidy-18. https://github.com/llvm/llvm-project/pull/76268 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++][modules] Increase clang-tidy version used. (PR #76268)
philnik777 wrote: Oh shit. I just realized that this is most likely a latent bug no matter what. We build the module with Clang 18, and then essentially try to load it with Clang 17 (aka Clang Tidy 17). AFAIK that's not guaranteed to work, and probably just happens to work currently with Clang 17 building and Clang 18 loading the module (assuming we even test that right now?). I think we may have to always match the Clang and Clang Tidy versions we use. https://github.com/llvm/llvm-project/pull/76268 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++][modules] Increase clang-tidy version used. (PR #76268)
mordante wrote: Good point, I actually think that's true. I think we should do that in a separate PR. Maybe discuss it on Discord after the holidays. https://github.com/llvm/llvm-project/pull/76268 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++][modules] Improves std.compat module. (PR #76330)
@@ -17,38 +17,17 @@ module; // 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 -#include -#include -#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) -# include -#endif -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include -#endif -#include -#include #include #include ChuanqiXu9 wrote: Let's try to remove the duplicated headers as much as possible. Maybe we can improve it by something like: ``` export module std.compat; export import std; export using double_t = std::double_t; ``` https://github.com/llvm/llvm-project/pull/76330 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits