[PATCH] Add -Warc-implicit-writeback
Timothy Wood
tjw at omnigroup.com
Fri Feb 28 12:12:13 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=19009
Split out from http://llvm.org/bugs/show_bug.cgi?id=15649
In some cases, ARC implicit writeback can result in loss of what the user likely intended. For example:
int main(int argc, char *argv[])
{
__block id value = @"initial value";
void (^block)(id *outValue) = ^(id *outValue){
value = @"hello";
};
block(&value);
NSLog(@"value = %@", value);
return 0;
}
With ARC, this reports:
2013-04-24 13:55:35.814 block-local-address[28013:707] value = initial value
but with MRR:
2013-04-24 13:57:26.058 block-local-address[28046:707] value = hello
Attached is a patch vs trunk r202532 that adds -Warc-implicit-writeback and test cases for the ObjC and ObjC++ compilers (which each seem to have their own support for writeback).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: warn-arc-implicit-writeback.patch
Type: application/octet-stream
Size: 4511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140228/0a1b130e/attachment.obj>
-------------- next part --------------
More information about the cfe-commits
mailing list