[PATCH][Review request] unix.Malloc checker improvement: +handling new/delete, +memory.MismatchedFree, +memory.MismatchedDelete, +improved display names for allocators/deallocators
Anton Yartsev
anton.yartsev at gmail.com
Tue Feb 19 22:18:35 PST 2013
Hi, Jordan. Thanx for the review!
Attached is the new version of the patch with all the comments
addressed. Also added support for directly called operator new()/new[]()
and operator delete()
There is currently one problem with handling of operator delete(). The
following test
void testDeleteOp1() {
int *p = (int *)malloc(sizeof(int));
operator delete(p); // FIXME: should complain "Argument to operator
delete() was allocated by malloc(), not operator new"
}
produce no warnings as attached RefState seem to be missing at the point
when checkPostStmt(const CallExpr *CE, CheckerContext &C) callback is
called for operator delete(p).
I haven't investigated the problem deeply yet, intend to address it
parallel with the review.
> + if (NE->getNumPlacementArgs())
> + return;
> + // skip placement new operators as they may not allocate memory
>
> Two comments here:
> - Please make sure all comments are complete, capitalized, and
> punctuated sentences. (This has the important one, "complete"....just
> missing capitalization and punctuation.)
I'll try. Unfortunately I am not as good in English as I want to be, so
sorry for my grammar, syntax, and punctuation.
--
Anton
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MallocChecker_v2.patch
Type: text/x-diff
Size: 32353 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130220/dec818a3/attachment.patch>
More information about the cfe-commits
mailing list