[libc++] Add a CI configuration to test Modules with LSV enabled

Some clients use libc++ with modules and LSV (Local Submodule Visibility)
enabled, and we see frequent downstream breakage caused by that. Until
modules use LSV by default (which is apparently a desire), add a CI job
that tests this sub-configuration to avoid high cost downstream breakage.

For more information about LSV, see https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150504/128395.html.

Differential Revision: https://reviews.llvm.org/D143273
This commit is contained in:
Louis Dionne 2023-02-02 18:50:10 -05:00
parent e2e6e7a6a3
commit 3a0f88c4c2
9 changed files with 50 additions and 5 deletions

View File

@ -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 "")

View File

@ -62,23 +62,21 @@ module std [system] {
module stdbool_h {
// <stdbool.h>'s __bool_true_false_are_defined macro requires textual inclusion.
textual header "stdbool.h"
export *
}
module stddef_h {
// <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 {
// <stdio.h>'s __need_* macros require textual inclusion.
textual header "stdio.h"
export *
export Darwin.C.stdio
}
module stdlib_h {
// <stdlib.h>'s __need_* macros require textual inclusion.
@ -1087,7 +1085,10 @@ module std [system] {
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" }

View File

@ -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 <foo.h> 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.

View File

@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//
// This test breaks when enabling LSV.
// UNSUPPORTED: modules-build
// Test that limits macros are available when <stdint.h> is included
// with or without macro _XOPEN_SOURCE=700.
//

View File

@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//
// This test breaks when enabling LSV.
// UNSUPPORTED: modules-build
// UNSUPPORTED: c++03, c++11, c++14
// Make sure that <ctime> can be included even when _XOPEN_SOURCE is defined.

View File

@ -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<V> operator->() const

View File

@ -459,6 +459,23 @@ steps:
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"

View File

@ -371,6 +371,12 @@ generic-modules)
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
#

View File

@ -94,6 +94,12 @@ DEFAULT_PARAMETERS = [
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 [