[libcxx-commits] [libcxx] 3a0f88c - [libc++] Add a CI configuration to test Modules with LSV enabled

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 3 14:15:37 PST 2023


Author: Louis Dionne
Date: 2023-02-03T17:14:07-05:00
New Revision: 3a0f88c4c2c4b0e0566a8858504d24a14730cd77

URL: https://github.com/llvm/llvm-project/commit/3a0f88c4c2c4b0e0566a8858504d24a14730cd77
DIFF: https://github.com/llvm/llvm-project/commit/3a0f88c4c2c4b0e0566a8858504d24a14730cd77.diff

LOG: [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

Added: 
    libcxx/cmake/caches/Generic-modules-lsv.cmake

Modified: 
    libcxx/include/module.modulemap.in
    libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp
    libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
    libcxx/test/libcxx/language.support/timespec_get.xopen.compile.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.filter/iterator/arrow.pass.cpp
    libcxx/utils/ci/buildkite-pipeline.yml
    libcxx/utils/ci/run-buildbot
    libcxx/utils/libcxx/test/params.py

Removed: 
    


################################################################################
diff  --git a/libcxx/cmake/caches/Generic-modules-lsv.cmake b/libcxx/cmake/caches/Generic-modules-lsv.cmake
new file mode 100644
index 0000000000000..b44424f65642b
--- /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
index 95b71863c5f87..999675069fe73 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -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" }

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
index a4a05e6a08ef0..b887df69d6b9c 100644
--- 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 <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.

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
index 688bab4e8c809..4f8ae7821a2fe 100644
--- 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 <stdint.h> 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
index cf4c5957a4183..430ddacdddca5 100644
--- 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 <ctime> 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
index 500d8750b0c8b..b9b1a4e00fc25 100644
--- 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<V> operator->() const

diff  --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index c6339e444918a..0189449736f39 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -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"

diff  --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index d5fbacbcca623..aa385d462c341 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -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
 #

diff  --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 74a4ec24201d5..0574a00a737bd 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -94,6 +94,12 @@ def getStdFlag(cfg, std):
               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 [


        


More information about the libcxx-commits mailing list