[cfe-dev] leaks in clang (many!)

Jordan Rose jordan_rose at apple.com
Thu Apr 24 09:35:24 PDT 2014


A lot of them are cases where a function returns a Foo*, but the fact that it's an owned Foo* is only in the documentation (or not written anywhere outside the .cpp file!). A few more have been cases where containers of Foo* get erased instead of deleted.

A "migration" warning/checker could complain about returning an owned pointer as a bare Foo* instead of as a std::unique_ptr (or llvm::IntrusiveRefCntPtr or similar).

The other problem is that the NewDeleteLeaks checker is currently still marked alpha, because we have a number of patterns that make it difficult to use (mainly constructors that escape 'this'). We could add a new annotation to signal this case, but I've kind of been leery of more annotations until the analyzer_annotate attribute gets implemented (see http://clang-analyzer.llvm.org/open_projects.html).

Jordan


On Apr 23, 2014, at 22:43 , Daniel Marjamäki <Daniel.Marjamaki at evidente.se> wrote:

> 
> Hello!
> 
> It is great that these leaks have been discovered!
> 
> As far as I see no tickets has been created in bugzilla that says that the static analyser should detect any of these.
> 
> Has anybody reviewed the leaks to see if any of them could be detected by static analysis?
> 
> Best regards,
> Daniel Marjamäki
> 
> ..................................................................................................................
> Daniel Marjamäki Senior Engineer
> Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden
> 
> Mobile:                 +46 (0)709 12 42 62
> E-mail:                 Daniel.Marjamaki at evidente.se
> 
> www.evidente.se
> 
> _______________________________________________
> 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/20140424/80e5c3e5/attachment.html>


More information about the cfe-dev mailing list