r179221 - [analyzer] When reporting a leak in RetainCount checker due to an early exit from init, step into init.
Anna Zaks
ganna at apple.com
Wed Apr 10 17:31:06 PDT 2013
Addressed in r179234.
On Apr 10, 2013, at 2:57 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>
> On Apr 10, 2013, at 14:42 , Anna Zaks <ganna at apple.com> wrote:
>
>> +struct AllocationInfo {
>> + const ExplodedNode* N;
>> + const MemRegion* R;
>
> Style: asterisks with the field names.
>
>
>> + if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(CE)) {
>> + SVal RecVal = St->getSVal(ME->getInstanceReceiver(), NContext);
>> + if (RecVal.getAsSymbol() == Sym && ME->getMethodFamily() == OMF_init)
>> + InitMethodContext = CEP->getCalleeContext();
>> + }
>
> What happens when getSVal gets a null Expr? Seems like a bad idea, and also doesn't work if there are nested inlineable [super init] calls (super is not an instance receiver).
>
> Well, actually, this won't work for nested [super init] calls anyway. Maybe we want to mark the last init call as interesting rather than the first one? That actually makes more sense for delegating initializers as well.
>
> The check for OMF_init is probably cheaper as well. You could check that first, then use CallEventManager::getObjCMethodCall to get the receiver safely via CallEvent.
>
>
>> + // If we are reporting a leak of the object that was allocated with alloc,
>> + // mark it's init method as interesting.
>
> Typo: "its"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130410/6fc5b2ae/attachment.html>
More information about the cfe-commits
mailing list