diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-21 18:19:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-21 18:19:38 +0000 |
commit | d004505b7491a5b0018575d7ebd747eae3c9d845 (patch) | |
tree | 0ef06a1429afa04095309fb01084756d59cff13a /clang/lib/Sema/SemaExprObjC.cpp | |
parent | b47772535be4cb04dc8682f849cf70e68ceb8a51 (diff) | |
download | bcm5719-llvm-d004505b7491a5b0018575d7ebd747eae3c9d845.tar.gz bcm5719-llvm-d004505b7491a5b0018575d7ebd747eae3c9d845.zip |
introduce a new ObjCList templated class and start moving
various objc lists over to it. First up, the protocol list
on ObjCInterfaceDecl.
llvm-svn: 53856
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 56a1f812b15..6d19b87446d 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/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; |