ObjectiveC. Method implementations should only check for

"Missing call to Super" in the overriding method and
not in the method itself. // rdar://15385981.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194031 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2013-11-05 00:28:21 +00:00
parent 8625089559
commit 2b61039ceb
2 changed files with 27 additions and 8 deletions

View File

@ -406,9 +406,7 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
if (Context.getLangOpts().getGC() != LangOptions::NonGC)
getCurFunction()->ObjCShouldCallSuper = true;
} else if (MDecl->hasAttr<ObjCRequiresSuperAttr>())
getCurFunction()->ObjCShouldCallSuper = true;
else {
} else {
const ObjCMethodDecl *SuperMethod =
SuperClass->lookupMethod(MDecl->getSelector(),
MDecl->isInstanceMethod());

View File

@ -40,9 +40,9 @@
[super MyDealloc];
} // expected-warning {{method possibly missing a [super XXX] call}}
- (void) MyDeallocMeth {} // expected-warning {{method possibly missing a [super MyDeallocMeth] call}}
- (void) MyDeallocMeth {}
- (void) AnnotMyDeallocMeth{} // expected-warning {{method possibly missing a [super AnnotMyDeallocMeth] call}}
- (void) AnnotMeth{}; // expected-warning {{method possibly missing a [super AnnotMeth] call}}
- (void) AnnotMeth{};
+ (void)registerClass:(id)name {} // expected-warning {{method possibly missing a [super registerClass:] call}}
@end
@ -66,7 +66,7 @@
- (void) AnnotMyDeallocMeth{} // expected-warning {{method possibly missing a [super AnnotMyDeallocMeth] call}}
- (void) AnnotMeth{}; // expected-warning {{method possibly missing a [super AnnotMeth] call}}
- (void) AnnotMyDeallocMethCAT{}; // expected-warning {{method possibly missing a [super AnnotMyDeallocMethCAT] call}}
- (void) AnnotMethCAT {}; // expected-warning {{method possibly missing a [super AnnotMethCAT] call}}
- (void) AnnotMethCAT {};
@end
@ -101,11 +101,32 @@
@implementation ViewController
- (void) someMethodRequiringSuper
{
} // expected-warning {{method possibly missing a [super someMethodRequiringSuper] call}}
}
- (IBAction) someAction
{
}
- (IBAction) someActionRequiringSuper
{
} // expected-warning {{method possibly missing a [super someActionRequiringSuper] call}}
}
@end
// rdar://15385981
@interface Barn
- (void)openDoor __attribute__((objc_requires_super));
@end
@implementation Barn
- (void) openDoor
{
;
}
@end
@interface HorseBarn:Barn @end
@implementation HorseBarn
- (void) openDoor
{
;
} // expected-warning {{method possibly missing a [super openDoor] call}}
@end