r194031 - ObjectiveC. Method implementations should only check for

Fariborz Jahanian fjahanian at apple.com
Mon Nov 4 16:28:21 PST 2013


Author: fjahanian
Date: Mon Nov  4 18:28:21 2013
New Revision: 194031

URL: http://llvm.org/viewvc/llvm-project?rev=194031&view=rev
Log:
ObjectiveC. Method implementations should only check for
"Missing call to Super" in the overriding method and
not in the method itself. // rdar://15385981.

Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/test/SemaObjC/super-dealloc-attribute.m

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=194031&r1=194030&r2=194031&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Nov  4 18:28:21 2013
@@ -406,9 +406,7 @@ void Sema::ActOnStartOfObjCMethodDef(Sco
         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());

Modified: cfe/trunk/test/SemaObjC/super-dealloc-attribute.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/super-dealloc-attribute.m?rev=194031&r1=194030&r2=194031&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/super-dealloc-attribute.m (original)
+++ cfe/trunk/test/SemaObjC/super-dealloc-attribute.m Mon Nov  4 18:28:21 2013
@@ -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}}
+} 
+ at end
+
+// rdar://15385981
+ at interface Barn
+- (void)openDoor __attribute__((objc_requires_super));
+ at end
+
+ at implementation Barn
+- (void) openDoor
+{
+    ;
+}
+ at end
+
+ at interface HorseBarn:Barn @end
+
+ at implementation HorseBarn
+- (void) openDoor
+{
+    ;
+}	// expected-warning {{method possibly missing a [super openDoor] call}}
 @end





More information about the cfe-commits mailing list