Skip to content

Conversation

@Islam-Imad
Copy link
Contributor

@Islam-Imad Islam-Imad commented Dec 7, 2025

Rename google-readability-casting to modernize-avoid-c-style-cast

The old name is kept as an alias for backward compatibility.

Fixes #170978

…tyle-cast

The old name is kept as an alias for backward compatibility.

Fixes llvm#170978
@llvmbot
Copy link
Member

llvmbot commented Dec 7, 2025

@llvm/pr-subscribers-clang-tidy

@llvm/pr-subscribers-clang-tools-extra

Author: Islam Imad (Islam-Imad)

Changes

[clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast

The old name is kept as an alias for backward compatibility.

Fixes #170978


Patch is 20.30 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/171058.diff

17 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/google/CMakeLists.txt (-1)
  • (modified) clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp (+2-2)
  • (renamed) clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.cpp (+2-2)
  • (renamed) clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.h (+6-6)
  • (modified) clang-tools-extra/clang-tidy/modernize/CMakeLists.txt (+1)
  • (modified) clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp (+3)
  • (modified) clang-tools-extra/docs/ReleaseNotes.rst (+5)
  • (modified) clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst (+1-9)
  • (modified) clang-tools-extra/docs/clang-tidy/checks/list.rst (+2-1)
  • (added) clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst (+14)
  • (removed) clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c (-24)
  • (added) clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c (+24)
  • (renamed) clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.cpp (+4-4)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp (+3-3)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp (+3-3)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp (+3-3)
  • (modified) clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp (+2-2)
diff --git a/clang-tools-extra/clang-tidy/google/CMakeLists.txt b/clang-tools-extra/clang-tidy/google/CMakeLists.txt
index 1d4229ebb7b09..ac053bc92a0a4 100644
--- a/clang-tools-extra/clang-tidy/google/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/google/CMakeLists.txt
@@ -4,7 +4,6 @@ set(LLVM_LINK_COMPONENTS
   )
 
 add_clang_library(clangTidyGoogleModule STATIC
-  AvoidCStyleCastsCheck.cpp
   AvoidNSObjectNewCheck.cpp
   AvoidThrowingObjCExceptionCheck.cpp
   AvoidUnderscoreInGoogletestNameCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
index aff8b45ff2f74..7080280b4e7bd 100644
--- a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
@@ -9,10 +9,10 @@
 #include "../ClangTidy.h"
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
+#include "../modernize/AvoidCStyleCastsCheck.h"
 #include "../readability/BracesAroundStatementsCheck.h"
 #include "../readability/FunctionSizeCheck.h"
 #include "../readability/NamespaceCommentCheck.h"
-#include "AvoidCStyleCastsCheck.h"
 #include "AvoidNSObjectNewCheck.h"
 #include "AvoidThrowingObjCExceptionCheck.h"
 #include "AvoidUnderscoreInGoogletestNameCheck.h"
@@ -67,7 +67,7 @@ class GoogleModule : public ClangTidyModule {
     CheckFactories
         .registerCheck<readability::AvoidUnderscoreInGoogletestNameCheck>(
             "google-readability-avoid-underscore-in-googletest-name");
-    CheckFactories.registerCheck<readability::AvoidCStyleCastsCheck>(
+    CheckFactories.registerCheck<modernize::AvoidCStyleCastsCheck>(
         "google-readability-casting");
     CheckFactories.registerCheck<readability::TodoCommentCheck>(
         "google-readability-todo");
diff --git a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.cpp
similarity index 99%
rename from clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp
rename to clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.cpp
index c438889e22ab7..d76f9d0b74007 100644
--- a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.cpp
@@ -14,7 +14,7 @@
 
 using namespace clang::ast_matchers;
 
-namespace clang::tidy::google::readability {
+namespace clang::tidy::modernize {
 
 void AvoidCStyleCastsCheck::registerMatchers(
     ast_matchers::MatchFinder *Finder) {
@@ -288,4 +288,4 @@ void AvoidCStyleCastsCheck::check(const MatchFinder::MatchResult &Result) {
   Diag << "static_cast/const_cast/reinterpret_cast";
 }
 
-} // namespace clang::tidy::google::readability
+} // namespace clang::tidy::modernize
diff --git a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.h b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.h
similarity index 76%
rename from clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.h
rename to clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.h
index a305bd524aefb..920596e260348 100644
--- a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.h
@@ -6,12 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTSCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTSCHECK_H
 
 #include "../ClangTidyCheck.h"
 
-namespace clang::tidy::google::readability {
+namespace clang::tidy::modernize {
 
 /// Finds usages of C-style casts.
 ///
@@ -24,7 +24,7 @@ namespace clang::tidy::google::readability {
 /// ones generated by `-Wold-style-cast`.
 ///
 /// For the user-facing documentation see:
-/// https://clang.llvm.org/extra/clang-tidy/checks/google/readability-casting.html
+/// https://clang.llvm.org/extra/clang-tidy/checks/modernize/avoid-c-style-cast.html
 class AvoidCStyleCastsCheck : public ClangTidyCheck {
 public:
   AvoidCStyleCastsCheck(StringRef Name, ClangTidyContext *Context)
@@ -36,6 +36,6 @@ class AvoidCStyleCastsCheck : public ClangTidyCheck {
   }
 };
 
-} // namespace clang::tidy::google::readability
+} // namespace clang::tidy::modernize
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTSCHECK_H
diff --git a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
index 882f2dc9fb4d8..ac26c3d9bec6f 100644
--- a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
@@ -6,6 +6,7 @@ set(LLVM_LINK_COMPONENTS
 add_clang_library(clangTidyModernizeModule STATIC
   AvoidBindCheck.cpp
   AvoidCArraysCheck.cpp
+  AvoidCStyleCastsCheck.cpp
   AvoidSetjmpLongjmpCheck.cpp
   AvoidVariadicFunctionsCheck.cpp
   ConcatNestedNamespacesCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
index 360e2b8434d0c..793dd3d025e21 100644
--- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
@@ -11,6 +11,7 @@
 #include "../ClangTidyModuleRegistry.h"
 #include "AvoidBindCheck.h"
 #include "AvoidCArraysCheck.h"
+#include "AvoidCStyleCastsCheck.h"
 #include "AvoidSetjmpLongjmpCheck.h"
 #include "AvoidVariadicFunctionsCheck.h"
 #include "ConcatNestedNamespacesCheck.h"
@@ -65,6 +66,8 @@ class ModernizeModule : public ClangTidyModule {
   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
     CheckFactories.registerCheck<AvoidBindCheck>("modernize-avoid-bind");
     CheckFactories.registerCheck<AvoidCArraysCheck>("modernize-avoid-c-arrays");
+    CheckFactories.registerCheck<AvoidCStyleCastsCheck>(
+        "modernize-avoid-c-style-cast");
     CheckFactories.registerCheck<AvoidSetjmpLongjmpCheck>(
         "modernize-avoid-setjmp-longjmp");
     CheckFactories.registerCheck<AvoidVariadicFunctionsCheck>(
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 42160fa9cb51c..322ce8e9d39ea 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -328,6 +328,11 @@ New check aliases
   <clang-tidy/checks/bugprone/copy-constructor-mutates-argument>`
   keeping initial check as an alias to the new one.
 
+- Renamed :doc:`google-readability-casting <clang-tidy/checks/google/readability-casting>` to
+  :doc:`modernize-avoid-c-style-cast
+  <clang-tidy/checks/modernize/avoid-c-style-cast>`
+  keeping initial check as an alias to the new one.
+
 Changes in existing checks
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
diff --git a/clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst b/clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst
index d927e1ce29fce..1d0c24cf375e7 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst
@@ -3,12 +3,4 @@
 google-readability-casting
 ==========================
 
-Finds usages of C-style casts.
-
-https://google.github.io/styleguide/cppguide.html#Casting
-
-Corresponding cpplint.py check name: `readability/casting`.
-
-This check is similar to ``-Wold-style-cast``, but it suggests automated fixes
-in some cases. The reported locations should not be different from the
-ones generated by ``-Wold-style-cast``.
+The `google-readability-casting` check is an alias, please see `modernize-avoid-c-style-cast <../modernize/avoid-c-style-cast.html>`_ for more information.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index 8bb112f3d1832..865a2d34e94c2 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -239,7 +239,6 @@ Clang-Tidy Checks
    :doc:`google-objc-function-naming <google/objc-function-naming>`,
    :doc:`google-objc-global-variable-declaration <google/objc-global-variable-declaration>`,
    :doc:`google-readability-avoid-underscore-in-googletest-name <google/readability-avoid-underscore-in-googletest-name>`,
-   :doc:`google-readability-casting <google/readability-casting>`,
    :doc:`google-readability-todo <google/readability-todo>`,
    :doc:`google-runtime-float <google/runtime-float>`,
    :doc:`google-runtime-int <google/runtime-int>`,
@@ -291,6 +290,7 @@ Clang-Tidy Checks
    :doc:`misc-use-internal-linkage <misc/use-internal-linkage>`, "Yes"
    :doc:`modernize-avoid-bind <modernize/avoid-bind>`, "Yes"
    :doc:`modernize-avoid-c-arrays <modernize/avoid-c-arrays>`,
+   :doc:`modernize-avoid-c-style-cast <modernize/avoid-c-style-cast>`,
    :doc:`modernize-avoid-setjmp-longjmp <modernize/avoid-setjmp-longjmp>`,
    :doc:`modernize-avoid-variadic-functions <modernize/avoid-variadic-functions>`,
    :doc:`modernize-concat-nested-namespaces <modernize/concat-nested-namespaces>`, "Yes"
@@ -585,6 +585,7 @@ Check aliases
    :doc:`cppcoreguidelines-use-default-member-init <cppcoreguidelines/use-default-member-init>`, :doc:`modernize-use-default-member-init <modernize/use-default-member-init>`, "Yes"
    :doc:`fuchsia-header-anon-namespaces <fuchsia/header-anon-namespaces>`, :doc:`google-build-namespaces <google/build-namespaces>`,
    :doc:`google-readability-braces-around-statements <google/readability-braces-around-statements>`, :doc:`readability-braces-around-statements <readability/braces-around-statements>`, "Yes"
+   :doc:`google-readability-casting <google/readability-casting>`, :doc:`modernize-avoid-c-style-cast <modernize/avoid-c-style-cast>`,
    :doc:`google-readability-function-size <google/readability-function-size>`, :doc:`readability-function-size <readability/function-size>`,
    :doc:`google-readability-namespace-comments <google/readability-namespace-comments>`, :doc:`llvm-namespace-comment <llvm/namespace-comment>`,
    :doc:`hicpp-avoid-c-arrays <hicpp/avoid-c-arrays>`, :doc:`modernize-avoid-c-arrays <modernize/avoid-c-arrays>`,
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
new file mode 100644
index 0000000000000..def559a01c907
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
@@ -0,0 +1,14 @@
+.. title:: clang-tidy - modernize-avoid-c-style-cast
+
+modernize-avoid-c-style-cast
+==========================
+
+Finds usages of C-style casts.
+
+https://google.github.io/styleguide/cppguide.html#Casting
+
+Corresponding cpplint.py check name: `readability/casting`.
+
+This check is similar to ``-Wold-style-cast``, but it suggests automated fixes
+in some cases. The reported locations should not be different from the
+ones generated by ``-Wold-style-cast``.
diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c b/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
deleted file mode 100644
index f0d53395576a6..0000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// RUN: %check_clang_tidy %s google-readability-casting %t -- -- -x c
-// The testing script always adds .cpp extension to the input file name, so we
-// need to run clang-tidy directly in order to verify handling of .c files:
-// RUN: clang-tidy --checks=-*,google-readability-casting %s -- -x c++ | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
-// RUN: cp %s %t.main_file.cpp
-// RUN: clang-tidy --checks=-*,google-readability-casting -header-filter='.*' %t.main_file.cpp -- -I%S -DTEST_INCLUDE -x c++ | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
-
-#ifdef TEST_INCLUDE
-
-#undef TEST_INCLUDE
-#include "readability-casting.c"
-
-#else
-
-void f(const char *cpc) {
-  const char *cpc2 = (const char*)cpc;
-  // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: redundant cast to the same type [google-readability-casting]
-  // CHECK-FIXES: const char *cpc2 = cpc;
-  char *pc = (char*)cpc;
-  typedef const char *Typedef1;
-  (Typedef1)cpc;
-}
-
-#endif
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
new file mode 100644
index 0000000000000..7dfdc7be7560e
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
@@ -0,0 +1,24 @@
+// RUN: %check_clang_tidy %s modernize-avoid-c-style-cast %t -- -- -x c
+// The testing script always adds .cpp extension to the input file name, so we
+// need to run clang-tidy directly in order to verify handling of .c files:
+// RUN: clang-tidy --checks=-*,modernize-avoid-c-style-cast %s -- -x c++ | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
+// RUN: cp %s %t.main_file.cpp
+// RUN: clang-tidy --checks=-*,modernize-avoid-c-style-cast -header-filter='.*' %t.main_file.cpp -- -I%S -DTEST_INCLUDE -x c++ | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
+
+#ifdef TEST_INCLUDE
+
+#undef TEST_INCLUDE
+#include "avoid-c-style-cast.c"
+
+#else
+
+void f(const char *cpc) {
+  const char *cpc2 = (const char*)cpc;
+  // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: redundant cast to the same type [modernize-avoid-c-style-cast]
+  // CHECK-FIXES: const char *cpc2 = cpc;
+  char *pc = (char*)cpc;
+  typedef const char *Typedef1;
+  (Typedef1)cpc;
+}
+
+#endif
diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.cpp
similarity index 98%
rename from clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp
rename to clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.cpp
index d8e8c5017a9b2..52b4d471bda9b 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy -std=c++11-or-later %s google-readability-casting %t -- -- -fexceptions
+// RUN: %check_clang_tidy -std=c++11-or-later %s modernize-avoid-c-style-cast %t -- -- -fexceptions
 
 bool g() { return false; }
 
@@ -8,14 +8,14 @@ struct Y : public X {};
 
 void f(int a, double b, const char *cpc, const void *cpv, X *pX) {
   const char *cpc2 = (const char*)cpc;
-  // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: redundant cast to the same type [google-readability-casting]
+  // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: redundant cast to the same type [modernize-avoid-c-style-cast]
   // CHECK-FIXES: const char *cpc2 = cpc;
 
   typedef const char *Typedef1;
   typedef const char *Typedef2;
   Typedef1 t1;
   (Typedef2)t1;
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: C-style casts are discouraged; use static_cast (if needed, the cast may be redundant) [google-readability-casting]
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: C-style casts are discouraged; use static_cast (if needed, the cast may be redundant) [modernize-avoid-c-style-cast]
   // CHECK-FIXES: static_cast<Typedef2>(t1);
   (const char*)t1;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: {{.*}}; use static_cast (if needed
@@ -28,7 +28,7 @@ void f(int a, double b, const char *cpc, const void *cpv, X *pX) {
   // CHECK-FIXES: t1;
 
   char *pc = (char*)cpc;
-  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: C-style casts are discouraged; use const_cast [google-readability-casting]
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: C-style casts are discouraged; use const_cast [modernize-avoid-c-style-cast]
   // CHECK-FIXES: char *pc = const_cast<char*>(cpc);
   typedef char Char;
   Char *pChar = (Char*)pc;
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp
index ee5b1cca755ab..e86b3df34fcfc 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp
@@ -1,11 +1,11 @@
-// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,google-readability-casting' 2>&1 | FileCheck %s
+// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,modernize-avoid-c-style-cast' 2>&1 | FileCheck %s
 
 // NOLINTBEGIN(google-explicit-constructor)
-// NOLINTBEGIN(google-readability-casting)
+// NOLINTBEGIN(modernize-avoid-c-style-cast)
 class A { A(int i); };
 auto Num = (unsigned int)(-1);
 // NOLINTEND(google-explicit-constructor)
-// NOLINTEND(google-readability-casting)
+// NOLINTEND(modernize-avoid-c-style-cast)
 
 // Note: the expected output has been split over several lines so that clang-tidy
 //       does not see the "no lint" suppression comment and mistakenly assume it
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp
index 150913ce0ec69..156a5cb345dbd 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp
@@ -1,10 +1,10 @@
-// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,google-readability-casting' 2>&1 | FileCheck %s
+// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,modernize-avoid-c-style-cast' 2>&1 | FileCheck %s
 
-// NOLINTBEGIN(google-explicit-constructor,google-readability-casting)
+// NOLINTBEGIN(google-explicit-constructor,modernize-avoid-c-style-cast)
 class B { B(int i); };
 // NOLINTEND(google-explicit-constructor)
 auto Num2 = (unsigned int)(-1);
-// NOLINTEND(google-readability-casting)
+// NOLINTEND(modernize-avoid-c-style-cast)
 
 // Note: the expected output has been split over several lines so that clang-tidy
 //       does not see the "no lint" suppression comment and mistakenly assume it
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp
index f9a915c890cbb..837213227dc2d 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp
@@ -1,10 +1,10 @@
-// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,google-readability-casting' 2>&1 | FileCheck %s
+// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,modernize-avoid-c-style-cast' 2>&1 | FileCheck %s
 
 // NOLINTBEGIN(google-explicit-constructor)
-// NOLINTBEGIN(google-readability-casting)
+// NOLINTBEGIN(modernize-avoid-c-style-cast)
 class B { B(int i); };
 auto Num2 = (unsigned int)(-1);
-// NOLINTEND(google-explicit-constructor,google-readability-casting)
+// NOLINTEND(google-explicit-constructor,modernize-avoid-c-style-cast)
 
 // Note: the expected output has been split over several lines so that clang-tidy
 //       does not see the "no lint" suppression comment and mistakenly assume it
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp
index 8d7786fb8c712..ddd399dfc764f 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp
@@ -1,9 +1,9 @@
-// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,google-readability-casting' 2>&1 | FileCheck %s
+// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,modernize-avoid-c-style-cast' 2>&1 | FileCheck %s
 
 // NOLINTBEGIN(google-explicit-constructor)
 ...
[truncated]

Make the check name consistent with other modernize checks by using
singular form. Also improve documentation with concrete examples.
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

✅ With the latest revision this PR passed the C/C++ code linter.

- Updated header guards accordingly
- Updated registrations in ModernizeTidyModule.cpp and GoogleTidyModule.cpp
- Fixed documentation link formatting in google-readability-casting.rst
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

update function signature to fit into one line
Copy link
Member

@zeyi2 zeyi2 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix!

Please wait for other reviewers' reviews.

@Islam-Imad
Copy link
Contributor Author

😶‍🌫️ any feedback :)

@zeyi2 zeyi2 requested a review from localspook December 9, 2025 09:29
@zeyi2 zeyi2 changed the title [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast Dec 9, 2025
@zeyi2 zeyi2 self-requested a review December 9, 2025 10:33
Copy link
Member

@zeyi2 zeyi2 left a comment

Choose a reason for hiding this comment

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

I'll help merge this PR later, thanks for the fix :)

@Islam-Imad
Copy link
Contributor Author

I'll help merge this PR later, thanks for the fix :)

Thanks for your time :)

@zeyi2 zeyi2 merged commit ff59ecd into llvm:main Dec 9, 2025
12 checks passed

modernize-avoid-c-style-cast
============================

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Finds usages of C-style casts.

Forgot the initial line


https://google.github.io/styleguide/cppguide.html#Casting

Corresponding cpplint.py check name: `readability/casting`.
Copy link
Contributor

@vbvictor vbvictor Dec 9, 2025

Choose a reason for hiding this comment

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

This cpplint.py should be left in readability-casting.rst because it is google's tool and I see no reason to remove it from here.

@zeyi2
Copy link
Member

zeyi2 commented Dec 9, 2025

Sorry that I merged it too soon, should we revert it or fix the remaining issues in another PR?

Update: I opened #171413 to fix this.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 9, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building clang-tools-extra at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/20073

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
[188/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Parse/ParseHLSLRootSignatureTest.cpp.o
[189/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/FormulaTest.cpp.o
[190/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/ToolChainTest.cpp.o
[191/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowAnalysisContextTest.cpp.o
[192/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/CloneDetectionTest.cpp.o
[193/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/PPCallbacksTest.cpp.o
[194/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/DependencyScanning/DependencyScanningWorkerTest.cpp.o
[195/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/MacroExpansionContextTest.cpp.o
[196/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ValueTest.cpp.o
[197/1219] Building CXX object tools/clang/tools/extra/unittests/clang-tidy/CMakeFiles/ClangTidyTests.dir/TransformerClangTidyCheckTest.cpp.o
FAILED: tools/clang/tools/extra/unittests/clang-tidy/CMakeFiles/ClangTidyTests.dir/TransformerClangTidyCheckTest.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/tools/extra/unittests/clang-tidy -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang-tools-extra/unittests/clang-tidy -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang-tools-extra/unittests/clang-tidy/../../include-cleaner/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang-tools-extra/clang-tidy -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googletest/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT tools/clang/tools/extra/unittests/clang-tidy/CMakeFiles/ClangTidyTests.dir/TransformerClangTidyCheckTest.cpp.o -MF tools/clang/tools/extra/unittests/clang-tidy/CMakeFiles/ClangTidyTests.dir/TransformerClangTidyCheckTest.cpp.o.d -o tools/clang/tools/extra/unittests/clang-tidy/CMakeFiles/ClangTidyTests.dir/TransformerClangTidyCheckTest.cpp.o -c /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[198/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/AnalyzerOptionsTest.cpp.o
[199/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/IntervalPartitionTest.cpp.o
FAILED: tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/IntervalPartitionTest.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/unittests -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Tooling -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googletest/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/IntervalPartitionTest.cpp.o -MF tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/IntervalPartitionTest.cpp.o.d -o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/IntervalPartitionTest.cpp.o -c /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/IntervalPartitionTest.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[200/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SmartPointerAccessorCachingTest.cpp.o
[201/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DebugSupportTest.cpp.o
[202/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp.o
[203/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/RecordOpsTest.cpp.o
[204/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/APSIntTypeTest.cpp.o
[205/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/LoggerTest.cpp.o
[206/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TransferBranchTest.cpp.o
[207/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SimplifyConstraintsTest.cpp.o
[208/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TestingSupportTest.cpp.o
[209/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp.o
[210/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp.o
[211/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/CFGTest.cpp.o
[212/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MapLatticeTest.cpp.o
[213/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ASTOpsTest.cpp.o
[214/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp.o
[215/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/CachedConstAccessorsLatticeTest.cpp.o
[216/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SignAnalysisTest.cpp.o
[217/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/LifetimeSafetyTest.cpp.o
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/LifetimeSafetyTest.cpp: In instantiation of ‘bool clang::lifetimes::internal::{anonymous}::AreLiveAtImplMatcherP2<Annotation_type, ConfFilter_type>::gmock_Impl<arg_type>::MatchAndExplain(const arg_type&, testing::MatchResultListener*) const [with arg_type = const clang::lifetimes::internal::{anonymous}::OriginsInfo&; Annotation_type = const char*; ConfFilter_type = clang::lifetimes::internal::{anonymous}::LivenessKindFilter]’:
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/LifetimeSafetyTest.cpp:304:1:   required from here
  304 | MATCHER_P2(AreLiveAtImpl, Annotation, ConfFilter, "") {
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/LifetimeSafetyTest.cpp:314:19: warning: loop variable ‘<structured bindings>’ creates a copy from type ‘const std::pair<clang::lifetimes::internal::utils::ID<clang::lifetimes::internal::OriginTag>, clang::lifetimes::internal::LivenessKind>’ [-Wrange-loop-construct]
  314 |   for (const auto [OID, ActualConfidence] : ActualLiveSetOpt.value()) {
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/LifetimeSafetyTest.cpp:314:19: note: use reference type to prevent copying
  314 |   for (const auto [OID, ActualConfidence] : ActualLiveSetOpt.value()) {
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
      |                   &
[218/1219] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 9, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-rhel running on ppc64le-clang-rhel-test while building clang-tools-extra at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/11347

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
66.211 [854/32/5856] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/AST.cpp.o
66.215 [854/31/5857] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/InlayHints.cpp.o
66.231 [854/30/5858] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/FindTarget.cpp.o
66.233 [854/29/5859] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/CompileCommands.cpp.o
66.273 [854/28/5860] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/ParsedAST.cpp.o
66.363 [854/27/5861] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/XRefs.cpp.o
68.666 [854/26/5862] Building RISCVGenInstrInfo.inc...
68.984 [854/25/5863] Building RISCVGenGlobalISel.inc...
70.872 [854/24/5864] Building CXX object tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/GoogleTidyModule.cpp.o
70.932 [853/24/5865] Linking CXX shared library lib/libclangTidyGoogleModule.so.22.0git
FAILED: [code=1] lib/libclangTidyGoogleModule.so.22.0git 
: && /home/buildbots/llvm-external-buildbots/clang.20.1.8/bin/clang++ --gcc-toolchain=/gcc-toolchain/usr -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics  -Wl,--gc-sections  -Xlinker --dependency-file=tools/clang/tools/extra/clang-tidy/google/CMakeFiles/clangTidyGoogleModule.dir/link.d -shared -Wl,-soname,libclangTidyGoogleModule.so.22.0git -o lib/libclangTidyGoogleModule.so.22.0git tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/AvoidNSObjectNewCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/AvoidThrowingObjCExceptionCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/AvoidUnderscoreInGoogletestNameCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/DefaultArgumentsCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/ExplicitConstructorCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/ExplicitMakePairCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/FloatTypesCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/FunctionNamingCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/GlobalNamesInHeadersCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/GlobalVariableDeclarationCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/GoogleTidyModule.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/IntegerTypesCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/OverloadedUnaryAndCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/TodoCommentCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/UnnamedNamespaceInHeaderCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/UpgradeGoogletestCaseCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/UsingNamespaceDirectiveCheck.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib:"  lib/libclangTidyReadabilityModule.so.22.0git  lib/libclangTidyUtils.so.22.0git  lib/libclangTidy.so.22.0git  lib/libclangASTMatchers.so.22.0git  lib/libclangAST.so.22.0git  lib/libclangLex.so.22.0git  lib/libclangBasic.so.22.0git  lib/libLLVMFrontendOpenMP.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib && :
ld.lld: error: undefined symbol: vtable for clang::tidy::modernize::AvoidCStyleCastCheck
>>> referenced by GoogleTidyModule.cpp
>>>               tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/GoogleTidyModule.cpp.o:(.toc+0x60)
>>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
71.676 [853/23/5866] Building AArch64GenInstrInfo.inc...
72.010 [853/22/5867] Building CXX object tools/clang/tools/extra/clang-tidy/modernize/CMakeFiles/obj.clangTidyModernizeModule.dir/AvoidCStyleCastCheck.cpp.o
77.367 [853/21/5868] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
78.827 [853/20/5869] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
79.880 [853/19/5870] Building RISCVGenDAGISel.inc...
80.059 [853/18/5871] Building CXX object tools/clang/tools/extra/clang-tidy/modernize/CMakeFiles/obj.clangTidyModernizeModule.dir/ModernizeTidyModule.cpp.o
88.904 [853/17/5872] Building AMDGPUGenMCPseudoLowering.inc...
89.060 [853/16/5873] Building AMDGPUGenSDNodeInfo.inc...
89.958 [853/15/5874] Building AMDGPUGenSubtargetInfo.inc...
89.991 [853/14/5875] Building AMDGPUGenPreLegalizeGICombiner.inc...
90.139 [853/13/5876] Building AMDGPUGenRegBankGICombiner.inc...
90.619 [853/12/5877] Building AMDGPUGenPostLegalizeGICombiner.inc...
91.479 [853/11/5878] Building AMDGPUGenMCCodeEmitter.inc...
91.531 [853/10/5879] Building AMDGPUGenSearchableTables.inc...
93.884 [853/9/5880] Building AMDGPUGenDisassemblerTables.inc...
108.063 [853/8/5881] Building AMDGPUGenCallingConv.inc...
113.437 [853/7/5882] Building AMDGPUGenAsmWriter.inc...
120.281 [853/6/5883] Building AMDGPUGenInstrInfo.inc...
122.920 [853/5/5884] Building AMDGPUGenGlobalISel.inc...
123.092 [853/4/5885] Building AMDGPUGenDAGISel.inc...
144.623 [853/3/5886] Building AMDGPUGenRegisterInfo.inc...
151.206 [853/2/5887] Building AMDGPUGenAsmMatcher.inc...
153.765 [853/1/5888] Building AMDGPUGenRegisterBank.inc...
ninja: build stopped: subcommand failed.

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Dec 9, 2025
@vbvictor
Copy link
Contributor

vbvictor commented Dec 9, 2025

Opened #171427 for link failures

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 10, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building clang-tools-extra at step 4 "build stage 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/13539

Here is the relevant piece of the build log for the reference
Step 4 (build stage 1) failure: 'ninja' (failure)
...
[6090/6603] Creating library symlink lib/libclangTidyPerformanceModule.so
[6091/6603] Linking CXX shared library lib/libclangTidyAbseilModule.so.22.0git
[6092/6603] Creating library symlink lib/libclangTidyAbseilModule.so
[6093/6603] Linking CXX shared library lib/libclangTidyMiscModule.so.22.0git
[6094/6603] Creating library symlink lib/libclangTidyMiscModule.so
[6095/6603] Linking CXX shared library lib/libclangTidyReadabilityModule.so.22.0git
[6096/6603] Creating library symlink lib/libclangTidyReadabilityModule.so
[6097/6603] Linking CXX shared library lib/libclangTidyLLVMModule.so.22.0git
[6098/6603] Creating library symlink lib/libclangTidyLLVMModule.so
[6099/6603] Linking CXX shared library lib/libclangTidyGoogleModule.so.22.0git
FAILED: lib/libclangTidyGoogleModule.so.22.0git 
: && /usr/lib64/ccache/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-array-bounds -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./lib  -Wl,--gc-sections -shared -Wl,-soname,libclangTidyGoogleModule.so.22.0git -o lib/libclangTidyGoogleModule.so.22.0git tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/AvoidNSObjectNewCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/AvoidThrowingObjCExceptionCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/AvoidUnderscoreInGoogletestNameCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/DefaultArgumentsCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/ExplicitConstructorCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/ExplicitMakePairCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/FloatTypesCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/FunctionNamingCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/GlobalNamesInHeadersCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/GlobalVariableDeclarationCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/GoogleTidyModule.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/IntegerTypesCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/OverloadedUnaryAndCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/TodoCommentCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/UnnamedNamespaceInHeaderCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/UpgradeGoogletestCaseCheck.cpp.o tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/UsingNamespaceDirectiveCheck.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib:"  lib/libclangTidyReadabilityModule.so.22.0git  lib/libclangTidyUtils.so.22.0git  lib/libclangTidy.so.22.0git  lib/libclangASTMatchers.so.22.0git  lib/libclangAST.so.22.0git  lib/libclangLex.so.22.0git  lib/libclangBasic.so.22.0git  lib/libLLVMFrontendOpenMP.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib && :
tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/GoogleTidyModule.cpp.o:(.toc+0x60): undefined reference to `vtable for clang::tidy::modernize::AvoidCStyleCastCheck'
collect2: error: ld returned 1 exit status
[6100/6603] Building AMDGPUGenCallingConv.inc...
[6101/6603] Linking CXX shared library lib/libclangTidyBugproneModule.so.22.0git
[6102/6603] Building AMDGPUGenGlobalISel.inc...
[6103/6603] Linking CXX shared library lib/libclangTidyModernizeModule.so.22.0git
[6104/6603] Building AMDGPUGenInstrInfo.inc...
[6105/6603] Building AMDGPUGenDAGISel.inc...
[6106/6603] Building AMDGPUGenAsmWriter.inc...
[6107/6603] Building AMDGPUGenAsmMatcher.inc...
[6108/6603] Building AMDGPUGenRegisterBank.inc...
[6109/6603] Building AMDGPUGenRegisterInfo.inc...
ninja: build stopped: subcommand failed.

@Islam-Imad
Copy link
Contributor Author

First of all, sorry about these failure and errors.
I am wondering why such errors weren't triggered on my local machine ?
After some updates i rebuild and run the tests .
I will investigate more in this problem :)

@localspook
Copy link
Contributor

No worries! As for why it happens in CI but not locally: are you maybe on Windows and using Microsoft's toolchain? CI uses Linux, so that could be the source of the difference (just a guess though).

@vbvictor
Copy link
Contributor

First of all, sorry about these failure and errors. I am wondering why such errors weren't triggered on my local machine ? After some updates i rebuild and run the tests . I will investigate more in this problem :)

The latter comment about failure seems outdated because the initial problem must be fixed by #171427.
Why was this not caught on precommit CI? My best guess is something with building static vs dynamic libs, so linking error was not encountered in precommit CI.

@Islam-Imad
Copy link
Contributor Author

No worries! As for why it happens in CI but not locally: are you maybe on Windows and using Microsoft's toolchain? CI uses Linux, so that could be the source of the difference (just a guess though).

I use Ubuntu 24 :)
llvm project consumes around 32 G
The tests take around 30 minutes

@Islam-Imad
Copy link
Contributor Author

First of all, sorry about these failure and errors. I am wondering why such errors weren't triggered on my local machine ? After some updates i rebuild and run the tests . I will investigate more in this problem :)

The latter comment about failure seems outdated because the initial problem must be fixed by #171427. Why was this not caught on precommit CI? My best guess is something with building static vs dynamic libs, so linking error was not encountered in precommit CI.

BUILD_SHARED_LIBS:BOOL=OFF (the problem 🥲)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[clang-tidy] Rename 'google-readability-casting' check to 'modernize-avoid-c-style-cast' and keep initial as alias.

7 participants