[libcxx-commits] [libcxx] 5c150e7 - Revert #76246 and #76083
Daniel Thornburgh via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 18 15:08:06 PST 2024
Author: Daniel Thornburgh
Date: 2024-01-18T15:07:33-08:00
New Revision: 5c150e7eeba9db13cc65b329b3c3537b613ae61d
URL: https://github.com/llvm/llvm-project/commit/5c150e7eeba9db13cc65b329b3c3537b613ae61d
DIFF: https://github.com/llvm/llvm-project/commit/5c150e7eeba9db13cc65b329b3c3537b613ae61d.diff
LOG: Revert #76246 and #76083
These cause test build failures on Windows.
This reverts the following commits:
57ca74843586c9a93c425036c5538aae0a2cfa60
d06ae33ec32122bb526fb35025c1f0cf979f1090
Added:
libcxx/modules/CMakeLists.txt.in
libcxx/test/lit.local.cfg
Modified:
.github/workflows/libcxx-build-and-test.yaml
libcxx/CMakeLists.txt
libcxx/cmake/caches/Generic-cxx26.cmake
libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake
libcxx/cmake/caches/Generic-no-exceptions.cmake
libcxx/cmake/caches/Generic-no-experimental.cmake
libcxx/cmake/caches/Generic-no-filesystem.cmake
libcxx/cmake/caches/Generic-no-localization.cmake
libcxx/cmake/caches/Generic-no-random_device.cmake
libcxx/cmake/caches/Generic-no-threads.cmake
libcxx/cmake/caches/Generic-no-tzdb.cmake
libcxx/cmake/caches/Generic-no-unicode.cmake
libcxx/cmake/caches/Generic-no-wide-characters.cmake
libcxx/docs/Modules.rst
libcxx/docs/ReleaseNotes/18.rst
libcxx/docs/TestingLibcxx.rst
libcxx/modules/CMakeLists.txt
libcxx/test/CMakeLists.txt
libcxx/test/configs/cmake-bridge.cfg.in
libcxx/test/libcxx/module_std.gen.py
libcxx/test/libcxx/module_std_compat.gen.py
libcxx/test/std/modules/std.compat.pass.cpp
libcxx/test/std/modules/std.pass.cpp
libcxx/utils/ci/Dockerfile
libcxx/utils/ci/buildkite-pipeline.yml
libcxx/utils/ci/run-buildbot
libcxx/utils/libcxx/test/config.py
libcxx/utils/libcxx/test/features.py
libcxx/utils/libcxx/test/format.py
libcxx/utils/libcxx/test/modules.py
Removed:
libcxx/test/libcxx/selftest/modules/no-modules.sh.cpp
libcxx/test/libcxx/selftest/modules/std-and-std.compat-module.sh.cpp
libcxx/test/libcxx/selftest/modules/std-module.sh.cpp
libcxx/test/libcxx/selftest/modules/std.compat-module.sh.cpp
################################################################################
diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index 0cab9b841e4ee15..1666a687aa5d047 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -35,6 +35,7 @@ concurrency:
env:
+ CMAKE: "/opt/bin/cmake"
# LLVM POST-BRANCH bump version
# LLVM POST-BRANCH add compiler test for ToT - 1, e.g. "Clang 17"
# LLVM RELEASE bump remove compiler ToT - 3, e.g. "Clang 15"
@@ -168,18 +169,24 @@ jobs:
'bootstrapping-build'
]
machine: [ 'libcxx-runners-8-set' ]
+ std_modules: [ 'OFF' ]
include:
- config: 'generic-cxx26'
machine: libcxx-runners-8-set
+ std_modules: 'ON'
- config: 'generic-asan'
machine: libcxx-runners-8-set
+ std_modules: 'OFF'
- config: 'generic-tsan'
machine: libcxx-runners-8-set
+ std_modules: 'OFF'
- config: 'generic-ubsan'
machine: libcxx-runners-8-set
+ std_modules: 'OFF'
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
- config: 'generic-msan'
machine: libcxx-runners-8-set
+ std_modules: 'OFF'
runs-on: ${{ matrix.machine }}
steps:
- uses: actions/checkout at v4
@@ -189,6 +196,7 @@ jobs:
CC: clang-18
CXX: clang++-18
ENABLE_CLANG_TIDY: "OFF"
+ ENABLE_STD_MODULES: ${{ matrix.std_modules }}
- uses: actions/upload-artifact at v3
if: always()
with:
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 53de53480266b07..a5b516974700886 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -124,6 +124,12 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
the shared library they shipped should turn this on and see `include/__availability`
for more details." OFF)
option(LIBCXX_ENABLE_CLANG_TIDY "Whether to compile and run clang-tidy checks" OFF)
+# TODO MODULES Remove this option and test for the requirements (CMake/Clang) instead.
+option(LIBCXX_ENABLE_STD_MODULES
+ "Whether to enable the building the C++23 `std` module. This feature is
+ experimental and has additional dependencies. Only enable this when
+ interested in testing or developing this module. See
+ https://libcxx.llvm.org/Modules.html for more information." OFF)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in")
@@ -773,6 +779,7 @@ config_define_if_not(LIBCXX_ENABLE_RANDOM_DEVICE _LIBCPP_HAS_NO_RANDOM_DEVICE)
config_define_if_not(LIBCXX_ENABLE_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION)
config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE)
config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS)
+config_define_if_not(LIBCXX_ENABLE_STD_MODULES _LIBCPP_HAS_NO_STD_MODULES)
config_define_if_not(LIBCXX_ENABLE_TIME_ZONE_DATABASE _LIBCPP_HAS_NO_TIME_ZONE_DATABASE)
config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
@@ -856,7 +863,9 @@ endfunction()
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(utils)
-add_subdirectory(modules)
+if (LIBCXX_ENABLE_STD_MODULES)
+ add_subdirectory(modules)
+endif()
set(LIBCXX_TEST_DEPS "cxx_experimental")
@@ -864,7 +873,9 @@ if (LIBCXX_ENABLE_CLANG_TIDY)
list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
endif()
-list(APPEND LIBCXX_TEST_DEPS generate-cxx-modules)
+if (LIBCXX_ENABLE_STD_MODULES)
+ list(APPEND LIBCXX_TEST_DEPS generate-cxx-modules generate-test-module-std)
+endif()
if (LIBCXX_INCLUDE_BENCHMARKS)
add_subdirectory(benchmarks)
diff --git a/libcxx/cmake/caches/Generic-cxx26.cmake b/libcxx/cmake/caches/Generic-cxx26.cmake
index 6ba9482af57851b..f48d72d493c2f51 100644
--- a/libcxx/cmake/caches/Generic-cxx26.cmake
+++ b/libcxx/cmake/caches/Generic-cxx26.cmake
@@ -1,2 +1,3 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_TEST_PARAMS "std=c++26" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
diff --git a/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake b/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake
index 72263dfd84635b5..0487377d4e9ba2c 100644
--- a/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake
+++ b/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake
@@ -1 +1,2 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_HARDENING_MODE "extensive" CACHE STRING "")
diff --git a/libcxx/cmake/caches/Generic-no-exceptions.cmake b/libcxx/cmake/caches/Generic-no-exceptions.cmake
index f0dffef60dba082..f405f7fe9937523 100644
--- a/libcxx/cmake/caches/Generic-no-exceptions.cmake
+++ b/libcxx/cmake/caches/Generic-no-exceptions.cmake
@@ -1,2 +1,3 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
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/cmake/caches/Generic-no-filesystem.cmake b/libcxx/cmake/caches/Generic-no-filesystem.cmake
index 4000f3a3e8ef23b..db62f86854d941a 100644
--- a/libcxx/cmake/caches/Generic-no-filesystem.cmake
+++ b/libcxx/cmake/caches/Generic-no-filesystem.cmake
@@ -1 +1,2 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
diff --git a/libcxx/cmake/caches/Generic-no-localization.cmake b/libcxx/cmake/caches/Generic-no-localization.cmake
index 79d6b44c7139aaf..54a7ec3f1f5b36c 100644
--- a/libcxx/cmake/caches/Generic-no-localization.cmake
+++ b/libcxx/cmake/caches/Generic-no-localization.cmake
@@ -1 +1,2 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
diff --git a/libcxx/cmake/caches/Generic-no-random_device.cmake b/libcxx/cmake/caches/Generic-no-random_device.cmake
index e9b4cc60cc80eac..adfa2458a8edf6d 100644
--- a/libcxx/cmake/caches/Generic-no-random_device.cmake
+++ b/libcxx/cmake/caches/Generic-no-random_device.cmake
@@ -1 +1,2 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
diff --git a/libcxx/cmake/caches/Generic-no-threads.cmake b/libcxx/cmake/caches/Generic-no-threads.cmake
index 616baef1be7bef1..2aeab22915e00cc 100644
--- a/libcxx/cmake/caches/Generic-no-threads.cmake
+++ b/libcxx/cmake/caches/Generic-no-threads.cmake
@@ -1,3 +1,4 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
diff --git a/libcxx/cmake/caches/Generic-no-tzdb.cmake b/libcxx/cmake/caches/Generic-no-tzdb.cmake
index 27c826edfecffbb..c5dc882e584428c 100644
--- a/libcxx/cmake/caches/Generic-no-tzdb.cmake
+++ b/libcxx/cmake/caches/Generic-no-tzdb.cmake
@@ -1 +1,2 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_ENABLE_TIME_ZONE_DATABASE OFF CACHE BOOL "")
diff --git a/libcxx/cmake/caches/Generic-no-unicode.cmake b/libcxx/cmake/caches/Generic-no-unicode.cmake
index 01160bf218981a2..880e2d502ad91b1 100644
--- a/libcxx/cmake/caches/Generic-no-unicode.cmake
+++ b/libcxx/cmake/caches/Generic-no-unicode.cmake
@@ -1 +1,2 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
diff --git a/libcxx/cmake/caches/Generic-no-wide-characters.cmake b/libcxx/cmake/caches/Generic-no-wide-characters.cmake
index 728d41086a38673..5036f6abd52e832 100644
--- a/libcxx/cmake/caches/Generic-no-wide-characters.cmake
+++ b/libcxx/cmake/caches/Generic-no-wide-characters.cmake
@@ -1 +1,2 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
diff --git a/libcxx/docs/Modules.rst b/libcxx/docs/Modules.rst
index 1998cd9d1d267ed..5099e6095582cf6 100644
--- a/libcxx/docs/Modules.rst
+++ b/libcxx/docs/Modules.rst
@@ -115,7 +115,7 @@ directory. First libc++ needs to be build with module support enabled.
$ git clone https://github.com/llvm/llvm-project.git
$ cd llvm-project
$ mkdir build
- $ cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind"
+ $ cmake -G Ninja -S runtimes -B build -DLIBCXX_ENABLE_STD_MODULES=ON -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind"
$ ninja -C build
The above ``build`` directory will be referred to as ``<build>`` in the
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 77b7939a0c0ac96..983363af54e7359 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -89,10 +89,6 @@ Improvements and New Features
- The ``_LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE`` macro has been added to make
the function ``std::shared_ptr<...>::unique()`` available.
-- The cmake option ``LIBCXX_ENABLE_STD_MODULES`` has been removed. The test
- infrastructure no longer depends on a modern CMake, it works with the minimal
- required LLVM version (3.20.0).
-
Deprecations and Removals
-------------------------
diff --git a/libcxx/docs/TestingLibcxx.rst b/libcxx/docs/TestingLibcxx.rst
index 50ee9d4ee400b45..e7645cb5885f14e 100644
--- a/libcxx/docs/TestingLibcxx.rst
+++ b/libcxx/docs/TestingLibcxx.rst
@@ -394,7 +394,7 @@ Custom Directives
~~~~~~~~~~~~~~~~~
Lit has many directives built in (e.g., ``DEFINE``, ``UNSUPPORTED``). In addition to those directives, libc++ adds two additional libc++-specific directives that makes
-writing tests easier. See `libc++-specific Lit Directives`_ for more information about the ``FILE_DEPENDENCIES``, ``ADDITIONAL_COMPILE_FLAGS``, and ``MODULE_DEPENDENCIES`` libc++-specific directives.
+writing tests easier. See `libc++-specific Lit Directives`_ for more information about the ``FILE_DEPENDENCIES`` and ``ADDITIONAL_COMPILE_FLAGS`` libc++-specific directives.
.. _libc++-specific Lit Directives:
.. list-table:: libc++-specific Lit Directives
@@ -417,13 +417,6 @@ writing tests easier. See `libc++-specific Lit Directives`_ for more information
- The additional compiler flags specified by a space-separated list to the ``ADDITIONAL_COMPILE_FLAGS`` libc++-specific Lit directive will be added to the end of the ``%{compile_flags}``
substitution for the test that contains it. This libc++-specific Lit directive makes it possible to add special compilation flags without having to resort to writing a ``.sh.cpp`` test (see
`Lit Meaning of libc++ Test Filenames`_), more powerful but perhaps overkill.
- * - ``MODULE_DEPENDENCIES``
- - ``// MODULE_DEPENDENCIES: std std.compat``
- - This directive will build the required C++23 standard library
- modules and add the additional compiler flags in
- %{compile_flags}. (Libc++ offers these modules in C++20 as an
- extension.)
-
Benchmarks
==========
diff --git a/libcxx/modules/CMakeLists.txt b/libcxx/modules/CMakeLists.txt
index 31fbadf449f7734..fae6448a7eec84b 100644
--- a/libcxx/modules/CMakeLists.txt
+++ b/libcxx/modules/CMakeLists.txt
@@ -1,3 +1,8 @@
+if (CMAKE_VERSION VERSION_LESS 3.26)
+ message(WARNING "The libc++ modules won't be available because the CMake version is too old. Update to CMake 3.26 or later.")
+ return()
+endif()
+
# 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]
set(LIBCXX_MODULE_STD_SOURCES
@@ -137,6 +142,28 @@ set(LIBCXX_MODULE_STD_COMPAT_SOURCES
std.compat/cwctype.inc
)
+# TODO MODULES the CMakeLists.txt in the install directory is only temporary
+# When that is removed the configured file can use the substitution
+# LIBCXX_GENERATED_INCLUDE_TARGET_DIR avoiding this set.
+# Also clean up the parts needed to generate the install version.
+# - LIBCXX_GENERATED_INCLUDE_DIR contains the libc++ headers
+# - LIBCXX_GENERATED_INCLUDE_TARGET_DIR contains the libc++ site config
+if ("${LIBCXX_GENERATED_INCLUDE_DIR}" STREQUAL "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}")
+ # This typically happens when the target is not installed.
+ set(LIBCXX_CONFIGURED_INCLUDE_DIRS "${LIBCXX_GENERATED_INCLUDE_DIR}")
+else()
+ # It's important that the arch directory be included first so that its header files
+ # which interpose on the default include dir be included instead of the default ones.
+ set(LIBCXX_CONFIGURED_INCLUDE_DIRS
+ "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR};${LIBCXX_GENERATED_INCLUDE_DIR}"
+ )
+endif()
+configure_file(
+ "CMakeLists.txt.in"
+ "${LIBCXX_GENERATED_MODULE_DIR}/CMakeLists.txt"
+ @ONLY
+)
+
set(LIBCXX_MODULE_STD_INCLUDE_SOURCES)
foreach(file ${LIBCXX_MODULE_STD_SOURCES})
set(
@@ -166,6 +193,7 @@ configure_file(
)
set(_all_modules)
+list(APPEND _all_modules "${LIBCXX_GENERATED_MODULE_DIR}/CMakeLists.txt")
list(APPEND _all_modules "${LIBCXX_GENERATED_MODULE_DIR}/std.cppm")
list(APPEND _all_modules "${LIBCXX_GENERATED_MODULE_DIR}/std.compat.cppm")
foreach(file ${LIBCXX_MODULE_STD_SOURCES} ${LIBCXX_MODULE_STD_COMPAT_SOURCES})
diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
new file mode 100644
index 000000000000000..98168673ebfe9c6
--- /dev/null
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -0,0 +1,86 @@
+cmake_minimum_required(VERSION 3.26)
+
+project(libc++-modules LANGUAGES CXX)
+
+# Enable CMake's module support
+if(CMAKE_VERSION VERSION_LESS "3.28.0")
+ if(CMAKE_VERSION VERSION_LESS "3.27.0")
+ set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a")
+ else()
+ set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7")
+ endif()
+ set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+else()
+ cmake_policy(VERSION 3.28)
+endif()
+
+# Default to C++ extensions being off. Libc++'s modules support have trouble
+# with extensions right now.
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+# Propagates the CMake options to the modules.
+#
+# This uses the std module hard-coded since the std.compat module does not
+# depend on these flags.
+macro(compile_define_if_not condition def)
+ if (NOT ${condition})
+ target_compile_definitions(std PRIVATE ${def})
+ endif()
+endmacro()
+macro(compile_define_if condition def)
+ if (${condition})
+ target_compile_definitions(std PRIVATE ${def})
+ endif()
+endmacro()
+
+### STD
+
+add_library(std)
+target_sources(std
+ PUBLIC FILE_SET cxx_modules TYPE CXX_MODULES FILES
+ std.cppm
+)
+
+target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+
+if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
+ target_compile_options(std PUBLIC -fno-exceptions)
+endif()
+
+target_compile_options(std
+ PUBLIC
+ -nostdinc++
+ -Wno-reserved-module-identifier
+ -Wno-reserved-user-defined-literal
+ @LIBCXX_COMPILE_FLAGS@
+)
+set_target_properties(std
+ PROPERTIES
+ OUTPUT_NAME "c++std"
+)
+
+### STD.COMPAT
+
+add_library(std.compat)
+target_sources(std.compat
+ PUBLIC FILE_SET cxx_modules TYPE CXX_MODULES FILES
+ std.compat.cppm
+)
+
+target_include_directories(std.compat SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+
+if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
+ target_compile_options(std.compat PUBLIC -fno-exceptions)
+endif()
+
+target_compile_options(std.compat
+ PUBLIC
+ -nostdinc++
+ -Wno-reserved-module-identifier
+ -Wno-reserved-user-defined-literal
+ @LIBCXX_COMPILE_FLAGS@
+)
+set_target_properties(std.compat
+ PROPERTIES
+ OUTPUT_NAME "c++std.compat"
+)
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 52620fc55feeb7e..48dd233462ab3b7 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -87,6 +87,31 @@ if (LIBCXX_INCLUDE_TESTS)
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS cxx-test-depends)
+ if(LIBCXX_ENABLE_STD_MODULES)
+ # Generates the modules used in the test.
+ # Note the test will regenerate this with the proper setting
+ # - the right DCMAKE_CXX_STANDARD
+ # - the right test compilation flags
+ # Since modules depend on these flags there currently is no way to
+ # avoid generating these for the tests. The advantage of the
+ # pre generation is that less build information needs to be shared
+ # in the bridge.
+ add_custom_command(
+ OUTPUT "${CMAKE_BINARY_DIR}/test/__config_module__/CMakeCache.txt"
+ COMMAND
+ ${CMAKE_COMMAND}
+ "-G${CMAKE_GENERATOR}"
+ "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}"
+ "-B${CMAKE_BINARY_DIR}/test/__config_module__"
+ "-H${LIBCXX_GENERATED_MODULE_DIR}"
+ "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
+ "-DCMAKE_CXX_STANDARD=23"
+ "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
+ )
+ add_custom_target(generate-test-module-std
+ DEPENDS "${CMAKE_BINARY_DIR}/test/__config_module__/CMakeCache.txt"
+ COMMENT "Builds generic module std.")
+ endif()
endif()
if (LIBCXX_GENERATE_COVERAGE)
diff --git a/libcxx/test/configs/cmake-bridge.cfg.in b/libcxx/test/configs/cmake-bridge.cfg.in
index 72b2ddf378bb644..0e3c3040c964462 100644
--- a/libcxx/test/configs/cmake-bridge.cfg.in
+++ b/libcxx/test/configs/cmake-bridge.cfg.in
@@ -31,3 +31,10 @@ config.substitutions.append(('%{target-include}', '@LIBCXX_GENERATED_INCLUDE_TAR
config.substitutions.append(('%{lib}', '@LIBCXX_LIBRARY_DIR@'))
config.substitutions.append(('%{module}', '@LIBCXX_GENERATED_MODULE_DIR@'))
config.substitutions.append(('%{test-tools}', '@LIBCXX_TEST_TOOLS_PATH@'))
+
+# The test needs to manually rebuild the module. The compiler flags used in the
+# test need to be the same as the compiler flags used to generate the module.
+# In the future, when CMake can generated modules this may no longer be
+# necessary.
+# TODO MODULES whether it's possible to remove this substitution.
+config.substitutions.append(('%{cmake}', '@CMAKE_COMMAND@'))
diff --git a/libcxx/test/libcxx/module_std.gen.py b/libcxx/test/libcxx/module_std.gen.py
index a9a05a0cd74e614..8e03d6e5b5b5235 100644
--- a/libcxx/test/libcxx/module_std.gen.py
+++ b/libcxx/test/libcxx/module_std.gen.py
@@ -30,7 +30,6 @@
"%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin",
"%{cxx}",
"%{flags} %{compile_flags}",
- "std",
)
diff --git a/libcxx/test/libcxx/module_std_compat.gen.py b/libcxx/test/libcxx/module_std_compat.gen.py
index 2866066ccedc89c..c4792db3d71e624 100644
--- a/libcxx/test/libcxx/module_std_compat.gen.py
+++ b/libcxx/test/libcxx/module_std_compat.gen.py
@@ -30,7 +30,6 @@
"%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin",
"%{cxx}",
"%{flags} %{compile_flags}",
- "std.compat",
)
diff --git a/libcxx/test/libcxx/selftest/modules/no-modules.sh.cpp b/libcxx/test/libcxx/selftest/modules/no-modules.sh.cpp
deleted file mode 100644
index 74e65a9072f7b65..000000000000000
--- a/libcxx/test/libcxx/selftest/modules/no-modules.sh.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// Make sure that the compile flags contain no module information.
-
-// MODULE_DEPENDENCIES:
-
-// RUN: echo "%{compile_flags}" | grep -v "std.pcm"
-// RUN: echo "%{compile_flags}" | grep -v "std.compat.pcm"
diff --git a/libcxx/test/libcxx/selftest/modules/std-and-std.compat-module.sh.cpp b/libcxx/test/libcxx/selftest/modules/std-and-std.compat-module.sh.cpp
deleted file mode 100644
index 81241d7f43f9a13..000000000000000
--- a/libcxx/test/libcxx/selftest/modules/std-and-std.compat-module.sh.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: clang-modules-build
-// UNSUPPORTED: gcc
-
-// XFAIL: has-no-cxx-module-support
-
-// picolibc does not provide the required timespec_get function, and the
-// "using-if-exists" mechanism apparently did not work here.
-// XFAIL: LIBCXX-PICOLIBC-FIXME
-
-// Make sure that the compile flags contain the expected elements.
-// The tests only look for the expected components and not the exact flags.
-// Otherwise changing the location of the module would break this test.
-
-// MODULE_DEPENDENCIES: std std.compat
-
-// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std=.*/std.pcm .*/std.pcm"
-// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std.compat=.*/std.compat.pcm .*/std.compat.pcm"
diff --git a/libcxx/test/libcxx/selftest/modules/std-module.sh.cpp b/libcxx/test/libcxx/selftest/modules/std-module.sh.cpp
deleted file mode 100644
index ec43994fa1ef970..000000000000000
--- a/libcxx/test/libcxx/selftest/modules/std-module.sh.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: clang-modules-build
-// UNSUPPORTED: gcc
-
-// XFAIL: has-no-cxx-module-support
-
-// Make sure that the compile flags contain the expected elements.
-// The tests only look for the expected components and not the exact flags.
-// Otherwise changing the location of the module would break this test.
-
-// MODULE_DEPENDENCIES: std
-
-// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std=.*/std.pcm .*/std.pcm"
-
-// The std module should not provide the std.compat module
-// RUN: echo "%{compile_flags}" | grep -v "std.compat.pcm"
diff --git a/libcxx/test/libcxx/selftest/modules/std.compat-module.sh.cpp b/libcxx/test/libcxx/selftest/modules/std.compat-module.sh.cpp
deleted file mode 100644
index b74c2f1a249fcc1..000000000000000
--- a/libcxx/test/libcxx/selftest/modules/std.compat-module.sh.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: clang-modules-build
-// UNSUPPORTED: gcc
-
-// XFAIL: has-no-cxx-module-support
-
-// picolibc does not provide the required timespec_get function, and the
-// "using-if-exists" mechanism apparently did not work here.
-// XFAIL: LIBCXX-PICOLIBC-FIXME
-
-// Make sure that the compile flags contain the expected elements.
-// The tests only look for the expected components and not the exact flags.
-// Otherwise changing the location of the module would break this test.
-
-// MODULE_DEPENDENCIES: std.compat
-
-// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std.compat=.*/std.compat.pcm .*/std.compat.pcm"
-
-// It's unspecified whether std.compat is built on the std module.
-// Therefore don't test its presence
diff --git a/libcxx/test/lit.local.cfg b/libcxx/test/lit.local.cfg
new file mode 100644
index 000000000000000..1ee9086ee22e3c5
--- /dev/null
+++ b/libcxx/test/lit.local.cfg
@@ -0,0 +1,83 @@
+# ===----------------------------------------------------------------------===##
+#
+# 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
+#
+# ===----------------------------------------------------------------------===##
+
+# This configuration builds the C++23 std module.
+# It is build when the current lit configuration supports modules.
+#
+# TODO MODULES Evaluate whether this file can be removed when CMake supports
+# modules in libc++.
+
+import os
+import site
+import subprocess
+import libcxx.test.params, libcxx.test.config, libcxx.test.dsl
+
+
+def getSubstitution(substitution, config):
+ for orig, replacement in config.substitutions:
+ if orig == substitution:
+ return replacement
+ raise ValueError("Substitution {} is not in the config.".format(substitution))
+
+
+def appendToSubstitution(substitutions, key, value):
+ return [(k, v + " " + value) if k == key else (k, v) for (k, v) in substitutions]
+
+
+std = getSubstitution("%{cxx_std}", config)
+if std == "cxx26":
+ std = "26"
+elif std == "cxx23":
+ std = "23"
+elif std == "cxx20":
+ std = "20"
+else:
+ std = ""
+
+if (
+ std
+ and not "libcpp-has-no-std-modules" in config.available_features
+ and not "clang-modules-build" in config.available_features
+):
+ build = os.path.join(config.test_exec_root, "__config_module__")
+ config.substitutions = appendToSubstitution(
+ config.substitutions,
+ "%{compile_flags}",
+ "-fprebuilt-module-path="
+ + os.path.join(config.test_exec_root, "__config_module__/CMakeFiles/std.dir"),
+ )
+
+ 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],
+ env={},
+ )
+ subprocess.check_call([cmake, "--build", build, "--", "-v"], env={})
+ config.substitutions = appendToSubstitution(
+ config.substitutions,
+ "%{link_flags}",
+ os.path.join(build, "libc++std.a"),
+ )
+
+ config.substitutions = appendToSubstitution(
+ config.substitutions,
+ "%{compile_flags}",
+ "-fprebuilt-module-path="
+ + os.path.join(
+ config.test_exec_root, "__config_module__/CMakeFiles/std.compat.dir"
+ ),
+ )
+ config.substitutions = appendToSubstitution(
+ config.substitutions,
+ "%{link_flags}",
+ os.path.join(build, "libc++std.compat.a"),
+ )
diff --git a/libcxx/test/std/modules/std.compat.pass.cpp b/libcxx/test/std/modules/std.compat.pass.cpp
index 40ea979e2734653..9a2f330d722edde 100644
--- a/libcxx/test/std/modules/std.compat.pass.cpp
+++ b/libcxx/test/std/modules/std.compat.pass.cpp
@@ -7,10 +7,9 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// UNSUPPORTED: clang-modules-build
-// UNSUPPORTED: gcc
-// XFAIL: has-no-cxx-module-support
+// UNSUPPORTED: libcpp-has-no-std-modules
+// UNSUPPORTED: clang-modules-build
// picolibc does not provide the required timespec_get function, and the
// "using-if-exists" mechanism apparently did not work here.
@@ -18,8 +17,6 @@
// A minimal test to validate import works.
-// MODULE_DEPENDENCIES: std.compat
-
import std.compat;
int main(int, char**) { return !(::strlen("Hello modular world") == 19); }
diff --git a/libcxx/test/std/modules/std.pass.cpp b/libcxx/test/std/modules/std.pass.cpp
index ca05825b3a18632..8ec3ce27322b743 100644
--- a/libcxx/test/std/modules/std.pass.cpp
+++ b/libcxx/test/std/modules/std.pass.cpp
@@ -7,15 +7,12 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-// UNSUPPORTED: clang-modules-build
-// UNSUPPORTED: gcc
-// XFAIL: has-no-cxx-module-support
+// UNSUPPORTED: libcpp-has-no-std-modules
+// UNSUPPORTED: clang-modules-build
// A minimal test to validate import works.
-// MODULE_DEPENDENCIES: std
-
import std;
int main(int, char**) {
diff --git a/libcxx/utils/ci/Dockerfile b/libcxx/utils/ci/Dockerfile
index 225de937cc869a0..e4bda4f06742c1c 100644
--- a/libcxx/utils/ci/Dockerfile
+++ b/libcxx/utils/ci/Dockerfile
@@ -152,6 +152,17 @@ RUN <<EOF
wget https://github.com/Kitware/CMake/releases/download/v3.21.1/cmake-3.21.1-linux-x86_64.sh -O /tmp/install-cmake.sh
sudo bash /tmp/install-cmake.sh --prefix=/usr --exclude-subdir --skip-license
rm /tmp/install-cmake.sh
+
+ # Install a newer CMake for modules
+ # TODO Remove the duplicated installation when all runtimes can be build with CMake 3.28.
+ wget https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.sh -O /tmp/install-cmake.sh
+ sudo bash /tmp/install-cmake.sh --prefix=/opt --exclude-subdir --skip-license
+ rm /tmp/install-cmake.sh
+
+ wget https://github.com/Kitware/CMake/releases/download/v3.28.0-rc4/cmake-3.28.0-rc4-linux-x86_64.sh -O /tmp/install-cmake.sh
+ sudo mkdir /opt/cmake-3.28
+ sudo bash /tmp/install-cmake.sh --prefix=/opt/cmake-3.28 --exclude-subdir --skip-license
+ rm /tmp/install-cmake.sh
EOF
# ===----------------------------------------------------------------------===##
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index a7c44dab7093911..a48f8524ef63c44 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -48,6 +48,7 @@ environment_definitions:
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
CC: clang-${LLVM_HEAD_VERSION}
CXX: clang++-${LLVM_HEAD_VERSION}
+ CMAKE: /opt/bin/cmake
_absolute_path_clang: &absolute_path_clang
# Note modules require and absolute path for clang-scan-deps
@@ -261,6 +262,7 @@ steps:
env:
CC: clang16
CXX: clang++16
+ ENABLE_STD_MODULES: 'Off'
agents:
queue: libcxx-builders
os: freebsd
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index ddfe53d2d8bd635..221b497be6d9547 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -47,6 +47,11 @@ CLANG_FORMAT The clang-format binary to use when generating the format
ENABLE_CLANG_TIDY Whether to compile and run clang-tidy checks. This variable
is optional.
+ENABLE_STD_MODULES Whether to enable or disable building the C++23 std
+ modules. This variable is optional.
+ TODO MODULES remove when all supported compilers support
+ modules.
+
EOF
}
@@ -115,6 +120,10 @@ if [ -z "${ENABLE_CLANG_TIDY}" ]; then
ENABLE_CLANG_TIDY=Off
fi
+if [ -n "${ENABLE_STD_MODULES}" ]; then
+ ENABLE_STD_MODULES="-DLIBCXX_ENABLE_STD_MODULES=${ENABLE_STD_MODULES}"
+fi
+
function generate-cmake-base() {
echo "--- Generating CMake"
${CMAKE} \
@@ -127,6 +136,7 @@ function generate-cmake-base() {
-DLIBCXXABI_ENABLE_WERROR=YES \
-DLIBUNWIND_ENABLE_WERROR=YES \
-DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
+ ${ENABLE_STD_MODULES} \
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
"${@}"
}
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 9a71c494030d700..63cfa1b67781981 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -16,10 +16,6 @@ def _getSubstitution(substitution, config):
raise ValueError("Substitution {} is not in the config.".format(substitution))
-def _appendToSubstitution(substitutions, key, value):
- return [(k, v + " " + value) if k == key else (k, v) for (k, v) in substitutions]
-
-
def configure(parameters, features, config, lit_config):
note = lambda s: lit_config.note("({}) {}".format(config.name, s))
config.environment = dict(os.environ)
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 1983bc91ab171b8..e5b561d7feeb57a 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -317,17 +317,6 @@ def _getAndroidDeviceApi(cfg):
AddSubstitution("%{clang-tidy}", lambda cfg: _getSuitableClangTidy(cfg))
],
),
- # Whether module support for the platform is available.
- Feature(
- name="has-no-cxx-module-support",
- # The libc of these platforms have functions with internal linkage.
- # This is not allowed per C11 7.1.2 Standard headers/6
- # Any declaration of a library function shall have external linkage.
- when=lambda cfg: "__ANDROID__" in compilerMacros(cfg)
- or platform.system().lower().startswith("aix")
- # Avoid building on platforms that don't support modules properly.
- or not hasCompileFlag(cfg, "-Wno-reserved-module-identifier"),
- ),
]
# Deduce and add the test features that that are implied by the #defines in
@@ -354,6 +343,7 @@ def _getAndroidDeviceApi(cfg):
"_LIBCPP_HAS_NO_WIDE_CHARACTERS": "no-wide-characters",
"_LIBCPP_HAS_NO_TIME_ZONE_DATABASE": "no-tzdb",
"_LIBCPP_HAS_NO_UNICODE": "libcpp-has-no-unicode",
+ "_LIBCPP_HAS_NO_STD_MODULES": "libcpp-has-no-std-modules",
"_LIBCPP_PSTL_CPU_BACKEND_LIBDISPATCH": "libcpp-pstl-cpu-backend-libdispatch",
}
for macro, feature in macros.items():
diff --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py
index c605e8796ac5420..5d84711bf5d2821 100644
--- a/libcxx/utils/libcxx/test/format.py
+++ b/libcxx/utils/libcxx/test/format.py
@@ -7,7 +7,6 @@
# ===----------------------------------------------------------------------===##
import lit
-import libcxx.test.config as config
import lit.formats
import os
import re
@@ -53,14 +52,6 @@ def _executeScriptInternal(test, litConfig, commands):
return (out, err, exitCode, timeoutInfo, parsedCommands)
-def _validateModuleDependencies(modules):
- for m in modules:
- if m not in ("std", "std.compat"):
- raise RuntimeError(
- f"Invalid module dependency '{m}', only 'std' and 'std.compat' are valid"
- )
-
-
def parseScript(test, preamble):
"""
Extract the script from a test, with substitutions applied.
@@ -100,8 +91,6 @@ def parseScript(test, preamble):
# Parse the test file, including custom directives
additionalCompileFlags = []
fileDependencies = []
- modules = [] # The enabled modules
- moduleCompileFlags = [] # The compilation flags to use modules
parsers = [
lit.TestRunner.IntegratedTestKeywordParser(
"FILE_DEPENDENCIES:",
@@ -113,11 +102,6 @@ def parseScript(test, preamble):
lit.TestRunner.ParserKind.SPACE_LIST,
initial_value=additionalCompileFlags,
),
- lit.TestRunner.IntegratedTestKeywordParser(
- "MODULE_DEPENDENCIES:",
- lit.TestRunner.ParserKind.SPACE_LIST,
- initial_value=modules,
- ),
]
# Add conditional parsers for ADDITIONAL_COMPILE_FLAGS. This should be replaced by first
@@ -148,53 +132,12 @@ def parseScript(test, preamble):
script += scriptInTest
# Add compile flags specified with ADDITIONAL_COMPILE_FLAGS.
- # Modules need to be built with the same compilation flags as the
- # test. So add these flags before adding the modules.
- substitutions = config._appendToSubstitution(
- substitutions, "%{compile_flags}", " ".join(additionalCompileFlags)
- )
-
- if modules:
- _validateModuleDependencies(modules)
-
- # The moduleCompileFlags are added to the %{compile_flags}, but
- # the modules need to be built without these flags. So expand the
- # %{compile_flags} eagerly and hardcode them in the build script.
- compileFlags = config._getSubstitution("%{compile_flags}", test.config)
-
- # Building the modules needs to happen before the other script
- # commands are executed. Therefore the commands are added to the
- # front of the list.
- if "std.compat" in modules:
- script.insert(
- 0,
- "%dbg(MODULE std.compat) %{cxx} %{flags} "
- f"{compileFlags} "
- "-Wno-reserved-module-identifier -Wno-reserved-user-defined-literal "
- "--precompile -o %T/std.compat.pcm -c %{module}/std.compat.cppm",
- )
- moduleCompileFlags.extend(
- ["-fmodule-file=std.compat=%T/std.compat.pcm", "%T/std.compat.pcm"]
- )
-
- # Make sure the std module is built before std.compat. Libc++'s
- # std.compat module depends on the std module. It is not
- # known whether the compiler expects the modules in the order of
- # their dependencies. However it's trivial to provide them in
- # that order.
- script.insert(
- 0,
- "%dbg(MODULE std) %{cxx} %{flags} "
- f"{compileFlags} "
- "-Wno-reserved-module-identifier -Wno-reserved-user-defined-literal "
- "--precompile -o %T/std.pcm -c %{module}/std.cppm",
- )
- moduleCompileFlags.extend(["-fmodule-file=std=%T/std.pcm", "%T/std.pcm"])
-
- # Add compile flags required for the modules.
- substitutions = config._appendToSubstitution(
- substitutions, "%{compile_flags}", " ".join(moduleCompileFlags)
- )
+ substitutions = [
+ (s, x + " " + " ".join(additionalCompileFlags))
+ if s == "%{compile_flags}"
+ else (s, x)
+ for (s, x) in substitutions
+ ]
# Perform substitutions in the script itself.
script = lit.TestRunner.applySubstitutions(
diff --git a/libcxx/utils/libcxx/test/modules.py b/libcxx/utils/libcxx/test/modules.py
index 3e9fcae4c5389ae..bd19fac314dd9b5 100644
--- a/libcxx/utils/libcxx/test/modules.py
+++ b/libcxx/utils/libcxx/test/modules.py
@@ -113,12 +113,12 @@ class module_test_generator:
clang_tidy_plugin: str
compiler: str
compiler_flags: str
- module: str
def write_lit_configuration(self):
print(
f"""\
// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: libcpp-has-no-std-modules
// UNSUPPORTED: clang-modules-build
// REQUIRES: has-clang-tidy
@@ -126,8 +126,6 @@ def write_lit_configuration(self):
// The GCC compiler flags are not always compatible with clang-tidy.
// UNSUPPORTED: gcc
-// MODULE_DEPENDENCIES: {self.module}
-
// RUN: echo -n > {self.tmp_prefix}.all_partitions
"""
)
More information about the libcxx-commits
mailing list