On Apr 10, 2013, at 14:42 , Anna Zaks <[email protected]> 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"
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to