aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-21 18:19:38 +0000
committerChris Lattner <sabre@nondot.org>2008-07-21 18:19:38 +0000
commit3db6cae19c236fe2cef343c90105ce7cca7de965 (patch)
treef11dfa61672801a7fcafaf85b26c49d681403a2e /lib/Sema/SemaExprObjC.cpp
parentfcde95db82567564e2f9983b8d1acef99214f347 (diff)
introduce a new ObjCList templated class and start moving
various objc lists over to it. First up, the protocol list on ObjCInterfaceDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53856 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r--lib/Sema/SemaExprObjC.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 56a1f812b1..6d19b87446 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -375,9 +375,12 @@ static bool ClassImplementsProtocol(ObjCProtocolDecl *lProto,
bool RHSIsQualifiedID = false) {
// 1st, look up the class.
- ObjCProtocolDecl **protoList = IDecl->getReferencedProtocols();
- for (unsigned i = 0; i < IDecl->getNumIntfRefProtocols(); i++) {
- if (ProtocolCompatibleWithProtocol(lProto, protoList[i]))
+ const ObjCList<ObjCProtocolDecl> &Protocols =
+ IDecl->getReferencedProtocols();
+
+ for (ObjCList<ObjCProtocolDecl>::iterator PI = Protocols.begin(),
+ E = Protocols.end(); PI != E; ++PI) {
+ if (ProtocolCompatibleWithProtocol(lProto, *PI))
return true;
// This is dubious and is added to be compatible with gcc.
// In gcc, it is also allowed assigning a protocol-qualified 'id'
@@ -385,8 +388,7 @@ static bool ClassImplementsProtocol(ObjCProtocolDecl *lProto,
// of protocols in the rhs 'id' object. This IMO, should be a bug.
// FIXME: Treat this as an extension, and flag this as an error when
// GCC extensions are not enabled.
- else if (RHSIsQualifiedID &&
- ProtocolCompatibleWithProtocol(protoList[i], lProto))
+ if (RHSIsQualifiedID && ProtocolCompatibleWithProtocol(*PI, lProto))
return true;
}
@@ -394,7 +396,7 @@ static bool ClassImplementsProtocol(ObjCProtocolDecl *lProto,
if (lookupCategory)
for (ObjCCategoryDecl *CDecl = IDecl->getCategoryList(); CDecl;
CDecl = CDecl->getNextClassCategory()) {
- protoList = CDecl->getReferencedProtocols();
+ ObjCProtocolDecl **protoList = CDecl->getReferencedProtocols();
for (unsigned i = 0; i < CDecl->getNumReferencedProtocols(); i++) {
if (ProtocolCompatibleWithProtocol(lProto, protoList[i]))
return true;