[libcxx-commits] [libcxx] d015e48 - [libc++][C++20 modules] Tests no experimental library build.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 6 10:31:35 PDT 2023
Author: Mark de Wever
Date: 2023-09-06T19:31:29+02:00
New Revision: d015e481d72e7657b011047e0287756bab5464cf
URL: https://github.com/llvm/llvm-project/commit/d015e481d72e7657b011047e0287756bab5464cf
DIFF: https://github.com/llvm/llvm-project/commit/d015e481d72e7657b011047e0287756bab5464cf.diff
LOG: [libc++][C++20 modules] Tests no experimental library build.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D158936
Added:
Modified:
libcxx/cmake/caches/Generic-no-experimental.cmake
libcxx/docs/Modules.rst
libcxx/modules/CMakeLists.txt.in
libcxx/modules/std/execution.inc
libcxx/modules/std/ranges.inc
libcxx/modules/std/stop_token.inc
libcxx/test/lit.local.cfg
libcxx/utils/ci/buildkite-pipeline.yml
Removed:
################################################################################
diff --git a/libcxx/cmake/caches/Generic-no-experimental.cmake b/libcxx/cmake/caches/Generic-no-experimental.cmake
index f33ed01418990bf..fe14e7afed7b962 100644
--- 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
index 6d730cefc9fee3a..a16b3694cfae300 100644
--- a/libcxx/docs/Modules.rst
+++ b/libcxx/docs/Modules.rst
@@ -71,7 +71,6 @@ Some of the current limitations
* 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
index 703206e7c640579..dca3b25155a5af4 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -35,7 +35,6 @@ target_sources(std
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
index b0a3b17fe3e4c63..86c1cd7622b9b83 100644
--- 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 @@ export namespace std::execution {
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
index 82c7d99f8979a82..a883103d812588b 100644
--- a/libcxx/modules/std/ranges.inc
+++ b/libcxx/modules/std/ranges.inc
@@ -204,11 +204,13 @@ export namespace std {
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
index 5daf4609611f876..ad2401747d61c68 100644
--- 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 @@ export namespace std {
// [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
index 300fef2cf72b5b7..4116553b6f7a9ae 100644
--- a/libcxx/test/lit.local.cfg
+++ b/libcxx/test/lit.local.cfg
@@ -52,8 +52,10 @@ if (
+ 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
index 175998dab7a365d..9265a0367378d4a 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -687,8 +687,11 @@ steps:
- "**/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"
More information about the libcxx-commits
mailing list