[PATCH][analyzer][Review request] Eliminate memory leak in BugReporter::emitReport()

Jordan Rose jordan_rose at apple.com
Mon Mar 10 09:34:09 PDT 2014


Yes, this is all right to commit for now.

Actually pushing the ownership conventions through probably means wrapping BugReport's constructor in a create() factory method that returns a std::unique_ptr. Even then we'd need to add a std::move at EmitReport time. (Alternately, we could have a BugReportBuilder that wraps a BugReport, but automatically sends it to the BugReporter at the end of the scope.)

Jordan


On Mar 10, 2014, at 9:24 , Anton Yartsev <anton.yartsev at gmail.com> wrote:

> Updated the patch. Did not implemented taking unique_ptr by value yet as unique_ptr's constructor taking a single pointer as a parameter is declared explicit.
> Ok to commit?
> 
>> Ha, I was thinking about the "pushing ownership a bit further" and decided it would be unfair to ask that right now. Yes, that's the direction I'd like to go, too.
>> 
>> Jordan
>> 
>> 
>> On Mar 7, 2014, at 9:27 , David Blaikie <dblaikie at gmail.com> wrote:
>> 
>>> Please prefer unique_ptr - a migration of existing OwningPtrs is
>>> underway & it'd be nice not to save Ahmed the extra work/iteration on
>>> further uses.
>>> 
>>> (and bonus points if you can push ownership a bit further with
>>> unique_ptr (eg: take unique_ptr by value as a parameter to this
>>> function, etc) if owners are willing)
>>> 
>>> On Fri, Mar 7, 2014 at 6:41 AM, Anton Yartsev <anton.yartsev at gmail.com> wrote:
>>>> Hi all!
>>>> 
>>>> Attached is the patch that eliminates memory leak in
>>>> BugReporter::emitReport() found by alpha.cplusplus.NewDeleteLeaks ran over
>>>> LLVM codebase. Please review.
>>>> 
>>>> --
>>>> Anton
>>>> 
>>>> 
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>> 
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>> 
> -- 
> Anton
> 
> <BugReporter.cpp.patch>




More information about the cfe-commits mailing list