[PATCH] D59802: [clang-tidy] Add new checker: llvm-avoid-cast-in-conditional

Don Hinton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 12:31:41 PDT 2019


hintonda added a comment.

In D59802#1443340 <https://reviews.llvm.org/D59802#1443340>, @aaron.ballman wrote:

> Should this check also try to find this pattern:
>
>   if (dyn_cast<Frobble>(Bobble))
>     ...
>
>
> in order to recommend the proper replacement:
>
>   if (isa<Frobble>(Bobble))
>     ...
>
>
> I ask because the name `llvm-avoid-cast-in-conditional` sounds like it would also cover this situation and I run into it during code reviews with some frequency (more often than I run into `cast<>` being used in a conditional).


Yes, I can add that, and provide a fix-it too.  Thanks...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59802/new/

https://reviews.llvm.org/D59802





More information about the cfe-commits mailing list