[PATCH] [StaticAnalyzer]Handle Destructor call generated by C++ delete expr
kv.bhat at samsung.com
Mon Sep 16 03:35:23 PDT 2013
Hi Jordan, Anna,
Implemented comments from Jordan.
I think the FIXME comments were a bit misleading. We still do report use after free in this case but at the 1st visible Stmt. We are just skipping the implicit call to destructor in case of delete as there was no Stmt corresponding to it.
To make it more clear i have added 2 TC's.
For e.g in testDoubleDeleteClassInstance we still report use of memory after free but it is inside the destructor.
I do agree here that the destructor should not be modeled when we call delete the second time but as Jordan highlighted currently we do not have a Stmt corresponding to call to destructor in case of delete.
I'm a bit reserved about calling ReportUseAfterFree with default Range in this case as it would report the warning at incorrect location making it difficult to track the exact point of problem.
I will try to investigate as Anna suggested if it is possible to add stmt info to destructor in these cases. I think it would simply be same as the deleteExpr which triggered this call. But i would like to address that in a separate revision.
For now do you think it is ok if we go ahead with commit? I will try to address the issues raised by Anna in next revision ( added a fixme in test case for the same).
Hi jordan_rose, zaks.anna,
CHANGE SINCE LAST DIFF
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7655 bytes
Desc: not available
More information about the cfe-commits