]> granicus.if.org Git - clang/commitdiff
ObjectiveC. Method implementations should only check for
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 5 Nov 2013 00:28:21 +0000 (00:28 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 5 Nov 2013 00:28:21 +0000 (00:28 +0000)
"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

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/super-dealloc-attribute.m

index be78767510cf90fc1f8832df7dbbf91135620656..86979a1fe85f34de6a9693820e22e7863116afb4 100644 (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());
index 911de732668921dcc0caf418ca72bc6fb9f1ea4d..ecab109d3089e48924c9cb2328f47c3aedd9ebf9 100644 (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
 
 
 @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