diff options
author | Nico Weber <nicolasweber@gmx.de> | 2011-08-28 22:35:17 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2011-08-28 22:35:17 +0000 |
commit | 80cb6e69d9e85231588ae604e4bc2bc9a07389af (patch) | |
tree | 111a0d0d921aa094530bfdb2ebf4a49f7352b6c6 /lib/Sema/SemaDeclObjC.cpp | |
parent | f5e39ece75b18c9ce19351929d4879ad9731e7f5 (diff) |
Warn on missing [super finalize] calls.
This matches gcc's logic. Second half of PR10661.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index c7d3590fb8..9b6166bc5b 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -162,6 +162,7 @@ static bool CheckARCMethodDecl(Sema &S, ObjCMethodDecl *method) { switch (family) { case OMF_None: case OMF_dealloc: + case OMF_finalize: case OMF_retain: case OMF_release: case OMF_autorelease: @@ -267,6 +268,7 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { case OMF_None: case OMF_dealloc: + case OMF_finalize: case OMF_alloc: case OMF_init: case OMF_mutableCopy: @@ -287,14 +289,16 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { dyn_cast<NamedDecl>(IMD), MDecl->getLocation(), 0); - // If this is "dealloc", set some bit here. + // If this is "dealloc" or "finalize", set some bit here. // Then in ActOnSuperMessage() (SemaExprObjC), set it back to false. // Finally, in ActOnFinishFunctionBody() (SemaDecl), warn if flag is set. // Only do this if the current class actually has a superclass. - if (IC->getSuperClass()) + if (IC->getSuperClass()) { ObjCShouldCallSuperDealloc = !Context.getLangOptions().ObjCAutoRefCount && MDecl->getMethodFamily() == OMF_dealloc; + ObjCShouldCallSuperFinalize = MDecl->getMethodFamily() == OMF_finalize; + } } } @@ -1256,6 +1260,7 @@ static bool checkMethodFamilyMismatch(Sema &S, ObjCMethodDecl *impl, case OMF_release: case OMF_autorelease: case OMF_dealloc: + case OMF_finalize: case OMF_retainCount: case OMF_self: case OMF_performSelector: @@ -2637,6 +2642,7 @@ Decl *Sema::ActOnMethodDeclaration( case OMF_None: case OMF_copy: case OMF_dealloc: + case OMF_finalize: case OMF_mutableCopy: case OMF_release: case OMF_retainCount: |