[PATCH] D59802: [clang-tidy] Add new checker: llvm-prefer-isa-or-dyn-cast-in-conditionals

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 16 05:34:58 PDT 2019


aaron.ballman added a comment.

In D59802#1467430 <https://reviews.llvm.org/D59802#1467430>, @hintonda wrote:

> In D59802#1467363 <https://reviews.llvm.org/D59802#1467363>, @aaron.ballman wrote:
>
> > LGTM aside from a nit and the ultimate name for the `isa_and_nonnull<>` API.
>
>
> Thanks.  I'll ping the list again at the end of the week, then make whatever change is necessary.
>
> Btw, the current iteration replaces all `v && isa<T>(v)` instances with `isa_and_nonnull<T>(v)`.  Is that still okay, or should it just do method calls?


I think it's fine to replace all instances. We can relax the check if it seems like onerous behavior in practice.



================
Comment at: clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp:27-28
     CheckFactories.registerCheck<IncludeOrderCheck>("llvm-include-order");
+    CheckFactories.registerCheck<PreferIsaOrDynCastInConditionalsCheck>(
+        "llvm-prefer-isa-or-dyn-cast-in-conditionals");
     CheckFactories.registerCheck<readability::NamespaceCommentCheck>(
----------------
hintonda wrote:
> aaron.ballman wrote:
> > Please keep this list sorted alphabetically.
> I think this is where add_new_check.py put it, but I'll alphabetize.
Huh, I thought that script kept everything alphabetized? That may be worth investigating (don't feel obligated though).


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