[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-11 Thread Islam Imad via cfe-commits

Islam-Imad wrote:

> > 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 :smiling_face_with_tear:) 

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-11 Thread Islam Imad via cfe-commits

Islam-Imad wrote:

> 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 


https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-11 Thread Baranov Victor via cfe-commits

vbvictor wrote:

> 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 https://github.com/llvm/llvm-project/pull/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.

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-11 Thread Islam Imad via cfe-commits

Islam-Imad wrote:

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 :)

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread Baranov Victor via cfe-commits

vbvictor wrote:

Opened https://github.com/llvm/llvm-project/pull/171427 for link failures

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

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_MACR

[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread via cfe-commits

zeyi2 wrote:

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

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread Baranov Victor via cfe-commits

https://github.com/vbvictor edited 
https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread Baranov Victor via cfe-commits


@@ -0,0 +1,35 @@
+.. title:: clang-tidy - modernize-avoid-c-style-cast
+
+modernize-avoid-c-style-cast
+
+

vbvictor wrote:

```suggestion

Finds usages of C-style casts.
```
Forgot the initial line

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread Baranov Victor via cfe-commits


@@ -3,12 +3,10 @@
 google-readability-casting
 ==
 
+The `google-readability-casting` check is an alias, please see 
+:doc:`modernize-avoid-c-style-cast <../modernize/avoid-c-style-cast>` 
+for more information.
+
 Finds usages of C-style casts.
 
 https://google.github.io/styleguide/cppguide.html#Casting
-
-Corresponding cpplint.py check name: `readability/casting`.

vbvictor wrote:

This `cpplint.py` should be left in `readability-casting.rst` because it is 
google's tool.

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread via cfe-commits

https://github.com/zeyi2 closed https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread Islam Imad via cfe-commits

Islam-Imad wrote:

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

Thanks for your time :)

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread via cfe-commits

https://github.com/zeyi2 edited https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread via cfe-commits

https://github.com/zeyi2 approved this pull request.

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

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread Islam Imad via cfe-commits


@@ -0,0 +1,35 @@
+.. title:: clang-tidy - modernize-avoid-c-style-cast
+
+modernize-avoid-c-style-cast
+
+
+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`.
+
+C-style casts can perform a variety of different conversions (``const_cast``,
+``static_cast``, ``reinterpret_cast``, or a combination). This makes them
+dangerous as the intent is not clear, and they can silently perform unsafe
+conversions between incompatible types.

Islam-Imad wrote:

Yes it make sense :)

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread Islam Imad via cfe-commits

https://github.com/Islam-Imad updated 
https://github.com/llvm/llvm-project/pull/171058

>From b0e4d736d9085f0db54a9267883ce7fdbd118ce6 Mon Sep 17 00:00:00 2001
From: Islam-Imad 
Date: Sun, 7 Dec 2025 23:28:22 +0200
Subject: [PATCH 1/7] [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
---
 .../clang-tidy/google/CMakeLists.txt  |  1 -
 .../clang-tidy/google/GoogleTidyModule.cpp|  4 ++--
 .../AvoidCStyleCastsCheck.cpp |  4 ++--
 .../AvoidCStyleCastsCheck.h   | 12 +-
 .../clang-tidy/modernize/CMakeLists.txt   |  1 +
 .../modernize/ModernizeTidyModule.cpp |  3 +++
 clang-tools-extra/docs/ReleaseNotes.rst   |  5 
 .../checks/google/readability-casting.rst | 10 +---
 .../docs/clang-tidy/checks/list.rst   |  3 ++-
 .../checks/modernize/avoid-c-style-cast.rst   | 14 +++
 .../checkers/google/readability-casting.c | 24 ---
 .../checkers/modernize/avoid-c-style-cast.c   | 24 +++
 .../avoid-c-style-cast.cpp}   |  8 +++
 .../infrastructure/nolintbeginend-LIFO.cpp|  6 ++---
 ...lintbeginend-begin-multiple-end-single.cpp |  6 ++---
 ...lintbeginend-begin-single-end-multiple.cpp |  6 ++---
 .../nolintbeginend-mismatched-check-names.cpp |  4 ++--
 17 files changed, 75 insertions(+), 60 deletions(-)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.cpp (99%)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.h (76%)
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
 delete mode 100644 
clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
 rename 
clang-tools-extra/test/clang-tidy/checkers/{google/readability-casting.cpp => 
modernize/avoid-c-style-cast.cpp} (98%)

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(
 "google-readability-avoid-underscore-in-googletest-name");
-CheckFactories.registerCheck(
+CheckFactories.registerCheck(
 "google-readability-casting");
 CheckFactories.registerCheck(
 "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

[clang-tools-extra] [clang-tidy] Rename `google-readability-casting` to `modernize-avoid-c-style-cast` (PR #171058)

2025-12-09 Thread via cfe-commits

https://github.com/zeyi2 edited https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-09 Thread Victor Chernyakin via cfe-commits

https://github.com/localspook edited 
https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-09 Thread Victor Chernyakin via cfe-commits

https://github.com/localspook edited 
https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-09 Thread Victor Chernyakin via cfe-commits

https://github.com/localspook edited 
https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-09 Thread Victor Chernyakin via cfe-commits

https://github.com/localspook edited 
https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-09 Thread Victor Chernyakin via cfe-commits


@@ -0,0 +1,35 @@
+.. title:: clang-tidy - modernize-avoid-c-style-cast
+
+modernize-avoid-c-style-cast
+
+
+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`.
+
+C-style casts can perform a variety of different conversions (``const_cast``,
+``static_cast``, ``reinterpret_cast``, or a combination). This makes them
+dangerous as the intent is not clear, and they can silently perform unsafe
+conversions between incompatible types.

