[libcxx-commits] [libcxx] [libc++] Re-enable Clang-tidy checks in the CI (PR #110026)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 29 12:03:49 PST 2024


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/110026

>From 85f849d91dd79063383e5048cca5fd7e0dc83684 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 25 Sep 2024 14:54:43 -0400
Subject: [PATCH 1/3] [libc++] Re-enable Clang-tidy checks in the CI

---
 libcxx/test/tools/clang_tidy_checks/CMakeLists.txt | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
index efe63e0f625f2e..05c44e49b448cd 100644
--- a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
+++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
@@ -1,6 +1,3 @@
-# TODO: Re-enable the tests once the CI is back under control
-return()
-
 # The find_package changes these variables. This leaves the build in an odd
 # state. Calling cmake a second time tries to write site config information in
 # the system's libc++. Restoring these setting after testing fixes this issue.

>From 8c0f694d908f47a6c181f376babd529a27023888 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 28 Nov 2024 16:50:47 -0500
Subject: [PATCH 2/3] Fix a few clang-tidy issues that crept into the code base
 while it was disabled

---
 libcxx/include/ccomplex  | 4 +++-
 libcxx/include/chrono    | 1 -
 libcxx/include/ciso646   | 1 +
 libcxx/include/cstdalign | 6 ++++--
 libcxx/include/cstdbool  | 6 ++++--
 libcxx/include/ctgmath   | 2 ++
 6 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libcxx/include/ccomplex b/libcxx/include/ccomplex
index d379c9e7f0174a..510a36fdddce5e 100644
--- a/libcxx/include/ccomplex
+++ b/libcxx/include/ccomplex
@@ -26,12 +26,14 @@
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_ccomplex _LIBCPP_DEPRECATED_("removed in C++20. Include <complex> instead.") = void;
+// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_ccomplex = __standard_header_ccomplex;
 
 #elif _LIBCPP_STD_VER >= 17
 
 using __standard_header_ccomplex _LIBCPP_DEPRECATED_("Include <complex> instead.") = void;
-using __use_standard_header_ccomplex                                               = __standard_header_ccomplex;
+// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
+using __use_standard_header_ccomplex = __standard_header_ccomplex;
 
 #endif
 
diff --git a/libcxx/include/chrono b/libcxx/include/chrono
index 42da1b4ab97562..1545490d9b6c64 100644
--- a/libcxx/include/chrono
+++ b/libcxx/include/chrono
@@ -998,7 +998,6 @@ constexpr chrono::year                                  operator ""y(unsigned lo
 #  include <cstdint>
 #  include <stdexcept>
 #  include <string_view>
-#  include <vector>
 #endif
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
diff --git a/libcxx/include/ciso646 b/libcxx/include/ciso646
index 5fcac79e38a7f2..d94407aba334b2 100644
--- a/libcxx/include/ciso646
+++ b/libcxx/include/ciso646
@@ -24,6 +24,7 @@
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_ciso646 _LIBCPP_DEPRECATED_("removed in C++20. Include <version> instead.") = void;
+// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_ciso646 = __standard_header_ciso646;
 
 #endif
diff --git a/libcxx/include/cstdalign b/libcxx/include/cstdalign
index e6a2a3c7177422..c36da3fe8dc4c2 100644
--- a/libcxx/include/cstdalign
+++ b/libcxx/include/cstdalign
@@ -43,12 +43,14 @@ Macros:
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_cstdalign _LIBCPP_DEPRECATED_("removed in C++20.") = void;
-using __use_standard_header_cstdalign                                      = __standard_header_cstdalign;
+// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
+using __use_standard_header_cstdalign = __standard_header_cstdalign;
 
 #elif _LIBCPP_STD_VER >= 17
 
 using __standard_header_cstdalign _LIBCPP_DEPRECATED = void;
-using __use_standard_header_cstdalign                = __standard_header_cstdalign;
+// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
+using __use_standard_header_cstdalign = __standard_header_cstdalign;
 
 #endif
 
diff --git a/libcxx/include/cstdbool b/libcxx/include/cstdbool
index 1d627258e10c09..5888859e71169c 100644
--- a/libcxx/include/cstdbool
+++ b/libcxx/include/cstdbool
@@ -31,12 +31,14 @@ Macros:
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_cstdbool _LIBCPP_DEPRECATED_("removed in C++20.") = void;
-using __use_standard_header_cstdbool                                      = __standard_header_cstdbool;
+// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
+using __use_standard_header_cstdbool = __standard_header_cstdbool;
 
 #elif _LIBCPP_STD_VER >= 17
 
 using __standard_header_cstdbool _LIBCPP_DEPRECATED = void;
-using __use_standard_header_cstdbool                = __standard_header_cstdbool;
+// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
+using __use_standard_header_cstdbool = __standard_header_cstdbool;
 
 #endif
 
diff --git a/libcxx/include/ctgmath b/libcxx/include/ctgmath
index 7dbe952f021b74..088627ba822c66 100644
--- a/libcxx/include/ctgmath
+++ b/libcxx/include/ctgmath
@@ -28,11 +28,13 @@
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_ctgmath _LIBCPP_DEPRECATED_("removed in C++20. Include <cmath> and <complex> instead.") = void;
+// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_ctgmath = __standard_header_ctgmath;
 
 #elif _LIBCPP_STD_VER >= 17
 
 using __standard_header_ctgmath _LIBCPP_DEPRECATED_("Include <cmath> and <complex> instead.") = void;
+// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_ctgmath = __standard_header_ctgmath;
 
 #endif

>From 191a05b548ed149f355642216bbcfe331845593b Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 29 Nov 2024 15:03:37 -0500
Subject: [PATCH 3/3] Fix clang-tidy issues the right way

---
 libcxx/include/ccomplex              | 2 --
 libcxx/include/ciso646               | 1 -
 libcxx/include/cstdalign             | 2 --
 libcxx/include/cstdbool              | 2 --
 libcxx/include/ctgmath               | 2 --
 libcxx/test/libcxx/clang_tidy.gen.py | 3 ++-
 6 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/libcxx/include/ccomplex b/libcxx/include/ccomplex
index 510a36fdddce5e..252bab6aa0a3b2 100644
--- a/libcxx/include/ccomplex
+++ b/libcxx/include/ccomplex
@@ -26,13 +26,11 @@
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_ccomplex _LIBCPP_DEPRECATED_("removed in C++20. Include <complex> instead.") = void;
-// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_ccomplex = __standard_header_ccomplex;
 
 #elif _LIBCPP_STD_VER >= 17
 
 using __standard_header_ccomplex _LIBCPP_DEPRECATED_("Include <complex> instead.") = void;
-// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_ccomplex = __standard_header_ccomplex;
 
 #endif
diff --git a/libcxx/include/ciso646 b/libcxx/include/ciso646
index d94407aba334b2..5fcac79e38a7f2 100644
--- a/libcxx/include/ciso646
+++ b/libcxx/include/ciso646
@@ -24,7 +24,6 @@
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_ciso646 _LIBCPP_DEPRECATED_("removed in C++20. Include <version> instead.") = void;
-// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_ciso646 = __standard_header_ciso646;
 
 #endif
diff --git a/libcxx/include/cstdalign b/libcxx/include/cstdalign
index c36da3fe8dc4c2..29445f125893ae 100644
--- a/libcxx/include/cstdalign
+++ b/libcxx/include/cstdalign
@@ -43,13 +43,11 @@ Macros:
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_cstdalign _LIBCPP_DEPRECATED_("removed in C++20.") = void;
-// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_cstdalign = __standard_header_cstdalign;
 
 #elif _LIBCPP_STD_VER >= 17
 
 using __standard_header_cstdalign _LIBCPP_DEPRECATED = void;
-// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_cstdalign = __standard_header_cstdalign;
 
 #endif
diff --git a/libcxx/include/cstdbool b/libcxx/include/cstdbool
index 5888859e71169c..6e3191d8e37938 100644
--- a/libcxx/include/cstdbool
+++ b/libcxx/include/cstdbool
@@ -31,13 +31,11 @@ Macros:
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_cstdbool _LIBCPP_DEPRECATED_("removed in C++20.") = void;
-// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_cstdbool = __standard_header_cstdbool;
 
 #elif _LIBCPP_STD_VER >= 17
 
 using __standard_header_cstdbool _LIBCPP_DEPRECATED = void;
-// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_cstdbool = __standard_header_cstdbool;
 
 #endif
diff --git a/libcxx/include/ctgmath b/libcxx/include/ctgmath
index 088627ba822c66..7dbe952f021b74 100644
--- a/libcxx/include/ctgmath
+++ b/libcxx/include/ctgmath
@@ -28,13 +28,11 @@
 #if _LIBCPP_STD_VER >= 20
 
 using __standard_header_ctgmath _LIBCPP_DEPRECATED_("removed in C++20. Include <cmath> and <complex> instead.") = void;
-// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_ctgmath = __standard_header_ctgmath;
 
 #elif _LIBCPP_STD_VER >= 17
 
 using __standard_header_ctgmath _LIBCPP_DEPRECATED_("Include <cmath> and <complex> instead.") = void;
-// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
 using __use_standard_header_ctgmath = __standard_header_ctgmath;
 
 #endif
diff --git a/libcxx/test/libcxx/clang_tidy.gen.py b/libcxx/test/libcxx/clang_tidy.gen.py
index 5e84fbbb9913f3..0db9c0d14b196e 100644
--- a/libcxx/test/libcxx/clang_tidy.gen.py
+++ b/libcxx/test/libcxx/clang_tidy.gen.py
@@ -15,7 +15,7 @@
 
 import sys
 sys.path.append(sys.argv[1])
-from libcxx.header_information import lit_header_restrictions, public_headers
+from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
 
 for header in public_headers:
   print(f"""\
@@ -30,6 +30,7 @@
 // UNSUPPORTED: clang-17
 
 {lit_header_restrictions.get(header, '')}
+{lit_header_undeprecations.get(header, '')}
 
 // TODO: run clang-tidy with modules enabled once they are supported
 // RUN: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{{test-tools-dir}}/clang_tidy_checks/libcxx-tidy.plugin -- %{{compile_flags}} -fno-modules



More information about the libcxx-commits mailing list