[cfe-dev] CFRefCount Problem #2: Region Invalidation

Ted Kremenek kremenek at apple.com
Sat Aug 27 14:08:57 PDT 2011


This looks great.  I understand the need to handle CXXConstructExprs in checkRegionChanges(), but why do we need checkPostStmt() for CXXConstructExprs?  We'll never have a summary to evaluate for those.

On Aug 25, 2011, at 4:01 PM, Jordy Rose wrote:

> Okay, here's what I've come up with:
> 
> The checkRegionChanges callback now looks like this:
> 
> const ProgramState *
> checkRegionChanges(const ProgramState *state,
>                   const StoreManager::InvalidatedSymbols *invalidated,
>                   ArrayRef<const MemRegion *> ExplicitRegions,
>                   ArrayRef<const MemRegion *> Regions) const;
> 
> ...where ExplicitRegions contains the regions specifically requested for invalidation. (An ArrayRef also seems better than the begin/end pair we currently use.)
> 
> This is enough to manually recreate the whitelist in /almost/ the same way as before. What's missing is the invalidation of arguments to C++ constructors (and C++ new-expressions), which now show up as "top-level arguments". To fix this, I added CXXConstructExpr to CallOrObjCMessage and added another post-statement check to RetainReleaseChecker. (Currently we just stop tracking ObjC objects that get passed into C++-land, but that could change in the future.)
> 
> Amusingly, this passed the limit on the number of checks allowed per Checker, so I increased that as well.
> 
> Consequently, this is a rather ugly patch. I can try to separate it into smaller pieces if you want.
> 
> Jordy
> 
> <CFRefCount-NoWhitelist.patch>




More information about the cfe-dev mailing list