diff --git a/libcxx/cmake/caches/Generic-no-experimental.cmake b/libcxx/cmake/caches/Generic-no-experimental.cmake --- a/libcxx/cmake/caches/Generic-no-experimental.cmake +++ b/libcxx/cmake/caches/Generic-no-experimental.cmake @@ -1,2 +1,3 @@ +set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically. set(LIBCXX_TEST_PARAMS "enable_experimental=False" CACHE STRING "") set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "") diff --git a/libcxx/docs/Modules.rst b/libcxx/docs/Modules.rst --- a/libcxx/docs/Modules.rst +++ b/libcxx/docs/Modules.rst @@ -71,7 +71,6 @@ * Only C++23 and C++26 are tested * Libc++ is not tested with modules instead of headers * The module ``.cppm`` files are not installed - * The experimental ``PSTL`` library is not supported * Clang supports modules using GNU extensions, but libc++ does not work using GNU extensions. * Clang: diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in --- a/libcxx/modules/CMakeLists.txt.in +++ b/libcxx/modules/CMakeLists.txt.in @@ -35,7 +35,6 @@ std.cppm ) -target_compile_definitions(std PRIVATE _LIBCPP_ENABLE_EXPERIMENTAL) target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@) if (NOT @LIBCXX_ENABLE_EXCEPTIONS@) diff --git a/libcxx/modules/std/execution.inc b/libcxx/modules/std/execution.inc --- a/libcxx/modules/std/execution.inc +++ b/libcxx/modules/std/execution.inc @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#ifdef _LIBCPP_ENABLE_EXPERIMENTAL export namespace std { // [execpol.type], execution policy type trait using std::is_execution_policy; @@ -32,3 +33,4 @@ using std::execution::seq; using std::execution::unseq; } // namespace std::execution +#endif // _LIBCPP_ENABLE_EXPERIMENTAL diff --git a/libcxx/modules/std/ranges.inc b/libcxx/modules/std/ranges.inc --- a/libcxx/modules/std/ranges.inc +++ b/libcxx/modules/std/ranges.inc @@ -204,11 +204,13 @@ using std::ranges::views::drop_while; } // namespace views +#ifdef _LIBCPP_ENABLE_EXPERIMENTAL using std::ranges::join_view; namespace views { using std::ranges::views::join; } // namespace views +#endif // _LIBCPP_ENABLE_EXPERIMENTAL #if 0 using std::ranges::join_with_view; diff --git a/libcxx/modules/std/stop_token.inc b/libcxx/modules/std/stop_token.inc --- a/libcxx/modules/std/stop_token.inc +++ b/libcxx/modules/std/stop_token.inc @@ -9,6 +9,7 @@ export namespace std { #ifndef _LIBCPP_HAS_NO_THREADS +# ifdef _LIBCPP_ENABLE_EXPERIMENTAL // [stoptoken], class stop_­token using std::stop_token; @@ -21,5 +22,6 @@ // [stopcallback], class template stop_­callback using std::stop_callback; -#endif // _LIBCPP_HAS_NO_THREADS +# endif // _LIBCPP_ENABLE_EXPERIMENTAL +#endif // _LIBCPP_HAS_NO_THREADS } // namespace std diff --git a/libcxx/test/lit.local.cfg b/libcxx/test/lit.local.cfg --- a/libcxx/test/lit.local.cfg +++ b/libcxx/test/lit.local.cfg @@ -52,8 +52,10 @@ + os.path.join(config.test_exec_root, "__config_module__/CMakeFiles/std.dir"), ) - flags = getSubstitution("%{flags}", config) cmake = getSubstitution("%{cmake}", config) + flags = getSubstitution("%{flags}", config) + if "c++experimental" in config.available_features: + flags = f"{flags} -D_LIBCPP_ENABLE_EXPERIMENTAL" subprocess.check_call( [cmake, f"-DCMAKE_CXX_STANDARD={std}", f"-DCMAKE_CXX_FLAGS={flags}", build], diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -687,8 +687,11 @@ - "**/test-results.xml" - "**/*.abilist" env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" + # Note: Modules require and absolute path for clang-scan-deps + # https://github.com/llvm/llvm-project/issues/61006 + CC: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang" + CXX: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang++" + CMAKE: "/opt/bin/cmake" ENABLE_CLANG_TIDY: "On" agents: queue: "libcxx-builders"