[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
Thu Apr 11 09:33:07 PDT 2019
aaron.ballman added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp:125
+ diag(MatchedDecl->getBeginLoc(),
+ "isa_and_nonnull<> is cleaner and more efficient")
+ << FixItHint::CreateReplacement(SourceRange(MatchedDecl->getBeginLoc(),
----------------
How about `'isa_and_nonnull<>' is preferred over an explicit test for null followed by calling 'isa<>'`?
================
Comment at: clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.h:37-39
+/// if (var && isa<T>(var)) {}
+/// // is replaced by:
+/// if (dyn_cast_or_null<T>(var.foo())) {}
----------------
I think this comment is now out of date.
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