[cfe-commits] [patch] Retain/release checking for ObjCStringLiterals

Jordan Rose jediknil at belkadan.com
Sun Mar 11 14:37:17 PDT 2012

After I complained about it a few days ago, I figured I'd take a stab at fixing this:

[@"abc" release]; // should warn!

But because we have a real region type for ObjCStringLiterals, rather than an opaque SymbolicRegion, there's no associated symbol. One fix for this is to forget that they're string literals and just conjure a symbol like any other ObjC object; the only way ObjCStringRegions are used is that they're known to be non-null. I don't like this, though, cause it seems like at SOME point we're going to want typed regions to be trackable.

This patch attaches a MetadataSymbol to each ObjCStringLiteral and uses that for RetainCountChecker. I don't like /this/ because it can't track the liveness of the string literal, and thus the symbol never gets collected. Going to try to see if I can do it more "on demand", rather than any time we see an ObjCStringLiteral expression, but thought I'd stop for feedback. Is this a good direction to go in?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ObjCStringLiterals.patch
Type: application/octet-stream
Size: 15293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120311/2789cfd1/attachment.obj>

More information about the cfe-commits mailing list