[PATCH] make analyzer track memory allocated by if_nameindex
Daniel Fahlgren
daniel at fahlgren.se
Wed Oct 1 15:09:23 PDT 2014
Hi Anna,
On ons, 2014-09-24 at 10:02 -0700, Anna Zaks wrote:
> How about the similar functions from the malloc family:
> isAllocationFunction and isFreeFunction?
>
> You could either introduce a helper function which checks if the
> FunctionDecl declares a function from the given list of identifiers or
> introduce a function that takes FunctionDecl, ASTContext, familyKind,
> and MemoryOperationKind (enum class MemoryOperationKind { MOK_Allocate,
> MOK_Free };) and checks if the FunctionDecl belongs to that family and
> memory operation. (The second approach is probably better.)
Yes, the second approach does sound better. Combining the four functions
into one required a bit if thinking in order to maintain readability.
Attached is a patch that refactors isAllocationFunction and
isFreeFunction, as well as adding support for if_*nameindex functions.
Any comments?
Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ifnameindex.patch
Type: text/x-patch
Size: 13009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141002/46c72b30/attachment.bin>
More information about the cfe-commits
mailing list