localspook wrote:

I think it would be more logical to swap the order of these two paragraphs. The 
second one reads like an introduction to the check, the first one gives some 
more specific details.

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-09 Thread Victor Chernyakin via cfe-commits

https://github.com/localspook approved this pull request.


https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread Islam Imad via cfe-commits


@@ -0,0 +1,35 @@
+.. title:: clang-tidy - modernize-avoid-c-style-cast
+
+modernize-avoid-c-style-cast
+
+
+This check is similar to ``-Wold-style-cast``, but it suggests automated fixes

Islam-Imad wrote:

Both Fixed :)

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread Islam Imad via cfe-commits

https://github.com/Islam-Imad updated 
https://github.com/llvm/llvm-project/pull/171058

>From b0e4d736d9085f0db54a9267883ce7fdbd118ce6 Mon Sep 17 00:00:00 2001
From: Islam-Imad 
Date: Sun, 7 Dec 2025 23:28:22 +0200
Subject: [PATCH 1/6] [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
---
 .../clang-tidy/google/CMakeLists.txt  |  1 -
 .../clang-tidy/google/GoogleTidyModule.cpp|  4 ++--
 .../AvoidCStyleCastsCheck.cpp |  4 ++--
 .../AvoidCStyleCastsCheck.h   | 12 +-
 .../clang-tidy/modernize/CMakeLists.txt   |  1 +
 .../modernize/ModernizeTidyModule.cpp |  3 +++
 clang-tools-extra/docs/ReleaseNotes.rst   |  5 
 .../checks/google/readability-casting.rst | 10 +---
 .../docs/clang-tidy/checks/list.rst   |  3 ++-
 .../checks/modernize/avoid-c-style-cast.rst   | 14 +++
 .../checkers/google/readability-casting.c | 24 ---
 .../checkers/modernize/avoid-c-style-cast.c   | 24 +++
 .../avoid-c-style-cast.cpp}   |  8 +++
 .../infrastructure/nolintbeginend-LIFO.cpp|  6 ++---
 ...lintbeginend-begin-multiple-end-single.cpp |  6 ++---
 ...lintbeginend-begin-single-end-multiple.cpp |  6 ++---
 .../nolintbeginend-mismatched-check-names.cpp |  4 ++--
 17 files changed, 75 insertions(+), 60 deletions(-)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.cpp (99%)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.h (76%)
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
 delete mode 100644 
clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
 rename 
clang-tools-extra/test/clang-tidy/checkers/{google/readability-casting.cpp => 
modernize/avoid-c-style-cast.cpp} (98%)

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(
 "google-readability-avoid-underscore-in-googletest-name");
