[LLVMbugs] [Bug 17669] New: Attribute for "arc-retain-cycles" check in addition to "add" and "set" method selector prefix convention
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Oct 23 16:34:28 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=17669
Bug ID: 17669
Summary: Attribute for "arc-retain-cycles" check in addition to
"add" and "set" method selector prefix convention
Product: clang
Version: unspecified
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: fortinmike at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
This enhancement request pertains to Objective-C warnings generated by clang.
I am implementing a few methods in a library that take block arguments and
store them for later, repeated execution. However, those methods do not benefit
from the "arc-retain-cycles" warning because their signature doesn't begin with
"add" nor "set"; it’s pretty easy to create a retain cycle by accident,
particularly for novice Objective-C devs. I would like to annotate the methods
I know can lead to cycles for inclusion in this check to save others (and
myself) from introducing leaks in the future.
I’m proposing adding an Objective-C-specific attribute (if that’s the
appropriate construct) to indicate that a method’s usages should be checked for
potential retain cycles without requiring the method to begin with “add” or
“set". Something like:
- (void)doSomethingWithObject:(id)anObject andBlock:(void (^)())aBlock
__attribute__((check_retain_cycles));
In addition, it would probably be nice to offer the complementary ability to
exclude some “add” and “set”-prefixed methods from the retain cycle check if we
know it’s not relevant in a specific case, like the NSOperationQueue
“addOperationWithBlock” exclusion that’s currently hard-coded in the
isSetterLikeSelector() function (SemaChecking.cpp:6620) but in a dynamic way
using an attribute:
- (void)addOperationWithBlock:(void (^)(void))block
__attribute__((dont_check_retain_cycles));
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131023/b3764502/attachment.html>
More information about the llvm-bugs
mailing list