Support __attribute__((noescape)) for blocks within Objective-C

Originator:steipete
Number:rdar://23954471 Date Originated:18-Dec-2015 03:49 PM
Status:Open Resolved:
Product:iOS SDK Product Version:9.2
Classification:Enhancement Reproducible:Always
 
Summary:
Attribute __attribute__((noescape)) should be supported from Objective-C. It’s useful from an API side to know if a block is retained or executed immediately, and as Swift proofs this can also enable additional compiler optimizations.

While we can add this attribute to ObjC projects, it’s not recognized, neither at compile nor analyze time. It’s still useful for things that are bridge to Swift - I assume - but it could be much more useful if properly supported.

Steps to Reproduce:
See attached sample. It should produce a compile error or at least a warning because we use dispatch_async on a block that is marked as noescape, but no such warning/error is produced.

Comments

Example: http://cl.ly/240o3N2A1Y1v


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!