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

Jordy Rose jediknil at belkadan.com
Thu Aug 25 16:01:32 PDT 2011


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CFRefCount-NoWhitelist.patch
Type: application/octet-stream
Size: 34959 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110825/d1c48e50/attachment.obj>


More information about the cfe-dev mailing list