r204159 - Objective-C. Better fix for my previous patch
Fariborz Jahanian
fjahanian at apple.com
Tue Mar 18 09:25:22 PDT 2014
Author: fjahanian
Date: Tue Mar 18 11:25:22 2014
New Revision: 204159
URL: http://llvm.org/viewvc/llvm-project?rev=204159&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=204159&r1=204158&r2=204159&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Mar 18 11:25:22 2014
@@ -372,7 +372,6 @@ void Sema::ActOnStartOfObjCMethodDef(Sco
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(Sco
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);
More information about the cfe-commits
mailing list