summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-03-18 00:10:37 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-03-18 00:10:37 +0000
commit19a08bbb9a8e6e43fe250d9c29afde3ca4a3ef51 (patch)
tree7863ab5f2ec52e2cc2a62f4a208052c27e0f3bc7 /clang/lib/Sema/SemaDeclObjC.cpp
parent0e8d401c5332e8e8f1edb91f722a3c6b5476bde2 (diff)
downloadbcm5719-llvm-19a08bbb9a8e6e43fe250d9c29afde3ca4a3ef51.tar.gz
bcm5719-llvm-19a08bbb9a8e6e43fe250d9c29afde3ca4a3ef51.zip
Objective-C. 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 llvm-svn: 204093
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 8f68852aaaf..9982493ebc6 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -372,6 +372,7 @@ 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 =
@@ -379,11 +380,20 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
ObjCImplDecl *ImplDeclOfMethodDecl = 0;
if (ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(ContDeclOfMethodDecl))
ImplDeclOfMethodDecl = OID->getImplementation();
- else if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(ContDeclOfMethodDecl))
+ else if ((CD = dyn_cast<ObjCCategoryDecl>(ContDeclOfMethodDecl))) {
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).
- if (!ImplDeclOfMethodDecl || ImplDeclOfMethodDecl != ImplDeclOfMethodDef)
+ warn = (!ImplDeclOfMethodDecl || ImplDeclOfMethodDecl != ImplDeclOfMethodDef);
+ if (warn)
DiagnoseObjCImplementedDeprecations(*this,
dyn_cast<NamedDecl>(IMD),
MDecl->getLocation(), 0);
OpenPOWER on IntegriCloud