summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.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
commitd004505b7491a5b0018575d7ebd747eae3c9d845 (patch)
tree0ef06a1429afa04095309fb01084756d59cff13a /clang/lib/AST/DeclObjC.cpp
parentb47772535be4cb04dc8682f849cf70e68ceb8a51 (diff)
downloadbcm5719-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/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp33
1 files changed, 12 insertions, 21 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 5da762e1fbf..7b28b10f919 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -280,18 +280,6 @@ ObjCIvarDecl *
return 0;
}
-/// addReferencedProtocols - Set the list of protocols that this interface
-/// implements.
-void ObjCInterfaceDecl::addReferencedProtocols(ObjCProtocolDecl **OID,
- unsigned numRefProtos) {
- assert(NumReferencedProtocols == 0 && "refproto already set!");
- NumReferencedProtocols = numRefProtos;
- if (numRefProtos) {
- ReferencedProtocols = new ObjCProtocolDecl*[numRefProtos];
- memcpy(ReferencedProtocols, OID, numRefProtos*sizeof(ObjCProtocolDecl*));
- }
-}
-
/// ObjCAddInstanceVariablesToClass - Inserts instance variables
/// into ObjCInterfaceDecl's fields.
///
@@ -539,12 +527,13 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupInstanceMethod(Selector Sel) {
return MethodDecl;
// Didn't find one yet - look through protocols.
- ObjCProtocolDecl **protocols = ClassDecl->getReferencedProtocols();
- int numProtocols = ClassDecl->getNumIntfRefProtocols();
- for (int pIdx = 0; pIdx < numProtocols; pIdx++) {
- if ((MethodDecl = protocols[pIdx]->getInstanceMethod(Sel)))
+ const ObjCList<ObjCProtocolDecl> &Protocols =
+ ClassDecl->getReferencedProtocols();
+ for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
+ E = Protocols.end(); I != E; ++I)
+ if ((MethodDecl = (*I)->getInstanceMethod(Sel)))
return MethodDecl;
- }
+
// Didn't find one yet - now look through categories.
ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList();
while (CatDecl) {
@@ -568,10 +557,12 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupClassMethod(Selector Sel) {
return MethodDecl;
// Didn't find one yet - look through protocols.
- ObjCProtocolDecl **protocols = ClassDecl->getReferencedProtocols();
- int numProtocols = ClassDecl->getNumIntfRefProtocols();
- for (int pIdx = 0; pIdx < numProtocols; pIdx++) {
- if ((MethodDecl = protocols[pIdx]->getClassMethod(Sel)))
+ const ObjCList<ObjCProtocolDecl> &Protocols =
+ ClassDecl->getReferencedProtocols();
+
+ for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
+ E = Protocols.end(); I != E; ++I) {
+ if ((MethodDecl = (*I)->getClassMethod(Sel)))
return MethodDecl;
}
// Didn't find one yet - now look through categories.
OpenPOWER on IntegriCloud