[PATCH] [StaticAnalyzer]Handle Destructor call generated by C++ delete expr

Anna Zaks ganna at apple.com
Fri Sep 13 09:23:18 PDT 2013


On Sep 13, 2013, at 9:19 AM, Jordan Rose <jordan_rose at apple.com> wrote:

> 
> On Sep 13, 2013, at 9:17 , Anna Zaks <ganna at apple.com> wrote:
> 
>> 
>> On Sep 13, 2013, at 9:06 AM, Jordan Rose <jordan_rose at apple.com> wrote:
>> 
>>> 
>>> On Sep 13, 2013, at 9:03 , Anna Zaks <ganna at apple.com> wrote:
>>> 
>>>> Karthik,
>>>> 
>>>> Why do we need the FIXME? It should set ill be possible to report the issue, no? You'd need to associate the warning with the location where the destructor was called.
>>> 
>>> I asked for this but I think I got it wrong...an arbitrary destructor call won't necessarily have an associated statement,
>> 
>> We still should report the error even if the statement is not there. As far as I can see, the only downside is that we will not highlight the range. Use-after-free reports are most valuable to users and it does not really matter if we highlight the range or not.
> 
> Ah, good point.
> 
>> 
>>> but of course the one for a 'delete' should. I'm not sure we currently store enough information to handle this, though.
>>> 
>> 
>> I am asking to investigate this before putting in the FIXME. On which callback checkUseAfterFree is called with a NULL statement? Can we still report the error? If not yet included, please include the test case that tests this.
> 
> A destructor call does not have an associated statement; right now that includes destructors that come from 'delete'.
> 

Karthik,

It would be great if you could investigate if it is possible to add the statement info to destructors (CallEvent?) in these special cases. This would allow us to print the range when reporting the issue and would be general goodness. However, this enhancement does not have to block the patch.

Thanks!
Anna.



More information about the cfe-commits mailing list