Skip to content

Commit

Permalink
[libc++][C++20 modules] Tests no experimental library build.
Browse files Browse the repository at this point in the history
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D158936
  • Loading branch information
mordante committed Sep 6, 2023
1 parent f2f36c9 commit d015e48
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions libcxx/cmake/caches/Generic-no-experimental.cmake
Original file line number Diff line number Diff line change
@@ -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 "")
1 change: 0 additions & 1 deletion libcxx/docs/Modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion libcxx/modules/CMakeLists.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@)
Expand Down
2 changes: 2 additions & 0 deletions libcxx/modules/std/execution.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//

#ifdef _LIBCPP_ENABLE_EXPERIMENTAL
export namespace std {
// [execpol.type], execution policy type trait
using std::is_execution_policy;
Expand All @@ -32,3 +33,4 @@ export namespace std::execution {
using std::execution::seq;
using std::execution::unseq;
} // namespace std::execution
#endif // _LIBCPP_ENABLE_EXPERIMENTAL
2 changes: 2 additions & 0 deletions libcxx/modules/std/ranges.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 3 additions & 1 deletion libcxx/modules/std/stop_token.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

export namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
# ifdef _LIBCPP_ENABLE_EXPERIMENTAL
// [stoptoken], class stop_­token
using std::stop_token;

Expand All @@ -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
4 changes: 3 additions & 1 deletion libcxx/test/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
7 changes: 5 additions & 2 deletions libcxx/utils/ci/buildkite-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit d015e48

Please sign in to comment.