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 | ed39e7cfebba4e92839877422c49db93a50e3a32 (patch) | |
tree | 5de58a0453e298cad6e940c20e4f800e22a75f0b /clang/lib/Sema/SemaDeclObjC.cpp | |
parent | dcb78dbc82710b8123b3454c9186ee568619deaf (diff) | |
download | bcm5719-llvm-ed39e7cfebba4e92839877422c49db93a50e3a32.tar.gz bcm5719-llvm-ed39e7cfebba4e92839877422c49db93a50e3a32.zip |
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.
llvm-svn: 204159
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 9982493ebc6..5be26a91a24 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/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); |