Info : Clang Static Analyzer Statistics

Hi Ted and All ,

Have a question regrading the clang analyzer statistics that was echoed by clang when we use the switch “-analyze-stats”

We see that the statistics was echoed for every module i.e for each transition unit or file , can we configure clang to echo the statistics to whole project ???
Other thing can we have LOC information too in the statistics ???

Thanks
~Umesh

Hi Umesh,

The -analyzer-stats option is a bit low level and is intended for debugging and development of the analyzer itself. The scan-build tool will however aggregate those stats in a basic way across a project using the '-stats' option if you are interested to see them for your project.

LOC stats have not been implemented probably because of the analyzer development focus, where we are more interested in other measures of size such as CFG blocks. There are plenty of tools available to do LOC analysis of a project but I'm not sure if there are any clang based ones; perhaps someone else knows a project.

Thanks,

Tom

Hi Ted and All ,

Have a question regrading the clang analyzer statistics that was echoed by clang when we use the switch "-analyze-stats"

We see that the statistics was echoed for every module i.e for each transition unit or file , can we configure clang to echo the statistics to whole project ???
Other thing can we have LOC information too in the statistics ???

"analyzer-stats" turns on internal analyzer statistics used for debugging, analyzer coverage/performance measurements. What statistics are you interested in?

Umesh,

There are two options for statistic tracking in the analyzer:

  • debug.Stats checker (AnalyzerStatsChecker.cpp), which currently reports coverage in terms of reachable(analyzed) basic blocks in top level functions. This checker runs at the very end when analysis are complete.
  • -analyzer-stats option is based on LLVM’s stats option (http://llvm.org/docs/ProgrammersManual.html#Statistic). It enables printing of various analyzer internal counters and timers, it’s extremely easy to extend.

You are welcome to submit patches for stats which are missing.

Currently, the number of warnings issued is not reported as a statistic, but is reported as output of the analyzer run (Ex: “5 warnings generated”).

Cheers,
Anna.