[PATCH] D61970: [CodeGen][ObjC] Call objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue instead of objc_autorelease and objc_retain in MRR
ddkilzer added a comment. Had a couple questions about using `objc_retainAutoreleasedReturnValue` without a `return` statement. (I'm just reading this from a layman's point of view; it may not actually matter in practice.) Comment at: test/CodeGenObjC/convert-messages-to-runtime-calls.m:32 // CALLS: {{call.*@objc_allocWithZone}} - // CALLS: {{call.*@objc_retain}} + // CALLS-ARC-INTRINSICS: {{call.*@llvm.objc.retainAutoreleasedReturnValue}} + // CALLS-NO-ARC-INTRINSICS: {{call.*@objc_retain}} Silly question: Should `objc_retainAutoreleasedReturnValue` really be called here when the value is not used in a `return` statement? Comment at: test/CodeGenObjC/convert-messages-to-runtime-calls.m:169 // MSGS: {{call.*@objc_msgSend}} - // CALLS: {{call.*@objc_retain}} + // CALLS-ARC-INTRINSICS: {{call.*@llvm.objc.retainAutoreleasedReturnValue}} + // CALLS-NO-ARC-INTRINSICS: {{call.*@objc_retain}} Same silly question: Should `objc_retainAutoreleasedReturnValue` really be called here when the value is not used in a `return` statement? Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61970/new/ https://reviews.llvm.org/D61970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D81072: [analyzer] ObjCAutoreleaseWriteChecker: Support explicit autoreleasepools.
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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits