[clang] [lld] [llvm] [mlir] [NFC] Use more isa and isa_and_nonnull instead dyn_cast for predicates (PR #137393)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 27 11:58:44 PDT 2025


steakhal wrote:

> Nice cleanups!
> 
> Do we have clang-tidy checks for these? It would be nice for tooling to take care of all this.

There is a Static Analyzer checker, but I'm not exactly sure if it would catch this of the top of my head.
See [alpha.llvm.Conventions](https://clang.llvm.org/docs/analyzer/checkers.html#id178)

I think the Static Analyzer is anyway overkill for checking this, probably an easy clang-tidy check would be better for looking for implicit conversions to bool of a CallExpr of `dyn_cast`. One could implement it in a matter of hours.

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


More information about the cfe-commits mailing list