diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-21 00:44:01 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-21 00:44:01 +0000 |
commit | 7d6e11a1923ab5d3b90afcdde042767159d984cb (patch) | |
tree | f6ec5c8315d7b6f9119f09af48acee0c158d91f2 /clang/lib/Sema/SemaDeclObjC.cpp | |
parent | baee655c5eecadb15cf987cdfb13a26dd6fa6afd (diff) | |
download | bcm5719-llvm-7d6e11a1923ab5d3b90afcdde042767159d984cb.tar.gz bcm5719-llvm-7d6e11a1923ab5d3b90afcdde042767159d984cb.zip |
Warn when message is sent to receiver of
unknown type and there is a possibility that
at runtime method is resolved to a deprecated or
unavailable method. Addreses // rdar://8769853
llvm-svn: 122294
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 38e91465d2c..5d9a924ed8c 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1302,7 +1302,21 @@ void Sema::AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, // signature. for (ObjCMethodList *List = &Entry; List; List = List->Next) if (MatchTwoMethodDeclarations(Method, List->Method)) { - List->Method->setDefined(impl); + ObjCMethodDecl *PrevObjCMethod = List->Method; + PrevObjCMethod->setDefined(impl); + // If a method is deprecated, push it in the global pool. + // This is used for better diagnostics. + if (Method->getAttr<DeprecatedAttr>()) { + if (!PrevObjCMethod->getAttr<DeprecatedAttr>()) + List->Method = Method; + } + // If new method is unavailable, push it into global pool + // unless previous one is deprecated. + if (Method->getAttr<UnavailableAttr>()) { + if (!PrevObjCMethod->getAttr<UnavailableAttr>() && + !PrevObjCMethod->getAttr<DeprecatedAttr>()) + List->Method = Method; + } return; } |