]> granicus.if.org Git - clang/commitdiff
Tweak -Wobjc-missing-super-calls to not warning about missing [super dealloc] when...
authorTed Kremenek <kremenek@apple.com>
Wed, 28 Sep 2011 19:32:29 +0000 (19:32 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 28 Sep 2011 19:32:29 +0000 (19:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140713 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/warn-missing-super.m

index 0822edf7049a693264125c4924d203fa71c08e50..f1a263707750a32f355d7d856a10193f59d95ac6 100644 (file)
@@ -335,10 +335,11 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
     // Only do this if the current class actually has a superclass.
     if (IC->getSuperClass()) {
       ObjCShouldCallSuperDealloc = 
-        !Context.getLangOptions().ObjCAutoRefCount &&      
+        !(Context.getLangOptions().ObjCAutoRefCount ||
+          Context.getLangOptions().getGC() == LangOptions::GCOnly) &&
         MDecl->getMethodFamily() == OMF_dealloc;
       ObjCShouldCallSuperFinalize =
-        !Context.getLangOptions().ObjCAutoRefCount &&      
+        Context.getLangOptions().getGC() != LangOptions::NonGC &&
         MDecl->getMethodFamily() == OMF_finalize;
     }
   }
index c25a6916620f1cc9db0186d89d53965251cdb7b1..5dcdb572925a2b89bf7960c7b2a09a3b852ffdcf 100644 (file)
 
 // RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s
 // CHECK: warn-missing-super.m:23:1: warning: method possibly missing a [super dealloc] call
-// CHECK: warn-missing-super.m:25:1: warning: method possibly missing a [super finalize] call
-// CHECK: 2 warnings generated.
+// CHECK: 1 warning generated.
+
+// RUN: %clang_cc1 -fsyntax-only -fobjc-gc %s 2>&1 | FileCheck --check-prefix=CHECK-GC %s
+// CHECK-GC: warn-missing-super.m:23:1: warning: method possibly missing a [super dealloc] call
+// CHECK-GC: warn-missing-super.m:25:1: warning: method possibly missing a [super finalize] call
+// CHECK-GC: 2 warnings generated.
+
+// RUN: %clang_cc1 -fsyntax-only -fobjc-gc-only %s 2>&1 | FileCheck --check-prefix=CHECK-GC-ONLY %s
+// CHECK-GC-ONLY: warn-missing-super.m:25:1: warning: method possibly missing a [super finalize] call
+// CHECK-GC-ONLY: 1 warning generated.
 
 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-arc %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s
 // CHECK-ARC: warn-missing-super.m:35:4: error: ARC forbids explicit message send of 'dealloc'