Page MenuHomePhabricator

[analyzer] Make it possible to analyze functions even if they were inlined
Needs ReviewPublic

Authored by a.sidorin on Nov 16 2016, 2:12 AM.

Details

Summary

The analyzer uses heuristic that assumes that functions that were analyzed in some context will not be called out of some context. While it helps to suppress false positives, it also may lead to loss of some TPs. So, I think it is a good idea to allow user enabling of analysis of all functions. This behaviour is enabled via a specific option, default behaviour remains unchanged.

Diff Detail

Event Timeline

a.sidorin updated this revision to Diff 78152.Nov 16 2016, 2:12 AM
a.sidorin retitled this revision from to [analyzer] Make it possible to analyze functions even if they were inlined.
a.sidorin updated this object.
a.sidorin added a reviewer: dergachev.a.
a.sidorin added a subscriber: jan.
jan added a comment.EditedNov 17 2016, 1:17 AM

Thanks. This is exactly what I needed. Very useful.
(If approved, needs a description in IPA.txt)

jan awarded a token.Nov 17 2016, 1:18 AM
zaks.anna edited edge metadata.Nov 30 2016, 10:23 PM

Thanks! I'll take a look.

Please, include context in the patch as described in http://llvm.org/docs/Phabricator.html.

We already do something similar for ObjC methods by default (we re-analyze them, but in a more shallow mode) but decided not to reanalyze the other functions as top level. Do you have any data on how many more issues are found with this option on on real codebases?

The better option name (and term to use) is "analyze externally visible functions as top-level" because they are analyzed but just not in all possible contexts or not as top-level.

lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
444

Could you wrap this in a helper just like the rest of the options are done in AnalyzerOptions.cpp?