[libcxx-commits] [libcxx] [libc++] Enable clang-tidy in the CI again (PR #195047)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 30 08:49:11 PDT 2026
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/195047
>From f86c4e25eb44c030b26646d555b7c921c04de7b2 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Thu, 30 Apr 2026 11:49:40 +0200
Subject: [PATCH] [libc++] Enable clang-tidy in the CI again
---
libcxx/include/__memory/is_sufficiently_aligned.h | 2 +-
libcxx/include/__tree | 4 ++--
libcxx/include/ios | 4 ++++
libcxx/include/istream | 3 +++
libcxx/include/map | 12 ++++++------
libcxx/test/libcxx/clang_tidy.gen.py | 3 ++-
libcxx/utils/ci/run-buildbot | 4 ++++
7 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/libcxx/include/__memory/is_sufficiently_aligned.h b/libcxx/include/__memory/is_sufficiently_aligned.h
index a0ec198993afd..b8725880028db 100644
--- a/libcxx/include/__memory/is_sufficiently_aligned.h
+++ b/libcxx/include/__memory/is_sufficiently_aligned.h
@@ -21,7 +21,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _Alignment, class _Tp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool __is_sufficiently_aligned(_Tp* __ptr) {
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __is_sufficiently_aligned(_Tp* __ptr) {
return reinterpret_cast<uintptr_t>(__ptr) % _Alignment == 0;
}
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index bb8c4f3f8c623..22cf026c49075 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -1224,7 +1224,7 @@ public:
template <class _Key>
_LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __key) {
- auto [__, __match] = __find_equal(__key);
+ auto [___, __match] = __find_equal(__key);
if (__match == nullptr)
return end();
return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__match));
@@ -1232,7 +1232,7 @@ public:
template <class _Key>
_LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __key) const {
- auto [__, __match] = __find_equal(__key);
+ auto [___, __match] = __find_equal(__key);
if (__match == nullptr)
return end();
return const_iterator(std::__static_fancy_pointer_cast<__node_pointer>(__match));
diff --git a/libcxx/include/ios b/libcxx/include/ios
index 9c03f56a230b5..f6c162d5e1ebe 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -752,11 +752,15 @@ inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::set_rdbuf(basic_st
ios_base::set_rdbuf(__sb);
}
+
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>;
# if _LIBCPP_HAS_WIDE_CHARACTERS
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>;
# endif
+_LIBCPP_DIAGNOSTIC_POP
_LIBCPP_HIDE_FROM_ABI inline ios_base& boolalpha(ios_base& __str) {
__str.setf(ios_base::boolalpha);
diff --git a/libcxx/include/istream b/libcxx/include/istream
index dfa22e9f3bfb7..615e31dc03427 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -1399,11 +1399,14 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) {
return __is;
}
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>;
# if _LIBCPP_HAS_WIDE_CHARACTERS
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>;
# endif
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>;
+_LIBCPP_DIAGNOSTIC_POP
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/map b/libcxx/include/map
index b7031aeb51c7a..f8fa5389524d9 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1100,7 +1100,7 @@ public:
template <class _Arg,
__enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0>
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mapped_type& at(_Arg&& __arg) {
- auto [_, __child] = __tree_.__find_equal(__arg);
+ auto [___, __child] = __tree_.__find_equal(__arg);
if (__child == nullptr)
std::__throw_out_of_range("map::at: key not found");
return static_cast<__node_pointer>(__child)->__get_value().second;
@@ -1109,7 +1109,7 @@ public:
template <class _Arg,
__enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0>
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const mapped_type& at(_Arg&& __arg) const {
- auto [_, __child] = __tree_.__find_equal(__arg);
+ auto [___, __child] = __tree_.__find_equal(__arg);
if (__child == nullptr)
std::__throw_out_of_range("map::at: key not found");
return static_cast<__node_pointer>(__child)->__get_value().second;
@@ -1488,7 +1488,7 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map<_Key,
template <class _Map, class _Func, class _Proj>
_LIBCPP_HIDE_FROM_ABI static auto operator()(_Map&& __map, _Func __func, _Proj __proj) {
- auto [_, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()(
+ auto [___, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()(
__map.__tree_, std::move(__func), std::move(__proj));
return std::make_pair(__map.end(), std::move(__func2));
}
@@ -1539,7 +1539,7 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
template <class _Key, class _Tp, class _Compare, class _Allocator>
_Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
- auto [_, __child] = __tree_.__find_equal(__k);
+ auto [___, __child] = __tree_.__find_equal(__k);
if (__child == nullptr)
std::__throw_out_of_range("map::at: key not found");
return static_cast<__node_pointer>(__child)->__get_value().second;
@@ -1547,7 +1547,7 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
template <class _Key, class _Tp, class _Compare, class _Allocator>
const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const {
- auto [_, __child] = __tree_.__find_equal(__k);
+ auto [___, __child] = __tree_.__find_equal(__k);
if (__child == nullptr)
std::__throw_out_of_range("map::at: key not found");
return static_cast<__node_pointer>(__child)->__get_value().second;
@@ -2071,7 +2071,7 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_
template <class _Map, class _Func, class _Proj>
_LIBCPP_HIDE_FROM_ABI static auto operator()(_Map&& __map, _Func __func, _Proj __proj) {
- auto [_, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()(
+ auto [___, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()(
__map.__tree_, std::move(__func), std::move(__proj));
return std::make_pair(__map.end(), std::move(__func2));
}
diff --git a/libcxx/test/libcxx/clang_tidy.gen.py b/libcxx/test/libcxx/clang_tidy.gen.py
index 48527e3617f90..e1c87433a7371 100644
--- a/libcxx/test/libcxx/clang_tidy.gen.py
+++ b/libcxx/test/libcxx/clang_tidy.gen.py
@@ -26,12 +26,13 @@
{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
+// FIXME: Enable -Wweak-vtables again once https://llvm.org/PR195110 has been fixed
// TODO: run clang-tidy with modules enabled once they are supported
// RUN: %{{clang-tidy}} %s --warnings-as-errors=* \\
// RUN: -header-filter=.* \\
// RUN: --config-file=%{{libcxx-dir}}/.clang-tidy \\
// RUN: --load=%{{test-tools-dir}}/clang_tidy_checks/libcxx-tidy.plugin \\
-// RUN: -- -Wweak-vtables %{{flags}} %{{compile_flags}} -fno-modules
+// RUN: -- %{{flags}} %{{compile_flags}} -fno-modules
#include <{header}>
""")
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 59e4bfe5928b4..d47b6ed57f8b1 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -119,6 +119,10 @@ function clean() {
function generate-cmake-base() {
step "Generating CMake"
+ # FIXME: This should really be set in the Dockerfile
+ export CMAKE_PREFIX_PATH="/opt/compiler-explorer/clang-trunk/lib/cmake"
+ export PATH="$PATH:/opt/compiler-explorer/clang-trunk/bin"
+
# We can remove -DCMAKE_INSTALL_MESSAGE=NEVER once https://gitlab.kitware.com/cmake/cmake/-/issues/26085 is fixed.
cmake \
-S "${MONOREPO_ROOT}/runtimes" \
More information about the libcxx-commits
mailing list