diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2014-03-18 16:25:22 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2014-03-18 16:25:22 +0000 |
commit | 23f8716a551f958a767ef980b4276acab4edcd1b (patch) | |
tree | 9d0c67bb1ab7952978ee6b6b342126948e82dce2 /lib/Sema/SemaDeclObjC.cpp | |
parent | f7cedcb5688664e0ae340e69d396a274b17d6901 (diff) |
Objective-C. Better fix for my previous patch
"No need to issue deprecated warning if deprecated method
in class extension is being implemented in primary class implementation
(no overriding is involved).
// rdar://16249335". No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204159 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 9982493ebc..5be26a91a2 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -372,7 +372,6 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { IC->lookupMethod(MDecl->getSelector(), MDecl->isInstanceMethod()); if (IMD) { - ObjCCategoryDecl *CD = 0; ObjCImplDecl *ImplDeclOfMethodDef = dyn_cast<ObjCImplDecl>(MDecl->getDeclContext()); ObjCContainerDecl *ContDeclOfMethodDecl = @@ -380,20 +379,16 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { ObjCImplDecl *ImplDeclOfMethodDecl = 0; if (ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(ContDeclOfMethodDecl)) ImplDeclOfMethodDecl = OID->getImplementation(); - else if ((CD = dyn_cast<ObjCCategoryDecl>(ContDeclOfMethodDecl))) { - ImplDeclOfMethodDecl = CD->getImplementation(); + else if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(ContDeclOfMethodDecl)) { + if (CD->IsClassExtension()) { + if (ObjCInterfaceDecl *OID = CD->getClassInterface()) + ImplDeclOfMethodDecl = OID->getImplementation(); + } else + ImplDeclOfMethodDecl = CD->getImplementation(); } - bool warn; - // No need to issue deprecated warning if deprecated method in class - // extension is being implemented in primary class implementation - // (no overriding is involved). - if (ImplDeclOfMethodDef && CD && CD->IsClassExtension()) - warn = false; - else // No need to issue deprecated warning if deprecated mehod in class/category // is being implemented in its own implementation (no overriding is involved). - warn = (!ImplDeclOfMethodDecl || ImplDeclOfMethodDecl != ImplDeclOfMethodDef); - if (warn) + if (!ImplDeclOfMethodDecl || ImplDeclOfMethodDecl != ImplDeclOfMethodDef) DiagnoseObjCImplementedDeprecations(*this, dyn_cast<NamedDecl>(IMD), MDecl->getLocation(), 0); |