Support Open Radar and watch some of the best iOS talks of 2013. Join Renaissance IO.

Clang attribute for methods requiring calls to super

Originator:Justin.SpahrSummers
Number:rdar://11983182 Date Originated:29-Jul-2012 05:17 PM
Status:Duplicate Resolved:Duplicate of #6386358
Product:Developer Tools Product Version:
Classification:Feature (New) Reproducible:Not Applicable
 
Summary:
It'd be useful to have an __attribute__ annotation for methods that require their overrides to invoke super. Clang could log a warning for any overrides of the annotated method that do not do so.

Example:

// NSView.h
@interface NSView
- (void)layout __attribute__((objc_requires_super));
@end

// MyViewSubclass.m
@implementation MyViewSubclass

// Compiler warning generated for this method, since it does not message super
- (void)layout {
    self.subview.frame = NSZeroRect;
}

@end

Comments


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!