[cfe-commits] r159043 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/MallocChecker.cpp test/Analysis/malloc.mm

Jordan Rose jordan_rose at apple.com
Mon Jun 25 10:42:39 PDT 2012


On Jun 25, 2012, at 10:36 , Anna Zaks <ganna at apple.com> wrote:

> 
> On Jun 24, 2012, at 4:56 PM, Ted Kremenek wrote:
> 
>> It's not an official convention for ObjC methods, it's just a heuristic.  How about first looking at the actual SDKs and grepping for methods with this naming style and seeing (a) how many there are and (b) whether the heuristic holds?
>> 
> 
> I could not find other publicly exposed ObjC methods that end with "NoCopy" other than NSString and NSData.
> There are a few CF functions with that name; however, they all have different conventions - some take a deallocator, which can choose not to free memory(CFString, CFStream), others just share the pointer (OSData, OSString).
> 
> In this case, we model that the function DOES free memory (and report errors if someone tries to free it afterwards). Not only do I need to know that the function with this name will definitely free, but also which argument is pointing to the buffer. It's hard to do this by doing simple keyword matching on the name.
> 
> Anna.

Fair enough. Thanks for looking into this on my offhand comment.

Jordan




More information about the cfe-commits mailing list