diff --git a/libcxx/cmake/caches/Generic-modules-lsv.cmake b/libcxx/cmake/caches/Generic-modules-lsv.cmake new file mode 100644 --- /dev/null +++ b/libcxx/cmake/caches/Generic-modules-lsv.cmake @@ -0,0 +1,2 @@ +set(LIBCXX_TEST_PARAMS "enable_modules=True;enable_modules_lsv=True" CACHE STRING "") +set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "") diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -62,23 +62,21 @@ module stdbool_h { // 's __bool_true_false_are_defined macro requires textual inclusion. textual header "stdbool.h" + export * } module stddef_h { // 's __need_* macros require textual inclusion. textual header "stddef.h" + export * } module stdint_h { header "stdint.h" export * - // FIXME: This module only exists on OS X and for some reason the - // wildcard above doesn't export it. - export Darwin.C.stdint } module stdio_h { // 's __need_* macros require textual inclusion. textual header "stdio.h" export * - export Darwin.C.stdio } module stdlib_h { // 's __need_* macros require textual inclusion. @@ -1087,7 +1085,10 @@ module auto_ptr { private header "__memory/auto_ptr.h" } module builtin_new_allocator { private header "__memory/builtin_new_allocator.h" } module compressed_pair { private header "__memory/compressed_pair.h" } - module concepts { private header "__memory/concepts.h" } + module concepts { + private header "__memory/concepts.h" + export type_traits.remove_reference + } module construct_at { private header "__memory/construct_at.h" } module destruct_n { private header "__memory/destruct_n.h" } module pointer_traits { private header "__memory/pointer_traits.h" } diff --git a/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp b/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp --- a/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp +++ b/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp @@ -6,6 +6,10 @@ // //===----------------------------------------------------------------------===// +// When building with modules, including headers inside extern "C" is an anti-pattern +// that we don't want to support and can't support with LSV enabled. +// UNSUPPORTED: modules-build + // Sometimes C++'s headers get included within extern "C" contexts. This // is ill-formed (no diagnostic required), per [using.headers]p3, but we permit // it as an extension. diff --git a/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp b/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp --- a/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp +++ b/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp @@ -6,6 +6,9 @@ // //===----------------------------------------------------------------------===// +// This test breaks when enabling LSV. +// UNSUPPORTED: modules-build + // Test that limits macros are available when is included // with or without macro _XOPEN_SOURCE=700. // diff --git a/libcxx/test/libcxx/language.support/timespec_get.xopen.compile.pass.cpp b/libcxx/test/libcxx/language.support/timespec_get.xopen.compile.pass.cpp --- a/libcxx/test/libcxx/language.support/timespec_get.xopen.compile.pass.cpp +++ b/libcxx/test/libcxx/language.support/timespec_get.xopen.compile.pass.cpp @@ -6,6 +6,9 @@ // //===----------------------------------------------------------------------===// +// This test breaks when enabling LSV. +// UNSUPPORTED: modules-build + // UNSUPPORTED: c++03, c++11, c++14 // Make sure that can be included even when _XOPEN_SOURCE is defined. diff --git a/libcxx/test/std/ranges/range.adaptors/range.filter/iterator/arrow.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.filter/iterator/arrow.pass.cpp --- a/libcxx/test/std/ranges/range.adaptors/range.filter/iterator/arrow.pass.cpp +++ b/libcxx/test/std/ranges/range.adaptors/range.filter/iterator/arrow.pass.cpp @@ -6,6 +6,9 @@ // //===----------------------------------------------------------------------===// +// This test is hitting Clang bugs with LSV in older versions of Clang. +// UNSUPPORTED: modules-build && (clang-15 || apple-clang-14) + // UNSUPPORTED: c++03, c++11, c++14, c++17 // constexpr iterator_t operator->() const diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -459,6 +459,23 @@ limit: 2 timeout_in_minutes: 120 + - label: "Modular build with Local Submodule Visibility" + command: "libcxx/utils/ci/run-buildbot generic-modules-lsv" + artifact_paths: + - "**/test-results.xml" + - "**/*.abilist" + env: + CC: "clang-${LLVM_HEAD_VERSION}" + CXX: "clang++-${LLVM_HEAD_VERSION}" + agents: + queue: "libcxx-builders" + os: "linux" + retry: + automatic: + - exit_status: -1 # Agent was lost + limit: 2 + timeout_in_minutes: 120 + - group: "Parts disabled" steps: - label: "No threads" diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -371,6 +371,12 @@ check-runtimes check-abi-list ;; +generic-modules-lsv) + clean + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake" + check-runtimes + check-abi-list +;; # # Parts removed # diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -94,6 +94,12 @@ AddCompileFlag('-fcxx-modules'), # AppleClang disregards -fmodules entirely when compiling C++. This enables modules for C++. ] if modules else []), + Parameter(name='enable_modules_lsv', choices=[True, False], type=bool, default=False, + help="Whether to enable Local Submodule Visibility in the Modules build.", + actions=lambda lsv: [ + AddCompileFlag('-Xclang -fmodules-local-submodule-visibility'), + ] if lsv else []), + Parameter(name='enable_exceptions', choices=[True, False], type=bool, default=True, help="Whether to enable exceptions when compiling the test suite.", actions=lambda exceptions: [] if exceptions else [