xazax.hun added a comment.

I think, while the analyzer is more suitable for certain kinds of checks that 
require deep analysis, it is still useful to have quicker syntactic checks that 
can easily identify problems that are the results of typos or incorrectly 
modified copy and pasted code. I think this check is in that category.  Also, 
the original warning Peter mentioned does something similar but has some 
shortcomings.

The current implementation is not path sensitive. It uses flow sensitivity to 
check for escaping values.
If we would try to port this check to the static analyzer, the questions we 
would ask from the analyzer are universally quantified (e.g. for all path this 
variable does not escape and does not change). Unfortunately, it is not that 
easy with the current analyzer to answer such questions. The static analyzer is 
better with existential questions (e.g. there is a path such that the condition 
variables are not escaped and are unchanged in the loop). Using the latter 
formulation we might have a larger number of false positives because the 
analyzer sometimes hit infeasible paths.  In the first approach, the infeasible 
paths are less of a problem (they might cause false negatives but not false 
positives), but we need to be careful with all the peculiarities of the 
analyzer because it does not guarantee to discover all possible paths.

Hopefully, Devin will correct me if I'm wrong :)


https://reviews.llvm.org/D40937



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to