<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Nov 30, 2012, at 5:25 PM, Robert Henry <<a href="mailto:rrh@newrelic.com">rrh@newrelic.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Are there mechanisms in scan-build (clang static analysis) for having<br>a suppressions file, much like the semantics suppressions files in<br>valgrind?<br><br></blockquote><br><div>Currently, there is no such file. </div><div><br></div><div>However, often there is a way to modify the analyzed code to suppress the false positives:</div><div><a href="http://clang-analyzer.llvm.org/faq.html">http://clang-analyzer.llvm.org/faq.html</a> </div><br><blockquote type="cite">Barring a pre-existing mechanism or pugin, how can I get the report<br>from scan-build to tell me the function names along each edge of the<br>analysis path that leads to a reported fault?<br><br></blockquote><div><br></div><div>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. </div><div><br></div><div>It would look something like this:</div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">runInfo = CmpRuns.SingleRunInfo(OutputDir, opts.root, opts.verboseLog)</div></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">runResults = CmpRuns.loadResultsFromSingleRun(runInfo, <span style="color: #0433ff">False</span>)</div><div><span style="font-family: Monaco; font-size: 11px; color: rgb(4, 51, 255); ">for</span><span style="font-family: Monaco; font-size: 11px; "> r </span><span style="font-family: Monaco; font-size: 11px; color: rgb(4, 51, 255); ">in</span><span style="font-family: Monaco; font-size: 11px; "> runResults.reports:</span></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">    <span style="color: #0433ff">for</span> d <span style="color: #0433ff">in</span> r.diagnostics:</div><div>                   .....</div><div><br></div><div>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 <span style="font-family: Monaco; font-size: 11px; ">getIssueIdentifier()</span>, 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.</div><div><br></div><div>Cheers,</div><div>Anna.</div></div><blockquote type="cite">-- <br>Robert Henry, New Relic<br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br></blockquote></div><br></body></html>