[PATCH] D59802: [clang-tidy] Add new checker: llvm-prefer-isa-or-dyn-cast-in-conditionals
Don Hinton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 23 07:58:09 PDT 2019
hintonda added a comment.
In D59802#1475596 <https://reviews.llvm.org/D59802#1475596>, @aaron.ballman wrote:
> In D59802#1474300 <https://reviews.llvm.org/D59802#1474300>, @hintonda wrote:
> > @aaron.ballman, I just ran it over llvm/lib, including all in-tree headers, and it seems to work fine. However, it did miss this one:
> > - if (V && isa<Instruction>(V) && (EntInst = cast<Instruction>(V)) && + if (isa_and_nonnull<Instruction>(V) && (EntInst = cast<Instruction>(V)) &&
> > It got the first, but not the second. Not sure how to pick that one up. Even ran it a second time on just that file, but still didn't pick it up. Any ideas?
> I don't think it's a critical case to cover for the check, but yeah, it looks like that code really wants to be `(EntInst = dyn_cast_or_null<Instruction>(V))`. I think that looking for a pattern to handle this case would be tricky though and given how infrequent it seems to show up in the code base, I am not too worried. Someone applying the check will still get a notice for the `Var && isa<Type>(Var)` part of the expression, so they can hopefully see there's more related cleanup to be done.
Okay, thanks for looking. I'll go ahead and land this today, and if I think of a good way to handle this case, I'll update it later.
Thanks again for all your help...
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits