[clang-tools-extra] [clang-tidy] Add readability-pointer-to-ref check (PR #182068)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 18 09:57:30 PST 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/readability/PointerToRefCheck.cpp clang-tools-extra/clang-tidy/readability/PointerToRefCheck.h clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.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/readability/PointerToRefCheck.cpp:191:24: warning: redundant explicit casting to the same type 'Stmt *' as the sub-expression, remove this casting [readability-redundant-casting]
  191 |   Visitor.TraverseStmt(const_cast<Stmt *>(Func->getBody()));
      |                        ^~~~~~~~~~~~~~~~~~~               ~
clang/include/clang/AST/Decl.h:2300:9: note: source type originates from the invocation of this method
 2300 |   Stmt *getBody() const override {
      |   ~~~~~~^
```

</details>


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


More information about the cfe-commits mailing list