[clang-tools-extra] [clang-tidy] Improve redundant-casting check for binary operation (PR #191386)

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 03:34:26 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 3121 tests passed
* 30 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### Clang Tools
<details>
<summary>Clang Tools.clang-tidy/checkers/readability/redundant-casting.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
C:/Python312/python.exe C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py -std=c++11,c++14,c++17 C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\readability\redundant-casting.cpp readability-redundant-casting C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp -- -- -fno-delayed-template-parsing
# executed command: C:/Python312/python.exe 'C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py' -std=c++11,c++14,c++17 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\readability\redundant-casting.cpp' readability-redundant-casting 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp' -- -- -fno-delayed-template-parsing
# .---command stdout------------
# | Running ['clang-tidy', '--experimental-custom-checks', 'C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\readability\\Output\\redundant-casting.cpp.tmp.cpp', '-fix', '--checks=-*,readability-redundant-casting', '--config={}', '--', '-fno-delayed-template-parsing', '-std=c++11', '-nostdinc++', '-isystem', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\Inputs\\Headers\\std']...
# | ------------------------ clang-tidy output -----------------------
# | 29 warnings generated.
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:25:11: warning: redundant explicit casting to the same type 'A' as the sub-expression, remove this casting [readability-redundant-casting]
# |    25 |   A& a1 = static_cast<A&>(value);
# |       |           ^~~~~~~~~~~~~~~~     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:25:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:25:32: note: FIX-IT applied suggested code changes
# |    25 |   A& a1 = static_cast<A&>(value);
# |       |                                ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:24:36: note: source type originates from referencing this parameter
# |    24 | void testRedundantStaticCasting(A& value) {
# |       |                                 ~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:32:11: warning: redundant explicit casting to the same type 'A' as the sub-expression, remove this casting [readability-redundant-casting]
# |    32 |   A& a2 = const_cast<A&>(value);
# |       |           ^~~~~~~~~~~~~~~     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:32:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:32:31: note: FIX-IT applied suggested code changes
# |    32 |   A& a2 = const_cast<A&>(value);
# |       |                               ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:31:36: note: source type originates from referencing this parameter
# |    31 | void testRedundantConstCasting1(A& value) {
# |       |                                 ~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:39:17: warning: redundant explicit casting to the same type 'const A' as the sub-expression, remove this casting [readability-redundant-casting]
# |    39 |   const A& a3 = const_cast<const A&>(value);
# |       |                 ^~~~~~~~~~~~~~~~~~~~~     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:39:17: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:39:43: note: FIX-IT applied suggested code changes
# |    39 |   const A& a3 = const_cast<const A&>(value);
# |       |                                           ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:38:42: note: source type originates from referencing this parameter
# |    38 | void testRedundantConstCasting2(const A& value) {
# |       |                                       ~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:46:11: warning: redundant explicit casting to the same type 'A' as the sub-expression, remove this casting [readability-redundant-casting]
# |    46 |   A& a4 = reinterpret_cast<A&>(value);
# |       |           ^~~~~~~~~~~~~~~~~~~~~     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:46:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:46:37: note: FIX-IT applied suggested code changes
# |    46 |   A& a4 = reinterpret_cast<A&>(value);
# |       |                                     ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:45:41: note: source type originates from referencing this parameter
# |    45 | void testRedundantReinterpretCasting(A& value) {
# |       |                                      ~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:53:11: warning: redundant explicit casting to the same type 'A' as the sub-expression, remove this casting [readability-redundant-casting]
# |    53 |   A& a5 = (A&)(value);
# |       |           ^~~~~     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:53:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:53:21: note: FIX-IT applied suggested code changes
# |    53 |   A& a5 = (A&)(value);
# |       |                     ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:52:31: note: source type originates from referencing this parameter
# |    52 | void testRedundantCCasting(A& value) {
# |       |                            ~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:60:11: warning: redundant explicit casting to the same type 'A' as the sub-expression, remove this casting [readability-redundant-casting]
# |    60 |   A& a6 = static_cast<A&>(reinterpret_cast<A&>(value));
# |       |           ^~~~~~~~~~~~~~~~                           ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:60:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:60:54: note: FIX-IT applied suggested code changes
# |    60 |   A& a6 = static_cast<A&>(reinterpret_cast<A&>(value));
# |       |                                                      ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:60:27: warning: redundant explicit casting to the same type 'A' as the sub-expression, remove this casting [readability-redundant-casting]
# |    60 |   A& a6 = static_cast<A&>(reinterpret_cast<A&>(value));
# |       |                           ^~~~~~~~~~~~~~~~~~~~~     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:60:27: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:60:53: note: FIX-IT applied suggested code changes
# |    60 |   A& a6 = static_cast<A&>(reinterpret_cast<A&>(value));
# |       |                                                     ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:59:27: note: source type originates from referencing this parameter
# |    59 | void testDoubleCasting(A& value) {
# |       |                        ~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:79:11: warning: redundant explicit casting to the same type 'A' as the sub-expression, remove this casting [readability-redundant-casting]
# |    79 |   A& a8 = static_cast<A&>(a);
# |       |           ^~~~~~~~~~~~~~~~ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:79:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:79:28: note: FIX-IT applied suggested code changes
# |    79 |   A& a8 = static_cast<A&>(a);
# |       |                            ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:78:8: note: source type originates from referencing this variable
# |    78 |   auto a = getA();
# |       |   ~~~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:87:17: warning: redundant explicit casting to the same type 'const A' as the sub-expression, remove this casting [readability-redundant-casting]
# |    87 |   const A& a9 = static_cast<const A&>(a);
# |       |                 ^~~~~~~~~~~~~~~~~~~~~~ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:87:17: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:87:40: note: FIX-IT applied suggested code changes
# |    87 |   const A& a9 = static_cast<const A&>(a);
# |       |                                        ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:86:14: note: source type originates from referencing this variable
# |    86 |   const auto a = getA();
# |       |         ~~~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:95:12: warning: redundant explicit casting to the same type 'A *' as the sub-expression, remove this casting [readability-redundant-casting]
# |    95 |   A* a10 = static_cast<A*>(a);
# |       |            ^~~~~~~~~~~~~~~~ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:95:12: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:95:29: note: FIX-IT applied suggested code changes
# |    95 |   A* a10 = static_cast<A*>(a);
# |       |                             ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:94:9: note: source type originates from referencing this variable
# |    94 |   auto* a = &ptr;
# |       |   ~~~~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:104:10: warning: redundant explicit casting to the same type 'T' as the sub-expression, remove this casting [readability-redundant-casting]
# |   104 |   T& t = static_cast<T&>(value);
# |       |          ^~~~~~~~~~~~~~~~     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:104:10: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:104:31: note: FIX-IT applied suggested code changes
# |   104 |   T& t = static_cast<T&>(value);
# |       |                               ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:102:38: note: source type originates from referencing this parameter
# |   102 | void testRedundantTemplateCasting(T& value) {
# |       |                                   ~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:134:12: warning: redundant explicit casting to the same type 'A *' as the sub-expression, remove this casting [readability-redundant-casting]
# |   134 |   A* a13 = static_cast<A*>(PTR_NAME);
# |       |            ^~~~~~~~~~~~~~~~        ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:134:12: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:134:36: note: FIX-IT applied suggested code changes
# |   134 |   A* a13 = static_cast<A*>(PTR_NAME);
# |       |                                    ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:133:26: note: source type originates from referencing this parameter
# |   133 | void testMacroCasting(A* PTR_NAME) {
# |       |                       ~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:131:18: note: expanded from macro 'PTR_NAME'
# |   131 | #define PTR_NAME name
# |       |                  ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:164:11: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
# |   164 |   int b = int(a);
# |       |           ^~~~ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:164:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:164:16: note: FIX-IT applied suggested code changes
# |   164 |   int b = int(a);
# |       |                ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:163:42: note: source type originates from referencing this parameter
# |   163 | void testFunctionalCastWithPrimitive(int a) {
# |       |                                      ~~~ ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:175:37: warning: redundant explicit casting to the same type 'float' as the sub-expression, remove this casting [readability-redundant-casting]
# |   175 |   const auto diff_types_operands1 { static_cast<float>(1.0f + 1) };
# |       |                                     ^~~~~~~~~~~~~~~~~~~        ~
# |       |                                     (                          )
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:175:37: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:175:64: note: FIX-IT applied suggested code changes
# |   175 |   const auto diff_types_operands1 { static_cast<float>(1.0f + 1) };
# |       |                                                                ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:179:37: warning: redundant explicit casting to the same type 'float' as the sub-expression, remove this casting [readability-redundant-casting]
# |   179 |   const auto diff_types_operands2 { static_cast<float>(2 + 3.0f) };
# |       |                                     ^~~~~~~~~~~~~~~~~~~        ~
# |       |                                     (                          )
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:179:37: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:179:64: note: FIX-IT applied suggested code changes
# |   179 |   const auto diff_types_operands2 { static_cast<float>(2 + 3.0f) };
# |       |                                                                ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:183:37: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
# |   183 |   const auto diff_types_operands3 { static_cast<int>(1 + static_cast<uint8_t>(1)) };
# |       |                                     ^~~~~~~~~~~~~~~~~                           ~
# |       |                                     (                                           )
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:183:37: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:183:81: note: FIX-IT applied suggested code changes
# |   183 |   const auto diff_types_operands3 { static_cast<int>(1 + static_cast<uint8_t>(1)) };
# |       |                                                                                 ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:188:5: warning: redundant explicit casting to the same type 'size_t' (aka 'unsigned long long') as the sub-expression, remove this casting [readability-redundant-casting]
# |   188 |     static_cast<size_t>(static_cast<size_t>(3) + 2)
# |       |     ^~~~~~~~~~~~~~~~~~~~                          ~
# |       |     (                                             )
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:188:5: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:188:51: note: FIX-IT applied suggested code changes
# |   188 |     static_cast<size_t>(static_cast<size_t>(3) + 2)
# |       |                                                   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:193:37: warning: redundant explicit casting to the same type 'unsigned int' as the sub-expression, remove this casting [readability-redundant-casting]
# |   193 |   const auto diff_types_operands5 { unsigned(7 + unsigned(4)) };
# |       |                                     ^~~~~~~~~               ~
# |       |                                     (                       )
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:193:37: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:193:61: note: FIX-IT applied suggested code changes
# |   193 |   const auto diff_types_operands5 { unsigned(7 + unsigned(4)) };
# |       |                                                             ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:230:11: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
# |   230 |   int c = static_cast<int>(aa + bb) * aa;
# |       |           ^~~~~~~~~~~~~~~~~       ~
# |       |           (                       )
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:230:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:230:35: note: FIX-IT applied suggested code changes
# |   230 |   int c = static_cast<int>(aa + bb) * aa;
# |       |                                   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:236:11: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
# |   236 |   int c = static_cast<int>((a+b))*a;
# |       |           ^~~~~~~~~~~~~~~~~~   ~~
# |       |           (                    )
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:236:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:236:32: note: FIX-IT applied suggested code changes
# |   236 |   int c = static_cast<int>((a+b))*a;
# |       |                                ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:243:13: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
# |   243 |   int&& c = static_cast<int&&>(10);
# |       |             ^~~~~~~~~~~~~~~~~~~  ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:243:13: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:243:34: note: FIX-IT applied suggested code changes
# |   243 |   int&& c = static_cast<int&&>(10);
# |       |                                  ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:250:11: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
# |   250 |   int a = static_cast<int>(V);
# |       |           ^~~~~~~~~~~~~~~~~ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:250:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:250:29: note: FIX-IT applied suggested code changes
# |   250 |   int a = static_cast<int>(V);
# |       |                             ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:248:15: note: source type originates from referencing this non-type template parameter
# |   248 | template <int V>
# |       |               ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:263:9: warning: redundant explicit casting to the same type 'T' as the sub-expression, remove this casting [readability-redundant-casting]
# |   263 |   T a = static_cast<T>(V);
# |       |         ^~~~~~~~~~~~~~~ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:263:9: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:263:25: note: FIX-IT applied suggested code changes
# |   263 |   T a = static_cast<T>(V);
# |       |                         ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:261:25: note: source type originates from referencing this non-type template parameter
# |   261 | template <typename T, T V>
# |       |                         ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:272:17: warning: redundant explicit casting to the same type 'int (*)()' as the sub-expression, remove this casting [readability-redundant-casting]
# |   272 |   int (*fp)() = (int(*)(void))&f;
# |       |                 ^~~~~~~~~~~~~~  
# |       |                 (               )
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:272:17: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:272:33: note: FIX-IT applied suggested code changes
# | clang-tidy applied 48 of 48 suggested fixes.
# | 
# |   272 |   int (*fp)() = (int(*)(void))&f;
# |       |                                 ^
# | 
# | ------------------------------------------------------------------
# | diff -u C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.orig C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp failed:
# | --- C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.orig	2026-04-11 10:33:13.851939200 +0000
# | +++ C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp	2026-04-11 10:33:13.936396900 +0000
# | @@ -22,42 +22,42 @@
# |  A getA();
# | 
# |  
# | 
# |  void testRedundantStaticCasting(A& value) {
# | 
# | -  A& a1 = static_cast<A&>(value);
# | 
# | +  A& a1 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testRedundantConstCasting1(A& value) {
# | 
# | -  A& a2 = const_cast<A&>(value);
# | 
# | +  A& a2 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testRedundantConstCasting2(const A& value) {
# | 
# | -  const A& a3 = const_cast<const A&>(value);
# | 
# | +  const A& a3 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testRedundantReinterpretCasting(A& value) {
# | 
# | -  A& a4 = reinterpret_cast<A&>(value);
# | 
# | +  A& a4 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testRedundantCCasting(A& value) {
# | 
# | -  A& a5 = (A&)(value);
# | 
# | +  A& a5 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testDoubleCasting(A& value) {
# | 
# | -  A& a6 = static_cast<A&>(reinterpret_cast<A&>(value));
# | 
# | +  A& a6 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -76,7 +76,7 @@
# |  
# | 
# |  void testCastingWithAuto() {
# | 
# |    auto a = getA();
# | 
# | -  A& a8 = static_cast<A&>(a);
# | 
# | +  A& a8 = a;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -84,7 +84,7 @@
# |  
# | 
# |  void testCastingWithConstAuto() {
# | 
# |    const auto a = getA();
# | 
# | -  const A& a9 = static_cast<const A&>(a);
# | 
# | +  const A& a9 = a;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -92,7 +92,7 @@
# |  
# | 
# |  void testCastingWithAutoPtr(A& ptr) {
# | 
# |    auto* a = &ptr;
# | 
# | -  A* a10 = static_cast<A*>(a);
# | 
# | +  A* a10 = a;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -101,7 +101,7 @@
# |  template<typename T>
# | 
# |  void testRedundantTemplateCasting(T& value) {
# | 
# |    A& a = static_cast<A&>(value);
# | 
# | -  T& t = static_cast<T&>(value);
# | 
# | +  T& t = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -131,7 +131,7 @@
# |  #define PTR_NAME name
# | 
# |  
# | 
# |  void testMacroCasting(A* PTR_NAME) {
# | 
# | -  A* a13 = static_cast<A*>(PTR_NAME);
# | 
# | +  A* a13 = PTR_NAME;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | @@ -161,7 +161,7 @@
# |  }
# | 
# |  
# | 
# |  void testFunctionalCastWithPrimitive(int a) {
# | 
# | -  int b = int(a);
# | 
# | +  int b = a;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | @@ -172,25 +172,25 @@
# |  }
# | 
# |  
# | 
# |  void testBinaryOperatorRedundantCasting() {
# | 
# | -  const auto diff_types_operands1 { static_cast<float>(1.0f + 1) };
# | 
# | +  const auto diff_types_operands1 { (1.0f + 1) };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# | -  const auto diff_types_operands2 { static_cast<float>(2 + 3.0f) };
# | 
# | +  const auto diff_types_operands2 { (2 + 3.0f) };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# | -  const auto diff_types_operands3 { static_cast<int>(1 + static_cast<uint8_t>(1)) };
# | 
# | +  const auto diff_types_operands3 { (1 + static_cast<uint8_t>(1)) };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# |    const auto diff_types_operands4 {
# | 
# | -    static_cast<size_t>(static_cast<size_t>(3) + 2)
# | 
# | +    (static_cast<size_t>(3) + 2)
# | 
# |    };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# | -  const auto diff_types_operands5 { unsigned(7 + unsigned(4)) };
# | 
# | +  const auto diff_types_operands5 { (7 + unsigned(4)) };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# | @@ -227,27 +227,27 @@
# |  };
# | 
# |  
# | 
# |  void testAddOperation(int aa, int bb) {
# | 
# | -  int c = static_cast<int>(aa + bb) * aa;
# | 
# | +  int c = (aa + bb) * aa;
# | 
# |   //
# | 
# |   //
# | 
# |  }
# | 
# |  
# | 
# |  void testAddOperationWithParen(int a, int b) {
# | 
# | -  int c = static_cast<int>((a+b))*a;
# | 
# | +  int c = (a+b)*a;
# | 
# |   //
# | 
# |   //
# | 
# |  }
# | 
# |  
# | 
# |  void testRValueCast(int&& a) {
# | 
# |    int&& b = static_cast<int&&>(a);
# | 
# | -  int&& c = static_cast<int&&>(10);
# | 
# | +  int&& c = 10;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  template <int V>
# | 
# |  void testRedundantNTTPCasting() {
# | 
# | -  int a = static_cast<int>(V);
# | 
# | +  int a = V;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -260,7 +260,7 @@
# |  
# | 
# |  template <typename T, T V>
# | 
# |  void testRedundantDependentNTTPCasting() {
# | 
# | -  T a = static_cast<T>(V);
# | 
# | +  T a = V;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -269,7 +269,7 @@
# |  namespace gh170476 {
# | 
# |  int f(void);
# | 
# |  int g1() {
# | 
# | -  int (*fp)() = (int(*)(void))&f;
# | 
# | +  int (*fp)() = (&f);
# | 
# |    //
# | 
# |    //
# | 
# |    return fp();
# | 
# | 
# | ------------------------------ Fixes -----------------------------
# | --- C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.orig	2026-04-11 10:33:13.851939200 +0000
# | +++ C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp	2026-04-11 10:33:13.936396900 +0000
# | @@ -22,42 +22,42 @@
# |  A getA();
# | 
# |  
# | 
# |  void testRedundantStaticCasting(A& value) {
# | 
# | -  A& a1 = static_cast<A&>(value);
# | 
# | +  A& a1 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testRedundantConstCasting1(A& value) {
# | 
# | -  A& a2 = const_cast<A&>(value);
# | 
# | +  A& a2 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testRedundantConstCasting2(const A& value) {
# | 
# | -  const A& a3 = const_cast<const A&>(value);
# | 
# | +  const A& a3 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testRedundantReinterpretCasting(A& value) {
# | 
# | -  A& a4 = reinterpret_cast<A&>(value);
# | 
# | +  A& a4 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testRedundantCCasting(A& value) {
# | 
# | -  A& a5 = (A&)(value);
# | 
# | +  A& a5 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void testDoubleCasting(A& value) {
# | 
# | -  A& a6 = static_cast<A&>(reinterpret_cast<A&>(value));
# | 
# | +  A& a6 = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -76,7 +76,7 @@
# |  
# | 
# |  void testCastingWithAuto() {
# | 
# |    auto a = getA();
# | 
# | -  A& a8 = static_cast<A&>(a);
# | 
# | +  A& a8 = a;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -84,7 +84,7 @@
# |  
# | 
# |  void testCastingWithConstAuto() {
# | 
# |    const auto a = getA();
# | 
# | -  const A& a9 = static_cast<const A&>(a);
# | 
# | +  const A& a9 = a;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -92,7 +92,7 @@
# |  
# | 
# |  void testCastingWithAutoPtr(A& ptr) {
# | 
# |    auto* a = &ptr;
# | 
# | -  A* a10 = static_cast<A*>(a);
# | 
# | +  A* a10 = a;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -101,7 +101,7 @@
# |  template<typename T>
# | 
# |  void testRedundantTemplateCasting(T& value) {
# | 
# |    A& a = static_cast<A&>(value);
# | 
# | -  T& t = static_cast<T&>(value);
# | 
# | +  T& t = value;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -131,7 +131,7 @@
# |  #define PTR_NAME name
# | 
# |  
# | 
# |  void testMacroCasting(A* PTR_NAME) {
# | 
# | -  A* a13 = static_cast<A*>(PTR_NAME);
# | 
# | +  A* a13 = PTR_NAME;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | @@ -161,7 +161,7 @@
# |  }
# | 
# |  
# | 
# |  void testFunctionalCastWithPrimitive(int a) {
# | 
# | -  int b = int(a);
# | 
# | +  int b = a;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | @@ -172,25 +172,25 @@
# |  }
# | 
# |  
# | 
# |  void testBinaryOperatorRedundantCasting() {
# | 
# | -  const auto diff_types_operands1 { static_cast<float>(1.0f + 1) };
# | 
# | +  const auto diff_types_operands1 { (1.0f + 1) };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# | -  const auto diff_types_operands2 { static_cast<float>(2 + 3.0f) };
# | 
# | +  const auto diff_types_operands2 { (2 + 3.0f) };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# | -  const auto diff_types_operands3 { static_cast<int>(1 + static_cast<uint8_t>(1)) };
# | 
# | +  const auto diff_types_operands3 { (1 + static_cast<uint8_t>(1)) };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# |    const auto diff_types_operands4 {
# | 
# | -    static_cast<size_t>(static_cast<size_t>(3) + 2)
# | 
# | +    (static_cast<size_t>(3) + 2)
# | 
# |    };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# | -  const auto diff_types_operands5 { unsigned(7 + unsigned(4)) };
# | 
# | +  const auto diff_types_operands5 { (7 + unsigned(4)) };
# | 
# |    //
# | 
# |    //
# | 
# |  
# | 
# | @@ -227,27 +227,27 @@
# |  };
# | 
# |  
# | 
# |  void testAddOperation(int aa, int bb) {
# | 
# | -  int c = static_cast<int>(aa + bb) * aa;
# | 
# | +  int c = (aa + bb) * aa;
# | 
# |   //
# | 
# |   //
# | 
# |  }
# | 
# |  
# | 
# |  void testAddOperationWithParen(int a, int b) {
# | 
# | -  int c = static_cast<int>((a+b))*a;
# | 
# | +  int c = (a+b)*a;
# | 
# |   //
# | 
# |   //
# | 
# |  }
# | 
# |  
# | 
# |  void testRValueCast(int&& a) {
# | 
# |    int&& b = static_cast<int&&>(a);
# | 
# | -  int&& c = static_cast<int&&>(10);
# | 
# | +  int&& c = 10;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  template <int V>
# | 
# |  void testRedundantNTTPCasting() {
# | 
# | -  int a = static_cast<int>(V);
# | 
# | +  int a = V;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -260,7 +260,7 @@
# |  
# | 
# |  template <typename T, T V>
# | 
# |  void testRedundantDependentNTTPCasting() {
# | 
# | -  T a = static_cast<T>(V);
# | 
# | +  T a = V;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -269,7 +269,7 @@
# |  namespace gh170476 {
# | 
# |  int f(void);
# | 
# |  int g1() {
# | 
# | -  int (*fp)() = (int(*)(void))&f;
# | 
# | +  int (*fp)() = (&f);
# | 
# |    //
# | 
# |    //
# | 
# |    return fp();
# | 
# | 
# | ------------------------------------------------------------------
# | FileCheck -input-file=C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp.msg C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\readability\redundant-casting.cpp -check-prefixes=CHECK-MESSAGES -implicit-check-not={{warning|error}}: failed:
# | C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\readability\redundant-casting.cpp:190:21: error: CHECK-MESSAGES: expected string not found in input
# | 
# |  // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: redundant explicit casting to the same type 'size_t' (aka 'unsigned long') as the sub-expression, remove this casting [readability-redundant-casting]
# | 
# |                     ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp.msg:148:281: note: scanning from here
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:183:37: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
# | 
# |                                                                                                                                                                                                                                                                                         ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp.msg:148:281: note: with "@LINE-2" equal to "188"
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:183:37: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
# | 
# |                                                                                                                                                                                                                                                                                         ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp.msg:156:143: note: possible intended match here
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:188:5: warning: redundant explicit casting to the same type 'size_t' (aka 'unsigned long long') as the sub-expression, remove this casting [readability-redundant-casting]
# | 
# |                                                                                                                                               ^
# | 
# | 
# | 
# | Input file: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp.msg
# | 
# | Check file: C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\readability\redundant-casting.cpp
# | 
# | 
# | 
# | -dump-input=help explains the following input dump.
# | 
# | 
# | 
# | Input was:
# | 
# | <<<<<<
# | 
# |              .
# | 
# |              .
# | 
# |              .
# | 
# |            143:  | ( ) 
# | 
# |            144: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:179:37: note: FIX-IT applied suggested code changes 
# | 
# |            145: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:179:64: note: FIX-IT applied suggested code changes 
# | 
# |            146:  179 | const auto diff_types_operands2 { static_cast<float>(2 + 3.0f) }; 
# | 
# |            147:  | ^ 
# | 
# |            148: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:183:37: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting] 
# | 
# | check:190'0                                                                                                                                                                                                                                                                                             X error: no match found
# | 
# | check:190'1                                                                                                                                                                                                                                                                                               with "@LINE-2" equal to "188"
# | 
# |            149:  183 | const auto diff_types_operands3 { static_cast<int>(1 + static_cast<uint8_t>(1)) }; 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            150:  | ^~~~~~~~~~~~~~~~~ ~ 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            151:  | ( ) 
# | 
# | check:190'0     ~~~~~~~
# | 
# |            152: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:183:37: note: FIX-IT applied suggested code changes 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            153: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:183:81: note: FIX-IT applied suggested code changes 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            154:  183 | const auto diff_types_operands3 { static_cast<int>(1 + static_cast<uint8_t>(1)) }; 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            155:  | ^ 
# | 
# | check:190'0     ~~~~~
# | 
# |            156: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:188:5: warning: redundant explicit casting to the same type 'size_t' (aka 'unsigned long long') as the sub-expression, remove this casting [readability-redundant-casting] 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# | check:190'2                                                                                                                                                   ?                                                                                                                                                                        possible intended match
# | 
# |            157:  188 | static_cast<size_t>(static_cast<size_t>(3) + 2) 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            158:  | ^~~~~~~~~~~~~~~~~~~~ ~ 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            159:  | ( ) 
# | 
# | check:190'0     ~~~~~~~
# | 
# |            160: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:188:5: note: FIX-IT applied suggested code changes 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            161: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-casting.cpp.tmp.cpp:188:51: note: FIX-IT applied suggested code changes 
# | 
# | check:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |              .
# | 
# |              .
# | 
# |              .
# | 
# | >>>>>>
# | 
# | 
# `-----------------------------
# .---command stderr------------
# | Traceback (most recent call last):
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 554, in <module>
# |     main()
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 550, in main
# |     CheckRunner(args, extra_args).run()
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 433, in run
# |     self.check_messages(main_output)
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 358, in check_messages
# |     try_run(
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 64, in try_run
# |     process_output = subprocess.check_output(args, stderr=subprocess.STDOUT).decode(
# |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# |   File "c:\python312\Lib\subprocess.py", line 466, in check_output
# |     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
# |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# |   File "c:\python312\Lib\subprocess.py", line 571, in run
# |     raise CalledProcessError(retcode, process.args,
# | subprocess.CalledProcessError: Command '['FileCheck', '-input-file=C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\readability\\Output\\redundant-casting.cpp.tmp.cpp.msg', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\readability\\redundant-casting.cpp', '-check-prefixes=CHECK-MESSAGES', '-implicit-check-not={{warning|error}}:']' returned non-zero exit status 1.
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>Clang Tools.clang-tidy/infrastructure/alphabetical-order.test</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
C:/Python312/python.exe C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py -o C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.clang-tidy-checks-list.rst
# executed command: C:/Python312/python.exe 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py' -o 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.clang-tidy-checks-list.rst'
# note: command had no output on stdout or stderr
# RUN: at line 2
diff --strip-trailing-cr C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/clang-tidy/checks/list.rst C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.clang-tidy-checks-list.rst
# executed command: diff --strip-trailing-cr 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/clang-tidy/checks/list.rst' 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.clang-tidy-checks-list.rst'
# note: command had no output on stdout or stderr
# RUN: at line 4
C:/Python312/python.exe C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py -o C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst
# executed command: C:/Python312/python.exe 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py' -o 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst'
# .---command stderr------------
# | 
# | Entries in 'clang-tools-extra/docs/ReleaseNotes.rst' are not alphabetically sorted.
# | Fix the ordering by applying diff printed below.
# | 
# `-----------------------------
# RUN: at line 5
diff --strip-trailing-cr C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/ReleaseNotes.rst C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst
# executed command: diff --strip-trailing-cr 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/ReleaseNotes.rst' 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst'
# .---command stdout------------
# | *** C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/ReleaseNotes.rst
# | --- C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst
# | ***************
# | *** 495,515 ****
# |       implicit conversions of logical operator results (``&&``, ``||``, ``!``)
# |       to ``bool`` in C.
# |   
# |   - Improved :doc:`readability-redundant-casting
# |     <clang-tidy/checks/readability/redundant-casting>` check by fixing a false
# |     negative where casts were not flagged as redundant when at least one operand
# |     of a binary operation had the same type as the cast result type. For example,
# |     ``static_cast<float>(1.0f + 1)`` is now correctly identified as redundant.
# |   
# | - - Improved :doc:`readability-non-const-parameter
# | -   <clang-tidy/checks/readability/non-const-parameter>` check:
# | - 
# | -   - Avoid false positives on parameters used in dependent expressions
# | -     (e.g. inside generic lambdas).
# | - 
# | -   - Fixed a false positive in array subscript expressions where the types are
# | -     not yet resolved.
# | - 
# |   - Improved :doc:`readability-redundant-preprocessor
# |     <clang-tidy/checks/readability/redundant-preprocessor>` check by fixing a
# |     false positive for nested ``#if`` directives using different builtin
# | --- 495,515 ----
# |       implicit conversions of logical operator results (``&&``, ``||``, ``!``)
# |       to ``bool`` in C.
# |   
# | + - Improved :doc:`readability-non-const-parameter
# | +   <clang-tidy/checks/readability/non-const-parameter>` check:
# | + 
# | +   - Avoid false positives on parameters used in dependent expressions
# | +     (e.g. inside generic lambdas).
# | + 
# | +   - Fixed a false positive in array subscript expressions where the types are
# | +     not yet resolved.
# | + 
# |   - Improved :doc:`readability-redundant-casting
# |     <clang-tidy/checks/readability/redundant-casting>` check by fixing a false
# |     negative where casts were not flagged as redundant when at least one operand
# |     of a binary operation had the same type as the cast result type. For example,
# |     ``static_cast<float>(1.0f + 1)`` is now correctly identified as redundant.
# |   
# |   - Improved :doc:`readability-redundant-preprocessor
# |     <clang-tidy/checks/readability/redundant-preprocessor>` check by fixing a
# |     false positive for nested ``#if`` directives using different builtin
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/191386


More information about the cfe-commits mailing list