These cause test build failures on Windows. This reverts the following commits: 57ca74843586c9a93c425036c5538aae0a2cfa60 d06ae33ec32122bb526fb35025c1f0cf979f1090
This commit is contained in:
parent
8434e5d0a1
commit
5c150e7eeb
8
.github/workflows/libcxx-build-and-test.yaml
vendored
8
.github/workflows/libcxx-build-and-test.yaml
vendored
@ -35,6 +35,7 @@ concurrency:
|
|||||||
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
CMAKE: "/opt/bin/cmake"
|
||||||
# LLVM POST-BRANCH bump version
|
# LLVM POST-BRANCH bump version
|
||||||
# LLVM POST-BRANCH add compiler test for ToT - 1, e.g. "Clang 17"
|
# LLVM POST-BRANCH add compiler test for ToT - 1, e.g. "Clang 17"
|
||||||
# LLVM RELEASE bump remove compiler ToT - 3, e.g. "Clang 15"
|
# LLVM RELEASE bump remove compiler ToT - 3, e.g. "Clang 15"
|
||||||
@ -168,18 +169,24 @@ jobs:
|
|||||||
'bootstrapping-build'
|
'bootstrapping-build'
|
||||||
]
|
]
|
||||||
machine: [ 'libcxx-runners-8-set' ]
|
machine: [ 'libcxx-runners-8-set' ]
|
||||||
|
std_modules: [ 'OFF' ]
|
||||||
include:
|
include:
|
||||||
- config: 'generic-cxx26'
|
- config: 'generic-cxx26'
|
||||||
machine: libcxx-runners-8-set
|
machine: libcxx-runners-8-set
|
||||||
|
std_modules: 'ON'
|
||||||
- config: 'generic-asan'
|
- config: 'generic-asan'
|
||||||
machine: libcxx-runners-8-set
|
machine: libcxx-runners-8-set
|
||||||
|
std_modules: 'OFF'
|
||||||
- config: 'generic-tsan'
|
- config: 'generic-tsan'
|
||||||
machine: libcxx-runners-8-set
|
machine: libcxx-runners-8-set
|
||||||
|
std_modules: 'OFF'
|
||||||
- config: 'generic-ubsan'
|
- config: 'generic-ubsan'
|
||||||
machine: libcxx-runners-8-set
|
machine: libcxx-runners-8-set
|
||||||
|
std_modules: 'OFF'
|
||||||
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
|
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
|
||||||
- config: 'generic-msan'
|
- config: 'generic-msan'
|
||||||
machine: libcxx-runners-8-set
|
machine: libcxx-runners-8-set
|
||||||
|
std_modules: 'OFF'
|
||||||
runs-on: ${{ matrix.machine }}
|
runs-on: ${{ matrix.machine }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@ -189,6 +196,7 @@ jobs:
|
|||||||
CC: clang-18
|
CC: clang-18
|
||||||
CXX: clang++-18
|
CXX: clang++-18
|
||||||
ENABLE_CLANG_TIDY: "OFF"
|
ENABLE_CLANG_TIDY: "OFF"
|
||||||
|
ENABLE_STD_MODULES: ${{ matrix.std_modules }}
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
|
@ -124,6 +124,12 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
|
|||||||
the shared library they shipped should turn this on and see `include/__availability`
|
the shared library they shipped should turn this on and see `include/__availability`
|
||||||
for more details." OFF)
|
for more details." OFF)
|
||||||
option(LIBCXX_ENABLE_CLANG_TIDY "Whether to compile and run clang-tidy checks" 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")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in")
|
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_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION)
|
||||||
config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE)
|
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_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_TIME_ZONE_DATABASE _LIBCPP_HAS_NO_TIME_ZONE_DATABASE)
|
||||||
config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
|
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(include)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(utils)
|
add_subdirectory(utils)
|
||||||
add_subdirectory(modules)
|
if (LIBCXX_ENABLE_STD_MODULES)
|
||||||
|
add_subdirectory(modules)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(LIBCXX_TEST_DEPS "cxx_experimental")
|
set(LIBCXX_TEST_DEPS "cxx_experimental")
|
||||||
|
|
||||||
@ -864,7 +873,9 @@ if (LIBCXX_ENABLE_CLANG_TIDY)
|
|||||||
list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
|
list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
|
||||||
endif()
|
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)
|
if (LIBCXX_INCLUDE_BENCHMARKS)
|
||||||
add_subdirectory(benchmarks)
|
add_subdirectory(benchmarks)
|
||||||
|
@ -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(LIBCXX_TEST_PARAMS "std=c++26" CACHE STRING "")
|
||||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
|
||||||
set(LIBCXX_HARDENING_MODE "extensive" CACHE STRING "")
|
set(LIBCXX_HARDENING_MODE "extensive" CACHE STRING "")
|
||||||
|
@ -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(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||||
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||||
|
@ -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(LIBCXX_TEST_PARAMS "enable_experimental=False" CACHE STRING "")
|
||||||
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
|
||||||
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
|
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
|
||||||
set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
|
set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
|
||||||
|
@ -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 "")
|
set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
|
||||||
|
@ -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(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
|
||||||
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
|
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
|
||||||
set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
|
set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
|
||||||
|
@ -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 "")
|
set(LIBCXX_ENABLE_TIME_ZONE_DATABASE OFF CACHE BOOL "")
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
|
||||||
set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
|
set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
|
||||||
|
@ -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 "")
|
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
|
||||||
|
@ -115,7 +115,7 @@ directory. First libc++ needs to be build with module support enabled.
|
|||||||
$ git clone https://github.com/llvm/llvm-project.git
|
$ git clone https://github.com/llvm/llvm-project.git
|
||||||
$ cd llvm-project
|
$ cd llvm-project
|
||||||
$ mkdir build
|
$ 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
|
$ ninja -C build
|
||||||
|
|
||||||
The above ``build`` directory will be referred to as ``<build>`` in the
|
The above ``build`` directory will be referred to as ``<build>`` in the
|
||||||
|
@ -89,10 +89,6 @@ Improvements and New Features
|
|||||||
- The ``_LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE`` macro has been added to make
|
- The ``_LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE`` macro has been added to make
|
||||||
the function ``std::shared_ptr<...>::unique()`` available.
|
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
|
Deprecations and Removals
|
||||||
-------------------------
|
-------------------------
|
||||||
|
@ -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
|
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:
|
.. _libc++-specific Lit Directives:
|
||||||
.. list-table:: 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}``
|
- 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
|
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.
|
`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
|
Benchmarks
|
||||||
==========
|
==========
|
||||||
|
@ -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]
|
# 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]
|
# and the headers of Table 25: C++ headers for C library facilities [tab:headers.cpp.c]
|
||||||
set(LIBCXX_MODULE_STD_SOURCES
|
set(LIBCXX_MODULE_STD_SOURCES
|
||||||
@ -137,6 +142,28 @@ set(LIBCXX_MODULE_STD_COMPAT_SOURCES
|
|||||||
std.compat/cwctype.inc
|
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)
|
set(LIBCXX_MODULE_STD_INCLUDE_SOURCES)
|
||||||
foreach(file ${LIBCXX_MODULE_STD_SOURCES})
|
foreach(file ${LIBCXX_MODULE_STD_SOURCES})
|
||||||
set(
|
set(
|
||||||
@ -166,6 +193,7 @@ configure_file(
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(_all_modules)
|
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.cppm")
|
||||||
list(APPEND _all_modules "${LIBCXX_GENERATED_MODULE_DIR}/std.compat.cppm")
|
list(APPEND _all_modules "${LIBCXX_GENERATED_MODULE_DIR}/std.compat.cppm")
|
||||||
foreach(file ${LIBCXX_MODULE_STD_SOURCES} ${LIBCXX_MODULE_STD_COMPAT_SOURCES})
|
foreach(file ${LIBCXX_MODULE_STD_SOURCES} ${LIBCXX_MODULE_STD_COMPAT_SOURCES})
|
||||||
|
86
libcxx/modules/CMakeLists.txt.in
Normal file
86
libcxx/modules/CMakeLists.txt.in
Normal file
@ -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"
|
||||||
|
)
|
@ -87,6 +87,31 @@ if (LIBCXX_INCLUDE_TESTS)
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
DEPENDS cxx-test-depends)
|
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()
|
endif()
|
||||||
|
|
||||||
if (LIBCXX_GENERATE_COVERAGE)
|
if (LIBCXX_GENERATE_COVERAGE)
|
||||||
|
@ -31,3 +31,10 @@ config.substitutions.append(('%{target-include}', '@LIBCXX_GENERATED_INCLUDE_TAR
|
|||||||
config.substitutions.append(('%{lib}', '@LIBCXX_LIBRARY_DIR@'))
|
config.substitutions.append(('%{lib}', '@LIBCXX_LIBRARY_DIR@'))
|
||||||
config.substitutions.append(('%{module}', '@LIBCXX_GENERATED_MODULE_DIR@'))
|
config.substitutions.append(('%{module}', '@LIBCXX_GENERATED_MODULE_DIR@'))
|
||||||
config.substitutions.append(('%{test-tools}', '@LIBCXX_TEST_TOOLS_PATH@'))
|
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@'))
|
||||||
|
@ -30,7 +30,6 @@ generator = module_test_generator(
|
|||||||
"%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin",
|
"%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin",
|
||||||
"%{cxx}",
|
"%{cxx}",
|
||||||
"%{flags} %{compile_flags}",
|
"%{flags} %{compile_flags}",
|
||||||
"std",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ generator = module_test_generator(
|
|||||||
"%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin",
|
"%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin",
|
||||||
"%{cxx}",
|
"%{cxx}",
|
||||||
"%{flags} %{compile_flags}",
|
"%{flags} %{compile_flags}",
|
||||||
"std.compat",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -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"
|
|
@ -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"
|
|
@ -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"
|
|
@ -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
|
|
83
libcxx/test/lit.local.cfg
Normal file
83
libcxx/test/lit.local.cfg
Normal file
@ -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"),
|
||||||
|
)
|
@ -7,10 +7,9 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
// 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
|
// picolibc does not provide the required timespec_get function, and the
|
||||||
// "using-if-exists" mechanism apparently did not work here.
|
// "using-if-exists" mechanism apparently did not work here.
|
||||||
@ -18,8 +17,6 @@
|
|||||||
|
|
||||||
// A minimal test to validate import works.
|
// A minimal test to validate import works.
|
||||||
|
|
||||||
// MODULE_DEPENDENCIES: std.compat
|
|
||||||
|
|
||||||
import std.compat;
|
import std.compat;
|
||||||
|
|
||||||
int main(int, char**) { return !(::strlen("Hello modular world") == 19); }
|
int main(int, char**) { return !(::strlen("Hello modular world") == 19); }
|
||||||
|
@ -7,15 +7,12 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
// 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.
|
// A minimal test to validate import works.
|
||||||
|
|
||||||
// MODULE_DEPENDENCIES: std
|
|
||||||
|
|
||||||
import std;
|
import std;
|
||||||
|
|
||||||
int main(int, char**) {
|
int main(int, char**) {
|
||||||
|
@ -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
|
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
|
sudo bash /tmp/install-cmake.sh --prefix=/usr --exclude-subdir --skip-license
|
||||||
rm /tmp/install-cmake.sh
|
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
|
EOF
|
||||||
|
|
||||||
# ===----------------------------------------------------------------------===##
|
# ===----------------------------------------------------------------------===##
|
||||||
|
@ -48,6 +48,7 @@ environment_definitions:
|
|||||||
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
|
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
|
||||||
CC: clang-${LLVM_HEAD_VERSION}
|
CC: clang-${LLVM_HEAD_VERSION}
|
||||||
CXX: clang++-${LLVM_HEAD_VERSION}
|
CXX: clang++-${LLVM_HEAD_VERSION}
|
||||||
|
CMAKE: /opt/bin/cmake
|
||||||
|
|
||||||
_absolute_path_clang: &absolute_path_clang
|
_absolute_path_clang: &absolute_path_clang
|
||||||
# Note modules require and absolute path for clang-scan-deps
|
# Note modules require and absolute path for clang-scan-deps
|
||||||
@ -261,6 +262,7 @@ steps:
|
|||||||
env:
|
env:
|
||||||
CC: clang16
|
CC: clang16
|
||||||
CXX: clang++16
|
CXX: clang++16
|
||||||
|
ENABLE_STD_MODULES: 'Off'
|
||||||
agents:
|
agents:
|
||||||
queue: libcxx-builders
|
queue: libcxx-builders
|
||||||
os: freebsd
|
os: freebsd
|
||||||
|
@ -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
|
ENABLE_CLANG_TIDY Whether to compile and run clang-tidy checks. This variable
|
||||||
is optional.
|
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
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +120,10 @@ if [ -z "${ENABLE_CLANG_TIDY}" ]; then
|
|||||||
ENABLE_CLANG_TIDY=Off
|
ENABLE_CLANG_TIDY=Off
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "${ENABLE_STD_MODULES}" ]; then
|
||||||
|
ENABLE_STD_MODULES="-DLIBCXX_ENABLE_STD_MODULES=${ENABLE_STD_MODULES}"
|
||||||
|
fi
|
||||||
|
|
||||||
function generate-cmake-base() {
|
function generate-cmake-base() {
|
||||||
echo "--- Generating CMake"
|
echo "--- Generating CMake"
|
||||||
${CMAKE} \
|
${CMAKE} \
|
||||||
@ -127,6 +136,7 @@ function generate-cmake-base() {
|
|||||||
-DLIBCXXABI_ENABLE_WERROR=YES \
|
-DLIBCXXABI_ENABLE_WERROR=YES \
|
||||||
-DLIBUNWIND_ENABLE_WERROR=YES \
|
-DLIBUNWIND_ENABLE_WERROR=YES \
|
||||||
-DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
|
-DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
|
||||||
|
${ENABLE_STD_MODULES} \
|
||||||
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
|
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
|
||||||
"${@}"
|
"${@}"
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,6 @@ def _getSubstitution(substitution, config):
|
|||||||
raise ValueError("Substitution {} is not in the config.".format(substitution))
|
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):
|
def configure(parameters, features, config, lit_config):
|
||||||
note = lambda s: lit_config.note("({}) {}".format(config.name, s))
|
note = lambda s: lit_config.note("({}) {}".format(config.name, s))
|
||||||
config.environment = dict(os.environ)
|
config.environment = dict(os.environ)
|
||||||
|
@ -317,17 +317,6 @@ DEFAULT_FEATURES = [
|
|||||||
AddSubstitution("%{clang-tidy}", lambda cfg: _getSuitableClangTidy(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
|
# Deduce and add the test features that that are implied by the #defines in
|
||||||
@ -354,6 +343,7 @@ macros = {
|
|||||||
"_LIBCPP_HAS_NO_WIDE_CHARACTERS": "no-wide-characters",
|
"_LIBCPP_HAS_NO_WIDE_CHARACTERS": "no-wide-characters",
|
||||||
"_LIBCPP_HAS_NO_TIME_ZONE_DATABASE": "no-tzdb",
|
"_LIBCPP_HAS_NO_TIME_ZONE_DATABASE": "no-tzdb",
|
||||||
"_LIBCPP_HAS_NO_UNICODE": "libcpp-has-no-unicode",
|
"_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",
|
"_LIBCPP_PSTL_CPU_BACKEND_LIBDISPATCH": "libcpp-pstl-cpu-backend-libdispatch",
|
||||||
}
|
}
|
||||||
for macro, feature in macros.items():
|
for macro, feature in macros.items():
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
# ===----------------------------------------------------------------------===##
|
# ===----------------------------------------------------------------------===##
|
||||||
|
|
||||||
import lit
|
import lit
|
||||||
import libcxx.test.config as config
|
|
||||||
import lit.formats
|
import lit.formats
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -53,14 +52,6 @@ def _executeScriptInternal(test, litConfig, commands):
|
|||||||
return (out, err, exitCode, timeoutInfo, parsedCommands)
|
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):
|
def parseScript(test, preamble):
|
||||||
"""
|
"""
|
||||||
Extract the script from a test, with substitutions applied.
|
Extract the script from a test, with substitutions applied.
|
||||||
@ -100,8 +91,6 @@ def parseScript(test, preamble):
|
|||||||
# Parse the test file, including custom directives
|
# Parse the test file, including custom directives
|
||||||
additionalCompileFlags = []
|
additionalCompileFlags = []
|
||||||
fileDependencies = []
|
fileDependencies = []
|
||||||
modules = [] # The enabled modules
|
|
||||||
moduleCompileFlags = [] # The compilation flags to use modules
|
|
||||||
parsers = [
|
parsers = [
|
||||||
lit.TestRunner.IntegratedTestKeywordParser(
|
lit.TestRunner.IntegratedTestKeywordParser(
|
||||||
"FILE_DEPENDENCIES:",
|
"FILE_DEPENDENCIES:",
|
||||||
@ -113,11 +102,6 @@ def parseScript(test, preamble):
|
|||||||
lit.TestRunner.ParserKind.SPACE_LIST,
|
lit.TestRunner.ParserKind.SPACE_LIST,
|
||||||
initial_value=additionalCompileFlags,
|
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
|
# Add conditional parsers for ADDITIONAL_COMPILE_FLAGS. This should be replaced by first
|
||||||
@ -148,53 +132,12 @@ def parseScript(test, preamble):
|
|||||||
script += scriptInTest
|
script += scriptInTest
|
||||||
|
|
||||||
# Add compile flags specified with ADDITIONAL_COMPILE_FLAGS.
|
# Add compile flags specified with ADDITIONAL_COMPILE_FLAGS.
|
||||||
# Modules need to be built with the same compilation flags as the
|
substitutions = [
|
||||||
# test. So add these flags before adding the modules.
|
(s, x + " " + " ".join(additionalCompileFlags))
|
||||||
substitutions = config._appendToSubstitution(
|
if s == "%{compile_flags}"
|
||||||
substitutions, "%{compile_flags}", " ".join(additionalCompileFlags)
|
else (s, x)
|
||||||
)
|
for (s, x) in substitutions
|
||||||
|
]
|
||||||
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)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Perform substitutions in the script itself.
|
# Perform substitutions in the script itself.
|
||||||
script = lit.TestRunner.applySubstitutions(
|
script = lit.TestRunner.applySubstitutions(
|
||||||
|
@ -113,12 +113,12 @@ class module_test_generator:
|
|||||||
clang_tidy_plugin: str
|
clang_tidy_plugin: str
|
||||||
compiler: str
|
compiler: str
|
||||||
compiler_flags: str
|
compiler_flags: str
|
||||||
module: str
|
|
||||||
|
|
||||||
def write_lit_configuration(self):
|
def write_lit_configuration(self):
|
||||||
print(
|
print(
|
||||||
f"""\
|
f"""\
|
||||||
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
||||||
|
// UNSUPPORTED: libcpp-has-no-std-modules
|
||||||
// UNSUPPORTED: clang-modules-build
|
// UNSUPPORTED: clang-modules-build
|
||||||
|
|
||||||
// REQUIRES: has-clang-tidy
|
// REQUIRES: has-clang-tidy
|
||||||
@ -126,8 +126,6 @@ class module_test_generator:
|
|||||||
// The GCC compiler flags are not always compatible with clang-tidy.
|
// The GCC compiler flags are not always compatible with clang-tidy.
|
||||||
// UNSUPPORTED: gcc
|
// UNSUPPORTED: gcc
|
||||||
|
|
||||||
// MODULE_DEPENDENCIES: {self.module}
|
|
||||||
|
|
||||||
// RUN: echo -n > {self.tmp_prefix}.all_partitions
|
// RUN: echo -n > {self.tmp_prefix}.all_partitions
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user