[libcxx] [llvm] [libc++] Add coverage for C++17 and Clang Modules with LSV (PR #131815)
Louis Dionne via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 19 06:22:39 PDT 2025
https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/131815
>From 361b89f7d01ed0ada0c18722b4026305c2896843 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 18 Mar 2025 09:10:20 -0400
Subject: [PATCH 1/2] [libc++] Add coverage for C++17 and Clang Modules with
LSV
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.
---
.github/workflows/libcxx-build-and-test.yaml | 2 +-
libcxx/cmake/caches/Generic-modules-cxx17-lsv.cmake | 2 ++
libcxx/cmake/caches/Generic-modules-lsv.cmake | 2 --
libcxx/utils/ci/run-buildbot | 4 ++--
libcxx/utils/libcxx/test/params.py | 3 ++-
5 files changed, 7 insertions(+), 6 deletions(-)
create mode 100644 libcxx/cmake/caches/Generic-modules-cxx17-lsv.cmake
delete mode 100644 libcxx/cmake/caches/Generic-modules-lsv.cmake
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,
>From 3896a4e38267c61340640543b25abb742d86b2f2 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 19 Mar 2025 09:22:27 -0400
Subject: [PATCH 2/2] Add missing XFAIL
---
.../atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libcxx/test/libcxx/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp b/libcxx/test/libcxx/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp
index ca092d9c60275..a788ea32dddc8 100644
--- a/libcxx/test/libcxx/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp
+++ b/libcxx/test/libcxx/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp
@@ -9,6 +9,9 @@
// UNSUPPORTED: no-threads
// REQUIRES: c++03 || c++11 || c++14 || c++17 || c++20
+// No diagnostic gets emitted when we build with modules.
+// XFAIL: clang-modules-build
+
// This test ensures that we issue a reasonable diagnostic when including <atomic> after
// <stdatomic.h> has been included. Before C++23, this otherwise leads to obscure errors
// because <atomic> may try to redefine things defined by <stdatomic.h>.
More information about the llvm-commits
mailing list