-CheckFactories.registerCheck(
+CheckFactories.registerCheck(
 "google-readability-casting");
 CheckFactories.registerCheck(
 "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

[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread via cfe-commits


@@ -0,0 +1,35 @@
+.. title:: clang-tidy - modernize-avoid-c-style-cast
+
+modernize-avoid-c-style-cast
+
+
+This check is similar to ``-Wold-style-cast``, but it suggests automated fixes

EugeneZelenko wrote:

```suggestion
This check is similar to `-Wold-style-cast`, but it suggests automated fixes
```

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread via cfe-commits


@@ -0,0 +1,35 @@
+.. title:: clang-tidy - modernize-avoid-c-style-cast
+
+modernize-avoid-c-style-cast
+
+
+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``.

EugeneZelenko wrote:

```suggestion
generated by `-Wold-style-cast`.
```

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread via cfe-commits

https://github.com/zeyi2 approved this pull request.

LGTM, thanks for the fix!

Please wait for other reviewers' reviews.

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread Islam Imad via cfe-commits

https://github.com/Islam-Imad updated 
https://github.com/llvm/llvm-project/pull/171058

>From b0e4d736d9085f0db54a9267883ce7fdbd118ce6 Mon Sep 17 00:00:00 2001
From: Islam-Imad 
Date: Sun, 7 Dec 2025 23:28:22 +0200
Subject: [PATCH 1/5] [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
---
 .../clang-tidy/google/CMakeLists.txt  |  1 -
 .../clang-tidy/google/GoogleTidyModule.cpp|  4 ++--
 .../AvoidCStyleCastsCheck.cpp |  4 ++--
 .../AvoidCStyleCastsCheck.h   | 12 +-
 .../clang-tidy/modernize/CMakeLists.txt   |  1 +
 .../modernize/ModernizeTidyModule.cpp |  3 +++
 clang-tools-extra/docs/ReleaseNotes.rst   |  5 
 .../checks/google/readability-casting.rst | 10 +---
 .../docs/clang-tidy/checks/list.rst   |  3 ++-
 .../checks/modernize/avoid-c-style-cast.rst   | 14 +++
 .../checkers/google/readability-casting.c | 24 ---
 .../checkers/modernize/avoid-c-style-cast.c   | 24 +++
 .../avoid-c-style-cast.cpp}   |  8 +++
 .../infrastructure/nolintbeginend-LIFO.cpp|  6 ++---
 ...lintbeginend-begin-multiple-end-single.cpp |  6 ++---
 ...lintbeginend-begin-single-end-multiple.cpp |  6 ++---
 .../nolintbeginend-mismatched-check-names.cpp |  4 ++--
 17 files changed, 75 insertions(+), 60 deletions(-)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.cpp (99%)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.h (76%)
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
 delete mode 100644 
clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
 rename 
clang-tools-extra/test/clang-tidy/checkers/{google/readability-casting.cpp => 
modernize/avoid-c-style-cast.cpp} (98%)

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(
 "google-readability-avoid-underscore-in-googletest-name");
-CheckFactories.registerCheck(
+CheckFactories.registerCheck(
 "google-readability-casting");
 CheckFactories.registerCheck(
 "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

[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread via cfe-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff origin/main HEAD --extensions c,cpp,h -- 
clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c 
clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp 
clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp 
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp 
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp
 
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp
 
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp
 clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastCheck.cpp 
clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastCheck.h 
clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.cpp 
--diff_from_common_commit
``

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:





View the diff from clang-format here.


``diff
diff --git a/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastCheck.cpp
index 232ed2968..7f9bf6397 100644
--- a/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastCheck.cpp
@@ -16,8 +16,7 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::modernize {
 
-void AvoidCStyleCastCheck::registerMatchers(
-ast_matchers::MatchFinder *Finder) {
+void AvoidCStyleCastCheck::registerMatchers(ast_matchers::MatchFinder *Finder) 
{
   Finder->addMatcher(
   cStyleCastExpr(
   // Filter out (EnumType)IntegerLiteral construct, which is generated

``




https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread Islam Imad via cfe-commits

https://github.com/Islam-Imad updated 
https://github.com/llvm/llvm-project/pull/171058

>From b0e4d736d9085f0db54a9267883ce7fdbd118ce6 Mon Sep 17 00:00:00 2001
From: Islam-Imad 
Date: Sun, 7 Dec 2025 23:28:22 +0200
Subject: [PATCH 1/4] [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
---
 .../clang-tidy/google/CMakeLists.txt  |  1 -
 .../clang-tidy/google/GoogleTidyModule.cpp|  4 ++--
 .../AvoidCStyleCastsCheck.cpp |  4 ++--
 .../AvoidCStyleCastsCheck.h   | 12 +-
 .../clang-tidy/modernize/CMakeLists.txt   |  1 +
 .../modernize/ModernizeTidyModule.cpp |  3 +++
 clang-tools-extra/docs/ReleaseNotes.rst   |  5 
 .../checks/google/readability-casting.rst | 10 +---
 .../docs/clang-tidy/checks/list.rst   |  3 ++-
 .../checks/modernize/avoid-c-style-cast.rst   | 14 +++
 .../checkers/google/readability-casting.c | 24 ---
 .../checkers/modernize/avoid-c-style-cast.c   | 24 +++
 .../avoid-c-style-cast.cpp}   |  8 +++
 .../infrastructure/nolintbeginend-LIFO.cpp|  6 ++---
 ...lintbeginend-begin-multiple-end-single.cpp |  6 ++---
 ...lintbeginend-begin-single-end-multiple.cpp |  6 ++---
 .../nolintbeginend-mismatched-check-names.cpp |  4 ++--
 17 files changed, 75 insertions(+), 60 deletions(-)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.cpp (99%)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.h (76%)
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
 delete mode 100644 
clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
 rename 
clang-tools-extra/test/clang-tidy/checkers/{google/readability-casting.cpp => 
modernize/avoid-c-style-cast.cpp} (98%)

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(
 "google-readability-avoid-underscore-in-googletest-name");
-CheckFactories.registerCheck(
+CheckFactories.registerCheck(
 "google-readability-casting");
 CheckFactories.registerCheck(
 "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

[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread via cfe-commits


@@ -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.

zeyi2 wrote:

> I expected the formatting tool will do that.

We will soon introduce [doc8](https://github.com/PyCQA/doc8) to the CI 
workflow. However it is not landed yet and AFAIK manual formatting can't be 
avoided.

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread Islam Imad via cfe-commits


@@ -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

Islam-Imad wrote:

for the description i add it into modernize.

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread via cfe-commits


@@ -3,12 +3,10 @@
 google-readability-casting
 ==
 
+The `google-readability-casting` check is an alias, please see 
+:doc:`modernize-avoid-c-style-cast <../modernize/avoid-c-style-cast.html>`_ 

zeyi2 wrote:

```suggestion
:doc:`modernize-avoid-c-style-cast <../modernize/avoid-c-style-cast>`
```

I think this fixes the CI failure.

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread via cfe-commits

https://github.com/zeyi2 requested changes to this pull request.


https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread Islam Imad via cfe-commits




Islam-Imad wrote:

i changed it.
should i also change the class name ?

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread via cfe-commits

github-actions[bot] wrote:




:warning: C/C++ code linter, clang-tidy found issues in your code. :warning:



You can test this locally with the following command:


```bash

git diff -U0 origin/main...HEAD -- 
clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp 
clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp 
clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastCheck.cpp 
clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastCheck.h |
python3 clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py   -path build -p1 
-quiet
```





View the output from clang-tidy here.


```

clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastCheck.h:9:9: warning: 
header guard does not follow preferred style [llvm-header-guard]
9 | #ifndef 
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTSCHECK_H
  | 
^~~
  | 
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTCHECK_H
   10 | #define 
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTSCHECK_H
  | 
~~~
  | 
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTCHECK_H
```




https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread via cfe-commits




zeyi2 wrote:

> i changed it. should i also change the class name ?

Yes, you can refer to [this meta 
issue](https://github.com/llvm/llvm-project/issues/157287) for existing 
examples :)

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread Islam Imad via cfe-commits


@@ -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.

Islam-Imad wrote:

sorry bro :)
i expected the formatting tool will do that.

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-08 Thread Islam Imad via cfe-commits

https://github.com/Islam-Imad updated 
https://github.com/llvm/llvm-project/pull/171058

>From b0e4d736d9085f0db54a9267883ce7fdbd118ce6 Mon Sep 17 00:00:00 2001
From: Islam-Imad 
Date: Sun, 7 Dec 2025 23:28:22 +0200
Subject: [PATCH 1/3] [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
---
 .../clang-tidy/google/CMakeLists.txt  |  1 -
 .../clang-tidy/google/GoogleTidyModule.cpp|  4 ++--
 .../AvoidCStyleCastsCheck.cpp |  4 ++--
 .../AvoidCStyleCastsCheck.h   | 12 +-
 .../clang-tidy/modernize/CMakeLists.txt   |  1 +
 .../modernize/ModernizeTidyModule.cpp |  3 +++
 clang-tools-extra/docs/ReleaseNotes.rst   |  5 
 .../checks/google/readability-casting.rst | 10 +---
 .../docs/clang-tidy/checks/list.rst   |  3 ++-
 .../checks/modernize/avoid-c-style-cast.rst   | 14 +++
 .../checkers/google/readability-casting.c | 24 ---
 .../checkers/modernize/avoid-c-style-cast.c   | 24 +++
 .../avoid-c-style-cast.cpp}   |  8 +++
 .../infrastructure/nolintbeginend-LIFO.cpp|  6 ++---
 ...lintbeginend-begin-multiple-end-single.cpp |  6 ++---
 ...lintbeginend-begin-single-end-multiple.cpp |  6 ++---
 .../nolintbeginend-mismatched-check-names.cpp |  4 ++--
 17 files changed, 75 insertions(+), 60 deletions(-)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.cpp (99%)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.h (76%)
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
 delete mode 100644 
clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
 rename 
clang-tools-extra/test/clang-tidy/checkers/{google/readability-casting.cpp => 
modernize/avoid-c-style-cast.cpp} (98%)

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(
 "google-readability-avoid-underscore-in-googletest-name");
-CheckFactories.registerCheck(
+CheckFactories.registerCheck(
 "google-readability-casting");
 CheckFactories.registerCheck(
 "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

[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-07 Thread via cfe-commits

https://github.com/zeyi2 edited https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-07 Thread via cfe-commits




zeyi2 wrote:

IMO this file should be renamed to `AvoidCStyleCastCheck.h` to better align 
with the check name: `modernize-avoid-c-style-cast`, same as the `.cpp` and the 
related files.

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-07 Thread via cfe-commits


@@ -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

zeyi2 wrote:

I think this should be moved to the docs of `google-readability-casting` as 
suggested 
[here](https://github.com/llvm/llvm-project/pull/170986/files#r2595575019)

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-07 Thread via cfe-commits

https://github.com/zeyi2 requested changes to this pull request.


https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-07 Thread via cfe-commits


@@ -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.

zeyi2 wrote:

Please maintain 80 chars limit :)
```suggestion
The `google-readability-casting` check is an alias, please see 
`modernize-avoid-c-style-cast <../modernize/avoid-c-style-cast.html>`_ 
for more information.
```

https://github.com/llvm/llvm-project/pull/171058
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-07 Thread Islam Imad via cfe-commits

https://github.com/Islam-Imad updated 
https://github.com/llvm/llvm-project/pull/171058

>From b0e4d736d9085f0db54a9267883ce7fdbd118ce6 Mon Sep 17 00:00:00 2001
From: Islam-Imad 
Date: Sun, 7 Dec 2025 23:28:22 +0200
Subject: [PATCH 1/2] [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
---
 .../clang-tidy/google/CMakeLists.txt  |  1 -
 .../clang-tidy/google/GoogleTidyModule.cpp|  4 ++--
 .../AvoidCStyleCastsCheck.cpp |  4 ++--
 .../AvoidCStyleCastsCheck.h   | 12 +-
 .../clang-tidy/modernize/CMakeLists.txt   |  1 +
 .../modernize/ModernizeTidyModule.cpp |  3 +++
 clang-tools-extra/docs/ReleaseNotes.rst   |  5 
 .../checks/google/readability-casting.rst | 10 +---
 .../docs/clang-tidy/checks/list.rst   |  3 ++-
 .../checks/modernize/avoid-c-style-cast.rst   | 14 +++
 .../checkers/google/readability-casting.c | 24 ---
 .../checkers/modernize/avoid-c-style-cast.c   | 24 +++
 .../avoid-c-style-cast.cpp}   |  8 +++
 .../infrastructure/nolintbeginend-LIFO.cpp|  6 ++---
 ...lintbeginend-begin-multiple-end-single.cpp |  6 ++---
 ...lintbeginend-begin-single-end-multiple.cpp |  6 ++---
 .../nolintbeginend-mismatched-check-names.cpp |  4 ++--
 17 files changed, 75 insertions(+), 60 deletions(-)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.cpp (99%)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.h (76%)
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
 delete mode 100644 
clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
 rename 
clang-tools-extra/test/clang-tidy/checkers/{google/readability-casting.cpp => 
modernize/avoid-c-style-cast.cpp} (98%)

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(
 "google-readability-avoid-underscore-in-googletest-name");
-CheckFactories.registerCheck(
+CheckFactories.registerCheck(
 "google-readability-casting");
 CheckFactories.registerCheck(
 "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

[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-07 Thread via cfe-commits

llvmbot wrote:




@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
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(
 "google-readability-avoid-underscore-in-googletest-name");
-CheckFactories.registerCheck(
+CheckFactories.registerCheck(
 "google-readability-casting");
 CheckFactories.registerCheck(
 "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-t

[clang-tools-extra] [clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast (PR #171058)

2025-12-07 Thread Islam Imad via cfe-commits

https://github.com/Islam-Imad created 
https://github.com/llvm/llvm-project/pull/171058

[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

>From b0e4d736d9085f0db54a9267883ce7fdbd118ce6 Mon Sep 17 00:00:00 2001
From: Islam-Imad 
Date: Sun, 7 Dec 2025 23:28:22 +0200
Subject: [PATCH] [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
---
 .../clang-tidy/google/CMakeLists.txt  |  1 -
 .../clang-tidy/google/GoogleTidyModule.cpp|  4 ++--
 .../AvoidCStyleCastsCheck.cpp |  4 ++--
 .../AvoidCStyleCastsCheck.h   | 12 +-
 .../clang-tidy/modernize/CMakeLists.txt   |  1 +
 .../modernize/ModernizeTidyModule.cpp |  3 +++
 clang-tools-extra/docs/ReleaseNotes.rst   |  5 
 .../checks/google/readability-casting.rst | 10 +---
 .../docs/clang-tidy/checks/list.rst   |  3 ++-
 .../checks/modernize/avoid-c-style-cast.rst   | 14 +++
 .../checkers/google/readability-casting.c | 24 ---
 .../checkers/modernize/avoid-c-style-cast.c   | 24 +++
 .../avoid-c-style-cast.cpp}   |  8 +++
 .../infrastructure/nolintbeginend-LIFO.cpp|  6 ++---
 ...lintbeginend-begin-multiple-end-single.cpp |  6 ++---
 ...lintbeginend-begin-single-end-multiple.cpp |  6 ++---
 .../nolintbeginend-mismatched-check-names.cpp |  4 ++--
 17 files changed, 75 insertions(+), 60 deletions(-)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.cpp (99%)
 rename clang-tools-extra/clang-tidy/{google => 
modernize}/AvoidCStyleCastsCheck.h (76%)
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
 delete mode 100644 
clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
 rename 
clang-tools-extra/test/clang-tidy/checkers/{google/readability-casting.cpp => 
modernize/avoid-c-style-cast.cpp} (98%)

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(
 "google-readability-avoid-underscore-in-googletest-name");
-CheckFactories.registerCheck(
+CheckFactories.registerCheck(
 "google-readability-casting");
 CheckFactories.registerCheck(
 "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 i