diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2014-11-13 22:27:05 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2014-11-13 22:27:05 +0000 |
commit | c62d16f30461df314e2339a2219eed3f19b4ca87 (patch) | |
tree | 7aa4c13fdd9d6a99f0c6a28838cd84c3e1105b04 /clang/lib/Sema/SemaDeclObjC.cpp | |
parent | 4a78699c8ca7ed3be1e4f83fc50b13cbaa66c82b (diff) | |
download | bcm5719-llvm-c62d16f30461df314e2339a2219eed3f19b4ca87.tar.gz bcm5719-llvm-c62d16f30461df314e2339a2219eed3f19b4ca87.zip |
Objective-C. Fixes a regression caused by implementation
of new warning for deprecated method call for receiver
of type 'id'. This addresses rdar://18960378 where
unintended warnings being issued.
llvm-svn: 221933
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 5a1903f2622..96106440c95 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -2229,6 +2229,7 @@ void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) { if (List->Method == nullptr) { List->Method = Method; List->setNext(nullptr); + List->Count = Method->isDefined() ? 0 : 1; return; } @@ -2242,12 +2243,14 @@ void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) { if (!MatchTwoMethodDeclarations(Method, List->Method)) continue; - + ObjCMethodDecl *PrevObjCMethod = List->Method; // Propagate the 'defined' bit. if (Method->isDefined()) PrevObjCMethod->setDefined(true); + else + ++List->Count; // If a method is deprecated, push it in the global pool. // This is used for better diagnostics. @@ -2268,7 +2271,7 @@ void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) { // We have a new signature for an existing method - add it. // This is extremely rare. Only 1% of Cocoa selectors are "overloaded". ObjCMethodList *Mem = BumpAlloc.Allocate<ObjCMethodList>(); - Previous->setNext(new (Mem) ObjCMethodList(Method, nullptr)); + Previous->setNext(new (Mem) ObjCMethodList(Method, 0, nullptr)); } /// \brief Read the contents of the method pool for a given selector from @@ -2334,6 +2337,16 @@ bool Sema::CollectMultipleMethodsInGlobalPool(Selector Sel, return (Methods.size() > 1); } +bool Sema::AreMultipleMethodsInGlobalPool(Selector Sel, + bool instance) { + GlobalMethodPool::iterator Pos = MethodPool.find(Sel); + // Test for no method in the pool which should not trigger any warning by caller. + if (Pos == MethodPool.end()) + return true; + ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second; + return MethList.Count > 1; +} + ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass, bool warn, bool instance) { |