[PATCH] D19451: [clang-tidy] New checker for redundant expressions.
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 26 06:22:00 PDT 2016
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.
Awesome idea!
LG with a couple of nits.
In http://reviews.llvm.org/D19451#410064, @etienneb wrote:
> Tested over LLVM code, no false positives.
>
> Two catches:
> http://reviews.llvm.org/D19460
> http://reviews.llvm.org/D19451
The second link refers to this revision ;)
================
Comment at: clang-tidy/misc/RedundantExpressionCheck.cpp:21
@@ +20,3 @@
+
+static bool AreIdenticalExpr(const Expr *Left, const Expr *Right) {
+ if (!Left || !Right)
----------------
This is to some degree similar to comparing `llvm::FoldingSetNodeIDs` created using `Stmt::Profile`. However it's only useful to check for identical expressions and won't work, if you're going to extend this to equivalent expressions.
================
Comment at: docs/clang-tidy/checks/misc-redundant-expression.rst:10
@@ +9,3 @@
+ * redundant,
+ * always be true,
+ * always be false,
----------------
Please enclose `true` and `false` in backquotes.
http://reviews.llvm.org/D19451
More information about the cfe-commits
mailing list