diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 8 | ||||
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 14 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index ad40cbe845..5188740af6 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -653,9 +653,11 @@ void Sema::ImplMethodsVsClassMethods(ObjCImplementationDecl* IMPDecl, // Check the protocol list for unimplemented methods in the @implementation // class. - ObjCProtocolDecl** protocols = IDecl->getReferencedProtocols(); - for (unsigned i = 0; i < IDecl->getNumIntfRefProtocols(); i++) - CheckProtocolMethodDefs(IMPDecl->getLocation(), protocols[i], + const ObjCList<ObjCProtocolDecl> &Protocols = + IDecl->getReferencedProtocols(); + for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(), + E = Protocols.end(); I != E; ++I) + CheckProtocolMethodDefs(IMPDecl->getLocation(), *I, IncompleteImpl, InsMap, ClsMap); } 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; |