[PATCH] D19451: [clang-tidy] New checker for redundant expressions.
Etienne Bergeron via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 26 08:54:13 PDT 2016
etienneb added a comment.
In http://reviews.llvm.org/D19451#412017, @alexfh wrote:
> In http://reviews.llvm.org/D19451#411990, @alexfh wrote:
>
> > BTW, have you seen the `alpha.core.IdenticalExpr` static analyzer checker?
>
>
> Anna, Jordan, and whoever else is interested in the `alpha.core.IdenticalExpr` checker (lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp), it looks like Etienne has reinvented a large part of this checker as a clang-tidy check. I'm not sure which of these supports more cases and has more false positives (given that the `alpha.core.IdenticalExpr` checker was there for quite a while, but IIUC, this clang-tidy check has been tested on a huge code base with pretty good results).
>
> BTW, have you seen the alpha.core.IdenticalExpr static analyzer checker?
Yes, I looked at it. The AreEquivalentExpression is pretty much a variant of that code (a simplification).
> A few questions to all of you:
>
> 1. is the `alpha.core.IdenticalExpr` checker going to be released in the near future?
> 2. is anyone actively working on it?
> 3. given that Etienne seems to be planning to continue actively working on the clang-tidy analog of that static analyzer checker, are you fine to move all of this checker's (`alpha.core.IdenticalExpr`) functionality to clang-tidy?
> 4. more generally, should we officially recommend to use clang-tidy (instead of the static analyzer) for writing AST-based checks that don't require any path-based analysis?
For now, there are overlap between both checkers. I think 'alpha.core.IdenticalExpr' is in "alpha"-mode because there are too many false-positives related to cases like macro/floating-points (detecting NaN,...). The current checker has a pretty-low false-positive ratio. But, some redundant expressions won't be reported.
i.e. A[(3) - (3)] which is frequent in bison-generated files won't be reported.
On a long term, I'm planning rules to enhance matching redundant expressions like:
x == 10 && x < 12 (x < 12 is useless)
http://reviews.llvm.org/D19451
More information about the cfe-commits
mailing list