[libcxx-commits] [libcxx] [libcxxabi] [llvm] [libc++] Enable clang-tidy in the CI again (PR #195047)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 5 04:55:01 PDT 2026


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/195047

>From 027d2ae1e43ce55445fedc56a26aca272788dcc1 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

---
 cmake/Modules/FindLibcCommonUtils.cmake              |  2 +-
 libcxx/include/__functional/function.h               |  2 ++
 libcxx/include/__memory/is_sufficiently_aligned.h    |  2 +-
 libcxx/include/__memory/unique_ptr.h                 |  4 ++--
 libcxx/include/__tree                                |  4 ++--
 libcxx/include/map                                   | 12 ++++++------
 libcxx/modules/std/utility.inc                       |  4 ++++
 libcxx/src/include/to_chars_floating_point.h         |  2 +-
 .../test/tools/clang_tidy_checks/hide_from_abi.cpp   | 10 ----------
 libcxx/utils/ci/run-buildbot                         |  4 ++++
 libcxxabi/include/cxxabi.h                           |  2 +-
 11 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/cmake/Modules/FindLibcCommonUtils.cmake b/cmake/Modules/FindLibcCommonUtils.cmake
index 81cf74fbd0d41..8f3a2738c6003 100644
--- a/cmake/Modules/FindLibcCommonUtils.cmake
+++ b/cmake/Modules/FindLibcCommonUtils.cmake
@@ -15,7 +15,7 @@ if(NOT TARGET llvm-libc-common-utilities)
     if (NOT(LIBCXX_ENABLE_THREADS))
       target_compile_definitions(llvm-libc-common-utilities INTERFACE LIBC_THREAD_MODE=LIBC_THREAD_MODE_SINGLE)
     endif()
-    target_include_directories(llvm-libc-common-utilities INTERFACE ${libc_path})
+    target_include_directories(llvm-libc-common-utilities SYSTEM INTERFACE ${libc_path})
     target_compile_definitions(llvm-libc-common-utilities INTERFACE LIBC_NAMESPACE=__llvm_libc_common_utils)
     target_compile_features(llvm-libc-common-utilities INTERFACE cxx_std_17)
   endif()
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index d62b6b06722a7..90072e9528484 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -131,6 +131,7 @@ namespace __function {
 template <class _Fp>
 class __base;
 
+_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
 template <class _Rp, class... _ArgTypes>
 class __base<_Rp(_ArgTypes...)> {
 public:
@@ -149,6 +150,7 @@ class __base<_Rp(_ArgTypes...)> {
   virtual const std::type_info& target_type() const _NOEXCEPT  = 0;
 #  endif // _LIBCPP_HAS_RTTI
 };
+_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
 
 // __func implements __base for a given functor type.
 
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/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h
index 32f9459f9fc2c..7e68faa15dabb 100644
--- a/libcxx/include/__memory/unique_ptr.h
+++ b/libcxx/include/__memory/unique_ptr.h
@@ -189,7 +189,7 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr {
 #endif
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
-    reset(__u.release());
+    reset(__u.release()); // NOLINT(misc-uniqueptr-reset-release)
     __deleter_ = std::forward<deleter_type>(__u.get_deleter());
     return *this;
   }
@@ -478,7 +478,7 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr<_Tp[], _Dp> {
         __checker_(std::move(__u.__checker_)) {}
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
-    reset(__u.release());
+    reset(__u.release()); // NOLINT(misc-uniqueptr-reset-release)
     __deleter_ = std::forward<deleter_type>(__u.get_deleter());
     __checker_ = std::move(__u.__checker_);
     return *this;
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 94c88e273870a..72a2da2b2727b 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -1257,7 +1257,7 @@ public:
 
   template <class _Key>
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 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));
@@ -1265,7 +1265,7 @@ public:
 
   template <class _Key>
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 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/map b/libcxx/include/map
index c983a3ed07cd4..94098d3a2b878 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1155,7 +1155,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 _LIBCPP_CONSTEXPR_SINCE_CXX26 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 std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
@@ -1164,7 +1164,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 _LIBCPP_CONSTEXPR_SINCE_CXX26 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 std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
@@ -1579,7 +1579,7 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map<_Key,
 
   template <class _Map, class _Func, class _Proj>
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 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));
   }
