[cfe-dev] Mutli-line bug report

Ted Kremenek kremenek at apple.com
Wed Nov 3 10:46:38 PDT 2010


The analyzer actually generates diagnostics that span an entire path.  What you see get emitted on the command line is only the final diagnostic, and it is there for debugging purposes.  The real output of the analyzer is either via the HTML reports (via scan-build) or the plist reports (which is currently consumed by Xcode, but could easily be consumed by other clients).

Currently it is not as easy as it should be to generate full path diagnostics, but it is possible.  A good example is in CFRefCount.cpp, which is the Objective-C retain/release checker.  It generates diagnostics such as "retain count incremented" on one line followed by something like  "leak occurred here" on another.  In the UI, this is rendered as an annotated path, that shows the branches taken to trigger the issue as well as the extra diagnostics from the checker.  The diagnostics are represented by PathDiagnosticEvents, which are packed inside a single PathDiagnostic.  PathDiagnostics are generated by the BugReporter object in conjunction with the checker.  Once they are generated, they are sent over to a PathDiagnosticClient, which renders them. 

Sent from my iPad

On Nov 3, 2010, at 2:18 AM, Jim Goodnow II <jim at thegoodnows.net> wrote:

> Is there an easy way to generate a multi-line diagnostic in the 
> static analysis engine where one could say that a bad thing is being 
> done *here*, but it was caused by the thing you did *here* where they 
> can be on different lines? Thanks.
> 
>  - jim
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list