diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-21 21:32:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-21 21:32:27 +0000 |
commit | 780f329cb011bff0da5763e2e9744eec093d0509 (patch) | |
tree | 9d66381fd365b73a2f582250172ee64d77cc3762 /lib/Sema/SemaExprObjC.cpp | |
parent | dbddbe4da4ed6fd4c37b865fcbbddea5428cc32c (diff) |
move two more lists of protocols over to use ObjCList<ObjCProtocolDecl>,
simplifying code along the way and fixing a problem and memory leak or two.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53876 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 6d19b87446..333268e8e5 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -359,9 +359,9 @@ static bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) { if (lProto == rProto) return true; - ObjCProtocolDecl** RefPDecl = rProto->getReferencedProtocols(); - for (unsigned i = 0; i < rProto->getNumReferencedProtocols(); i++) - if (ProtocolCompatibleWithProtocol(lProto, RefPDecl[i])) + for (ObjCProtocolDecl::protocol_iterator PI = rProto->protocol_begin(), + E = rProto->protocol_end(); PI != E; ++PI) + if (ProtocolCompatibleWithProtocol(lProto, *PI)) return true; return false; } @@ -396,11 +396,10 @@ static bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, if (lookupCategory) for (ObjCCategoryDecl *CDecl = IDecl->getCategoryList(); CDecl; CDecl = CDecl->getNextClassCategory()) { - ObjCProtocolDecl **protoList = CDecl->getReferencedProtocols(); - for (unsigned i = 0; i < CDecl->getNumReferencedProtocols(); i++) { - if (ProtocolCompatibleWithProtocol(lProto, protoList[i])) + for (ObjCCategoryDecl::protocol_iterator PI = CDecl->protocol_begin(), + E = CDecl->protocol_end(); PI != E; ++PI) + if (ProtocolCompatibleWithProtocol(lProto, *PI)) return true; - } } // 3rd, look up the super class(s) |