@@ -1630,7 +1630,7 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
 
 template <class _Key, class _Tp, class _Compare, class _Allocator>
 _LIBCPP_CONSTEXPR_SINCE_CXX26 _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 std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
@@ -1638,7 +1638,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(cons
 
 template <class _Key, class _Tp, class _Compare, class _Allocator>
 _LIBCPP_CONSTEXPR_SINCE_CXX26 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 std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
@@ -2176,7 +2176,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/modules/std/utility.inc b/libcxx/modules/std/utility.inc
index 77c21b87640dd..19c2acfe1b4df 100644
--- a/libcxx/modules/std/utility.inc
+++ b/libcxx/modules/std/utility.inc
@@ -96,4 +96,8 @@ export namespace std {
     using rel_ops::operator<=;
     using rel_ops::operator>=;
   } // namespace rel_ops
+
+  // [const.wrap.class]
+  using std::constant_wrapper;
+  using std::cw;
 } // namespace std
diff --git a/libcxx/src/include/to_chars_floating_point.h b/libcxx/src/include/to_chars_floating_point.h
index 01c26181697b7..8877c252d0399 100644
--- a/libcxx/src/include/to_chars_floating_point.h
+++ b/libcxx/src/include/to_chars_floating_point.h
@@ -38,7 +38,7 @@ namespace __itoa {
 inline constexpr char _Charconv_digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e',
     'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
 static_assert(std::size(_Charconv_digits) == 36);
-} // __itoa
+} // namespace __itoa
 
 // vvvvvvvvvv DERIVED FROM corecrt_internal_fltintrn.h vvvvvvvvvv
 
diff --git a/libcxx/test/tools/clang_tidy_checks/hide_from_abi.cpp b/libcxx/test/tools/clang_tidy_checks/hide_from_abi.cpp
index 38bf62019599e..f05470e47d3e7 100644
--- a/libcxx/test/tools/clang_tidy_checks/hide_from_abi.cpp
+++ b/libcxx/test/tools/clang_tidy_checks/hide_from_abi.cpp
@@ -78,9 +78,6 @@ void hide_from_abi::registerMatchers(clang::ast_matchers::MatchFinder* finder) {
           isDefinition())
           .bind("hide_from_abi_on_member_function"),
       this);
-
-  finder->addMatcher(
-      cxxMethodDecl(has_hide_from_abi_attr, on_trivial).bind("hide_from_abi_on_defaulted_smf_in_trivial_class"), this);
 }
 
 void hide_from_abi::check(const clang::ast_matchers::MatchFinder::MatchResult& result) {
@@ -99,12 +96,5 @@ void hide_from_abi::check(const clang::ast_matchers::MatchFinder::MatchResult& r
       call != nullptr) {
     diag(call->getLocation(), "_LIBCPP_HIDE_FROM_ABI or _LIBCPP_HIDE_FROM_ABI_VIRTUAL is missing");
   }
-
-  if (const auto* call =
-          result.Nodes.getNodeAs<clang::CXXMethodDecl>("hide_from_abi_on_defaulted_smf_in_trivial_class");
-      call != nullptr) {
-    diag(call->getLocation(),
-         "_LIBCPP_HIDE_FROM_ABI should not be used for special member functions in trivial classes");
-  }
 }
 } // namespace libcpp
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 6376bc1d3dd5a..7e12760b36d3f 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" \
diff --git a/libcxxabi/include/cxxabi.h b/libcxxabi/include/cxxabi.h
index 2874d14a4ad4d..ff0d5d2aef47c 100644
--- a/libcxxabi/include/cxxabi.h
+++ b/libcxxabi/include/cxxabi.h
@@ -31,7 +31,7 @@ class _LIBCXXABI_TYPE_VIS type_info; // forward declaration
 #else
 class type_info; // forward declaration
 #endif
-}
+} // namespace std
 
 
 // runtime routines use C calling conventions, but are in __cxxabiv1 namespace



More information about the libcxx-commits mailing list