summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-21 21:32:27 +0000
committerChris Lattner <sabre@nondot.org>2008-07-21 21:32:27 +0000
commit390d39ac7e5e773c571f776dde1bbe3c9ed91e98 (patch)
treeee7d0dde7f285685136a23a8994b6a18d62437ca /clang/lib/Sema/SemaExprObjC.cpp
parentf1dc362547702837ed79156416d84fd8ba259780 (diff)
downloadbcm5719-llvm-390d39ac7e5e773c571f776dde1bbe3c9ed91e98.tar.gz
bcm5719-llvm-390d39ac7e5e773c571f776dde1bbe3c9ed91e98.zip
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. llvm-svn: 53876
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 6d19b87446d..333268e8e5f 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/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)
OpenPOWER on IntegriCloud