[cfe-dev] scan-build suppressions?

Anna Zaks ganna at apple.com
Tue Dec 4 10:03:56 PST 2012


On Nov 30, 2012, at 5:25 PM, Robert Henry <rrh at newrelic.com> wrote:

> Are there mechanisms in scan-build (clang static analysis) for having
> a suppressions file, much like the semantics suppressions files in
> valgrind?
> 

Currently, there is no such file. 

However, often there is a way to modify the analyzed code to suppress the false positives:
http://clang-analyzer.llvm.org/faq.html 

> Barring a pre-existing mechanism or pugin, how can I get the report
> from scan-build to tell me the function names along each edge of the
> analysis path that leads to a reported fault?
> 

One way of getting these, would be by processing the scan-build output with clang/utils/analyzer/CmpRuns.py, which looks at all the reports and provides the APIs to examine each report. 

It would look something like this:
runInfo = CmpRuns.SingleRunInfo(OutputDir, opts.root, opts.verboseLog)
runResults = CmpRuns.loadResultsFromSingleRun(runInfo, False)
for r in runResults.reports:
    for d in r.diagnostics:
                   .....

Right now, there is no API to get the names of all the functions along the path, but it would be reasonable to add the API that supports such query to the script. Also, we do have getIssueIdentifier(), which could be used to identify the same issues across multiple runs. It is very rough right now - we just store the function enclosing the report and the offset from the beginning of the function to the report.

Cheers,
Anna.
> -- 
> Robert Henry, New Relic
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121204/329579a6/attachment.html>


More information about the cfe-dev mailing list