[clang-tools-extra] [clang-tidy] detect uses of llvm::isa that are always true (PR #191081)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 16:54:51 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE LINT COMMENT: clang-tidy-->


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

<details>
<summary>
You can test this locally with the following command:
</summary>

```bash

git diff -U0 origin/main...HEAD -- clang-tools-extra/clang-tidy/llvm/RedundantCastingCheck.cpp |
python3 clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py   -path build -p1 -quiet
```

</details>

<details>
<summary>
View the output from clang-tidy here.
</summary>

```
clang-tools-extra/clang-tidy/llvm/RedundantCastingCheck.cpp:129:5: warning: variable 'TArg' of type 'TemplateArgument' can be declared 'const' [misc-const-correctness]
  129 |     TemplateArgument TArg = TArgs->get(0);
      |     ^
      |                      const 
clang-tools-extra/clang-tidy/llvm/RedundantCastingCheck.cpp:131:7: warning: variable 'TargetTy' of type 'CanQualType' (aka 'CanQual<Type>') can be declared 'const' [misc-const-correctness]
  131 |       CanQualType TargetTy = TArg.getAsType()->getCanonicalTypeUnqualified();
      |       ^
      |                   const 
clang-tools-extra/clang-tidy/llvm/RedundantCastingCheck.cpp:172:8: warning: variable 'TargetTy' of type 'CanQualType' (aka 'CanQual<Type>') can be declared 'const' [misc-const-correctness]
  172 |   for (CanQualType TargetTy : TargetTypes) {
      |        ^
      |                    const
```

</details>


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


More information about the cfe-commits mailing list