[cfe-commits] r140713 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/warn-missing-super.m
Ted Kremenek
kremenek at apple.com
Wed Sep 28 12:32:29 PDT 2011
Author: kremenek
Date: Wed Sep 28 14:32:29 2011
New Revision: 140713
URL: http://llvm.org/viewvc/llvm-project?rev=140713&view=rev
Log:
Tweak -Wobjc-missing-super-calls to not warning about missing [super dealloc] when in GC-only mode, and to not warning about missing [super finalize] when not using GC.
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjC/warn-missing-super.m
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=140713&r1=140712&r2=140713&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Sep 28 14:32:29 2011
@@ -335,10 +335,11 @@
// 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;
}
}
Modified: cfe/trunk/test/SemaObjC/warn-missing-super.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/warn-missing-super.m?rev=140713&r1=140712&r2=140713&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/warn-missing-super.m (original)
+++ cfe/trunk/test/SemaObjC/warn-missing-super.m Wed Sep 28 14:32:29 2011
@@ -41,8 +41,16 @@
// 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'
More information about the cfe-commits
mailing list