[cfe-dev] [analyzer] moving alpha.IdenticalExpression to core
Daniel Marjamäki via cfe-dev
cfe-dev at lists.llvm.org
Fri Oct 13 05:42:31 PDT 2017
Hello Clang developers!
We wanted to see if alpha.IdenticlExpression can be moved to core. It has been in StaticAnalyzer for a while. We have run alpha.IdenticalExpression on 451 projects in debian and evaluated the results.
Identical expression found 127 warnings - 117 true positives and 10 of them seem to be false positives. All 10 false positives are however due to code is hidden by preprocessor (macros and ifdefs) so we can't do anything about them. For example:
#ifdef __clang__
#define MACRO(X)
#endif
....
If (x > 10) {
MACRO(10);
} else {
MACRO(1000);
}
=> 2.c:9:5: warning: true and false branches are identical
There was a warning that is not "perfect". Reduced:
if (x==10 || x == 20 || x == 10)
2.c:3:24: warning: identical expressions on both sides of logical operator
if (x==10 || x == 20 || x == 10)
~~~~~ ^ ~~~~~~~
Maybe it could be clarified sometime.
Our conclusion is that this checker is ready for core.
Do you have some opinions?
Best regards,
Daniel Marjamäki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171013/5a6df2a3/attachment.html>
More information about the cfe-dev
mailing list