Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] Add coverage for C++17 and Clang Modules with LSV #131815

Merged
merged 2 commits into from
Mar 20, 2025

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Mar 18, 2025

In recent versions of Clang, using -std=c++20 (and later) implies LSV when compiling with modules. This change resulted in making our LSV job redundant with the regular modules job, which uses the latest Standard. This patch increases the coverage of our CI without increasing its cost by pinning the LSV job to use C++17, which normally doesn't use LSV. A related question is whether we should add coverage for non-LSV builds using Clang modules.

In recent versions of Clang, using -std=c++20 (and later) implies LSV
when compiling with modules. This change resulted in making our LSV
job redundant with the regular modules job, which uses the latest
Standard. This patch increases the coverage of our CI without increasing
its cost by pinning the LSV job to use C++17, which normally doesn't use
LSV. A related question is whether we should add coverage for non-LSV
builds using Clang modules.
@ldionne ldionne requested a review from a team as a code owner March 18, 2025 15:00
@llvmbot llvmbot added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. github:workflow labels Mar 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 18, 2025

@llvm/pr-subscribers-github-workflow

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

In recent versions of Clang, using -std=c++20 (and later) implies LSV when compiling with modules. This change resulted in making our LSV job redundant with the regular modules job, which uses the latest Standard. This patch increases the coverage of our CI without increasing its cost by pinning the LSV job to use C++17, which normally doesn't use LSV. A related question is whether we should add coverage for non-LSV builds using Clang modules.


Full diff: https://github.com/llvm/llvm-project/pull/131815.diff

5 Files Affected:

  • (modified) .github/workflows/libcxx-build-and-test.yaml (+1-1)
  • (added) libcxx/cmake/caches/Generic-modules-cxx17-lsv.cmake (+2)
  • (removed) libcxx/cmake/caches/Generic-modules-lsv.cmake (-2)
  • (modified) libcxx/utils/ci/run-buildbot (+2-2)
  • (modified) libcxx/utils/libcxx/test/params.py (+2-1)
diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index 8c011425abfcf..0f4c6f53d6e8d 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -137,7 +137,7 @@ jobs:
           'generic-hardening-mode-fast',
           'generic-hardening-mode-fast-with-abi-breaks',
           'generic-merged',
-          'generic-modules-lsv',
+          'generic-modules-cxx17-lsv',
           'generic-no-exceptions',
           'generic-no-experimental',
           'generic-no-filesystem',
diff --git a/libcxx/cmake/caches/Generic-modules-cxx17-lsv.cmake b/libcxx/cmake/caches/Generic-modules-cxx17-lsv.cmake
new file mode 100644
index 0000000000000..c73e2a142092b
--- /dev/null
+++ b/libcxx/cmake/caches/Generic-modules-cxx17-lsv.cmake
@@ -0,0 +1,2 @@
+set(LIBCXX_TEST_PARAMS "enable_modules=clang-lsv;std=c++17" CACHE STRING "")
+set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
diff --git a/libcxx/cmake/caches/Generic-modules-lsv.cmake b/libcxx/cmake/caches/Generic-modules-lsv.cmake
deleted file mode 100644
index 395fccc217650..0000000000000
--- a/libcxx/cmake/caches/Generic-modules-lsv.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-set(LIBCXX_TEST_PARAMS "enable_modules=clang-lsv" CACHE STRING "")
-set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 947932f3802a1..29eebd1f92189 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -454,9 +454,9 @@ generic-modules)
     check-runtimes
     check-abi-list
 ;;
-generic-modules-lsv)
+generic-modules-cxx17-lsv)
     clean
-    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake"
+    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-cxx17-lsv.cmake"
     check-runtimes
     check-abi-list
 ;;
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 93dc3a8be3f08..58ace0ba96e35 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -210,7 +210,8 @@ def getSuitableClangTidy(cfg):
         choices=["none", "clang", "clang-lsv"],
         type=str,
         help="Whether to build the test suite with modules enabled. "
-             "Select `clang` for Clang modules, and 'clang-lsv' for Clang modules with Local Submodule Visibility.",
+             "Select `clang` for Clang modules, and 'clang-lsv' for Clang modules with Local Submodule Visibility. "
+             "Note that in recent versions of Clang, using Clang modules with -std=c++20 and later implies LSV.",
         default="none",
         actions=lambda modules: filter(None, [
             AddFeature("clang-modules-build")           if modules in ("clang", "clang-lsv") else None,

Copy link
Member

@mordante mordante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@ldionne ldionne added the pending-ci Merging the PR is only pending completion of CI label Mar 19, 2025
@ldionne ldionne merged commit 382b707 into llvm:main Mar 20, 2025
87 checks passed
@ldionne ldionne deleted the ldionne/review/restore-lsv-coverage branch March 20, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github:workflow libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. pending-ci Merging the PR is only pending completion of CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants