[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: Linux-->
# :penguin: Linux x64 Test Results

* 3186 tests passed
* 7 tests skipped
* 1 test failed

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

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

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py -o /home/gha/actions-runner/_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: /usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py -o /home/gha/actions-runner/_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 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/../../../docs/clang-tidy/checks/list.rst /home/gha/actions-runner/_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 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/../../../docs/clang-tidy/checks/list.rst /home/gha/actions-runner/_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
/usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/infrastructure/Output/alphabetical-order.test.tmp.ReleaseNotes.rst
# executed command: /usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py -o /home/gha/actions-runner/_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 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/../../../docs/ReleaseNotes.rst /home/gha/actions-runner/_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 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/../../../docs/ReleaseNotes.rst /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/infrastructure/Output/alphabetical-order.test.tmp.ReleaseNotes.rst
# .---command stdout------------
# | *** /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/../../../docs/ReleaseNotes.rst
# | --- /home/gha/actions-runner/_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