[PATCH] D81072: [analyzer] ObjCAutoreleaseWriteChecker: Support explicit autoreleasepools.
David Kilzer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 21 11:45:35 PDT 2020
ddkilzer added a comment.
Herald added a subscriber: steakhal.
Thanks for implementing this! For posterity, I wanted to note a couple cases that this checker doesn't catch.
1. Under ARC, a more general case of assigning to an `__autoreleasing` variable. (Not sure why anyone would do this, but it's possible to write.)
@implementation MyClass
- (BOOL)myError:(NSError * __strong *)error
{
NSError __autoreleasing *localError;
@autoreleasepool {
localError = [[NSError alloc] init];
}
if (error) {
*error = localError;
return YES;
}
return NO;
}
@end
2. Under MRR, writing to an autoreleasing out parameter that outlives the autoreleasePool (similar to the issue that is now found under ARC):
@implementation MyClass
- (BOOL)myError:(NSError **)error
{
@autoreleasepool {
if (error) {
*error = [[[NSError alloc] init] autorelease];
return YES;
}
}
return NO;
}
@end
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81072/new/
https://reviews.llvm.org/D81072
More information about the cfe-commits
mailing list