From 7ed9e0f97f4645edc5d4670385b985ea4c617ce7 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Tue, 2 Oct 2007 22:05:16 +0000 Subject: [PATCH] Unified such names as protocol references, instance methods and class methods and their accessors in a variety of objective-c classes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42555 91177308-0d34-0410-b5e6-96231b3b80d8 --- AST/Decl.cpp | 68 +++++++------- Sema/SemaDecl.cpp | 46 +++++----- clang.xcodeproj/project.pbxproj | 1 + include/clang/AST/DeclObjC.h | 157 ++++++++++++++++---------------- 4 files changed, 139 insertions(+), 133 deletions(-) diff --git a/AST/Decl.cpp b/AST/Decl.cpp index 9e02607cf3..8c9638c5c9 100644 --- a/AST/Decl.cpp +++ b/AST/Decl.cpp @@ -320,15 +320,15 @@ void ObjcInterfaceDecl::ObjcAddMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, ObjcMethodDecl **clsMethods, unsigned numClsMembers) { - NumInsMethods = numInsMembers; + NumInstanceMethods = numInsMembers; if (numInsMembers) { - InsMethods = new ObjcMethodDecl*[numInsMembers]; - memcpy(InsMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); + InstanceMethods = new ObjcMethodDecl*[numInsMembers]; + memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); } - NumClsMethods = numClsMembers; + NumClassMethods = numClsMembers; if (numClsMembers) { - ClsMethods = new ObjcMethodDecl*[numClsMembers]; - memcpy(ClsMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); + ClassMethods = new ObjcMethodDecl*[numClsMembers]; + memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); } } @@ -339,15 +339,15 @@ void ObjcProtocolDecl::ObjcAddProtoMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, ObjcMethodDecl **clsMethods, unsigned numClsMembers) { - NumProtoInsMethods = numInsMembers; + NumInstanceMethods = numInsMembers; if (numInsMembers) { - ProtoInsMethods = new ObjcMethodDecl*[numInsMembers]; - memcpy(ProtoInsMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); + InstanceMethods = new ObjcMethodDecl*[numInsMembers]; + memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); } - NumProtoClsMethods = numClsMembers; + NumClassMethods = numClsMembers; if (numClsMembers) { - ProtoClsMethods = new ObjcMethodDecl*[numClsMembers]; - memcpy(ProtoClsMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); + ClassMethods = new ObjcMethodDecl*[numClsMembers]; + memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); } } @@ -358,15 +358,15 @@ void ObjcCategoryDecl::ObjcAddCatMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, ObjcMethodDecl **clsMethods, unsigned numClsMembers) { - NumCatInsMethods = numInsMembers; + NumInstanceMethods = numInsMembers; if (numInsMembers) { - CatInsMethods = new ObjcMethodDecl*[numInsMembers]; - memcpy(CatInsMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); + InstanceMethods = new ObjcMethodDecl*[numInsMembers]; + memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); } - NumCatClsMethods = numClsMembers; + NumClassMethods = numClsMembers; if (numClsMembers) { - CatClsMethods = new ObjcMethodDecl*[numClsMembers]; - memcpy(CatClsMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); + ClassMethods = new ObjcMethodDecl*[numClsMembers]; + memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); } } @@ -377,15 +377,15 @@ void ObjcCategoryImplDecl::ObjcAddCatImplMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, ObjcMethodDecl **clsMethods, unsigned numClsMembers) { - NumCatInsMethods = numInsMembers; + NumInstanceMethods = numInsMembers; if (numInsMembers) { - CatInsMethods = new ObjcMethodDecl*[numInsMembers]; - memcpy(CatInsMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); + InstanceMethods = new ObjcMethodDecl*[numInsMembers]; + memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); } - NumCatClsMethods = numClsMembers; + NumClassMethods = numClsMembers; if (numClsMembers) { - CatClsMethods = new ObjcMethodDecl*[numClsMembers]; - memcpy(CatClsMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); + ClassMethods = new ObjcMethodDecl*[numClsMembers]; + memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); } } @@ -396,15 +396,15 @@ void ObjcImplementationDecl::ObjcAddImplMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, ObjcMethodDecl **clsMethods, unsigned numClsMembers) { - NumInsMethods = numInsMembers; + NumInstanceMethods = numInsMembers; if (numInsMembers) { - InsMethods = new ObjcMethodDecl*[numInsMembers]; - memcpy(InsMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); + InstanceMethods = new ObjcMethodDecl*[numInsMembers]; + memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*)); } - NumClsMethods = numClsMembers; + NumClassMethods = numClsMembers; if (numClsMembers) { - ClsMethods = new ObjcMethodDecl*[numClsMembers]; - memcpy(ClsMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); + ClassMethods = new ObjcMethodDecl*[numClsMembers]; + memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*)); } } @@ -412,8 +412,8 @@ void ObjcImplementationDecl::ObjcAddImplMethods(ObjcMethodDecl **insMethods, ObjcMethodDecl *ObjcInterfaceDecl::lookupInstanceMethod(Selector &Sel) { ObjcInterfaceDecl* ClassDecl = this; while (ClassDecl != NULL) { - ObjcMethodDecl **methods = ClassDecl->getInsMethods(); - int methodCount = ClassDecl->getNumInsMethods(); + ObjcMethodDecl **methods = ClassDecl->getInstanceMethods(); + int methodCount = ClassDecl->getNumInstanceMethods(); for (int i = 0; i < methodCount; ++i) { if (methods[i]->getSelector() == Sel) { return methods[i]; @@ -428,8 +428,8 @@ ObjcMethodDecl *ObjcInterfaceDecl::lookupInstanceMethod(Selector &Sel) { ObjcMethodDecl *ObjcInterfaceDecl::lookupClassMethod(Selector &Sel) { ObjcInterfaceDecl* ClassDecl = this; while (ClassDecl != NULL) { - ObjcMethodDecl **methods = ClassDecl->getClsMethods(); - int methodCount = ClassDecl->getNumClsMethods(); + ObjcMethodDecl **methods = ClassDecl->getClassMethods(); + int methodCount = ClassDecl->getNumClassMethods(); for (int i = 0; i < methodCount; ++i) { if (methods[i]->getSelector() == Sel) { return methods[i]; diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 1e0198aa85..82c4596022 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -1221,8 +1221,8 @@ void Sema::CheckProtocolMethodDefs(ObjcProtocolDecl *PDecl, const llvm::DenseMap& InsMap, const llvm::DenseMap& ClsMap) { // check unimplemented instance methods. - ObjcMethodDecl** methods = PDecl->getInsMethods(); - for (int j = 0; j < PDecl->getNumInsMethods(); j++) + ObjcMethodDecl** methods = PDecl->getInstanceMethods(); + for (int j = 0; j < PDecl->getNumInstanceMethods(); j++) if (!InsMap.count(methods[j]->getSelector().getAsOpaquePtr())) { llvm::SmallString<128> buf; Diag(methods[j]->getLocation(), diag::warn_undef_method_impl, @@ -1230,8 +1230,8 @@ void Sema::CheckProtocolMethodDefs(ObjcProtocolDecl *PDecl, IncompleteImpl = true; } // check unimplemented class methods - methods = PDecl->getClsMethods(); - for (int j = 0; j < PDecl->getNumClsMethods(); j++) + methods = PDecl->getClassMethods(); + for (int j = 0; j < PDecl->getNumClassMethods(); j++) if (!ClsMap.count(methods[j]->getSelector().getAsOpaquePtr())) { llvm::SmallString<128> buf; Diag(methods[j]->getLocation(), diag::warn_undef_method_impl, @@ -1250,14 +1250,14 @@ void Sema::ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, llvm::DenseMap InsMap; // Check and see if instance methods in class interface have been // implemented in the implementation class. - ObjcMethodDecl **methods = IMPDecl->getInsMethods(); - for (int i=0; i < IMPDecl->getNumInsMethods(); i++) { + ObjcMethodDecl **methods = IMPDecl->getInstanceMethods(); + for (int i=0; i < IMPDecl->getNumInstanceMethods(); i++) { InsMap[methods[i]->getSelector().getAsOpaquePtr()] = 'a'; } bool IncompleteImpl = false; - methods = IDecl->getInsMethods(); - for (int j = 0; j < IDecl->getNumInsMethods(); j++) + methods = IDecl->getInstanceMethods(); + for (int j = 0; j < IDecl->getNumInstanceMethods(); j++) if (!InsMap.count(methods[j]->getSelector().getAsOpaquePtr())) { llvm::SmallString<128> buf; Diag(methods[j]->getLocation(), diag::warn_undef_method_impl, @@ -1267,13 +1267,13 @@ void Sema::ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, llvm::DenseMap ClsMap; // Check and see if class methods in class interface have been // implemented in the implementation class. - methods = IMPDecl->getClsMethods(); - for (int i=0; i < IMPDecl->getNumClsMethods(); i++) { + methods = IMPDecl->getClassMethods(); + for (int i=0; i < IMPDecl->getNumClassMethods(); i++) { ClsMap[methods[i]->getSelector().getAsOpaquePtr()] = 'a'; } - methods = IDecl->getClsMethods(); - for (int j = 0; j < IDecl->getNumClsMethods(); j++) + methods = IDecl->getClassMethods(); + for (int j = 0; j < IDecl->getNumClassMethods(); j++) if (!ClsMap.count(methods[j]->getSelector().getAsOpaquePtr())) { llvm::SmallString<128> buf; Diag(methods[j]->getLocation(), diag::warn_undef_method_impl, @@ -1283,7 +1283,7 @@ void Sema::ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl, // Check the protocol list for unimplemented methods in the @implementation // class. - ObjcProtocolDecl** protocols = IDecl->getIntfRefProtocols(); + ObjcProtocolDecl** protocols = IDecl->getReferencedProtocols(); for (int i = 0; i < IDecl->getNumIntfRefProtocols(); i++) { ObjcProtocolDecl* PDecl = protocols[i]; CheckProtocolMethodDefs(PDecl, IncompleteImpl, InsMap, ClsMap); @@ -1300,14 +1300,14 @@ void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl, llvm::DenseMap InsMap; // Check and see if instance methods in category interface have been // implemented in its implementation class. - ObjcMethodDecl **methods = CatImplDecl->getCatInsMethods(); - for (int i=0; i < CatImplDecl->getNumCatInsMethods(); i++) { + ObjcMethodDecl **methods = CatImplDecl->getInstanceMethods(); + for (int i=0; i < CatImplDecl->getNumInstanceMethods(); i++) { InsMap[methods[i]->getSelector().getAsOpaquePtr()] = 'a'; } bool IncompleteImpl = false; - methods = CatClassDecl->getCatInsMethods(); - for (int j = 0; j < CatClassDecl->getNumCatInsMethods(); j++) + methods = CatClassDecl->getInstanceMethods(); + for (int j = 0; j < CatClassDecl->getNumInstanceMethods(); j++) if (!InsMap.count(methods[j]->getSelector().getAsOpaquePtr())) { llvm::SmallString<128> buf; Diag(methods[j]->getLocation(), diag::warn_undef_method_impl, @@ -1317,13 +1317,13 @@ void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl, llvm::DenseMap ClsMap; // Check and see if class methods in category interface have been // implemented in its implementation class. - methods = CatImplDecl->getCatClsMethods(); - for (int i=0; i < CatImplDecl->getNumCatClsMethods(); i++) { + methods = CatImplDecl->getClassMethods(); + for (int i=0; i < CatImplDecl->getNumClassMethods(); i++) { ClsMap[methods[i]->getSelector().getAsOpaquePtr()] = 'a'; } - methods = CatClassDecl->getCatClsMethods(); - for (int j = 0; j < CatClassDecl->getNumCatClsMethods(); j++) + methods = CatClassDecl->getClassMethods(); + for (int j = 0; j < CatClassDecl->getNumClassMethods(); j++) if (!ClsMap.count(methods[j]->getSelector().getAsOpaquePtr())) { llvm::SmallString<128> buf; Diag(methods[j]->getLocation(), diag::warn_undef_method_impl, @@ -1333,8 +1333,8 @@ void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl, // Check the protocol list for unimplemented methods in the @implementation // class. - ObjcProtocolDecl** protocols = CatClassDecl->getCatReferencedProtocols(); - for (int i = 0; i < CatClassDecl->getNumCatReferencedProtocols(); i++) { + ObjcProtocolDecl** protocols = CatClassDecl->getReferencedProtocols(); + for (int i = 0; i < CatClassDecl->getNumReferencedProtocols(); i++) { ObjcProtocolDecl* PDecl = protocols[i]; CheckProtocolMethodDefs(PDecl, IncompleteImpl, InsMap, ClsMap); } diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj index 314ed3ea3c..6389e5fbc4 100644 --- a/clang.xcodeproj/project.pbxproj +++ b/clang.xcodeproj/project.pbxproj @@ -737,6 +737,7 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */; + compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* clang */; projectDirPath = ""; diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index b0ff5feb9d..b7fa9ae10c 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -53,20 +53,20 @@ class ObjcInterfaceDecl : public TypeDecl { ObjcInterfaceDecl *SuperClass; /// Protocols referenced in interface header declaration - ObjcProtocolDecl **IntfRefProtocols; // Null if none - int NumIntfRefProtocols; // -1 if none + ObjcProtocolDecl **ReferencedProtocols; // Null if none + int NumReferencedProtocols; // -1 if none /// Ivars/NumIvars - This is a new[]'d array of pointers to Decls. ObjcIvarDecl **Ivars; // Null if not defined. int NumIvars; // -1 if not defined. /// instance methods - ObjcMethodDecl **InsMethods; // Null if not defined - int NumInsMethods; // -1 if not defined + ObjcMethodDecl **InstanceMethods; // Null if not defined + int NumInstanceMethods; // -1 if not defined /// class methods - ObjcMethodDecl **ClsMethods; // Null if not defined - int NumClsMethods; // -1 if not defined + ObjcMethodDecl **ClassMethods; // Null if not defined + int NumClassMethods; // -1 if not defined /// List of categories defined for this class. ObjcCategoryDecl *ListCategories; @@ -76,8 +76,10 @@ public: ObjcInterfaceDecl(SourceLocation L, unsigned numRefProtos, IdentifierInfo *Id, bool FD = false) : TypeDecl(ObjcInterface, L, Id, 0), SuperClass(0), - IntfRefProtocols(0), NumIntfRefProtocols(-1), Ivars(0), NumIvars(-1), - InsMethods(0), NumInsMethods(-1), ClsMethods(0), NumClsMethods(-1), + ReferencedProtocols(0), NumReferencedProtocols(-1), Ivars(0), + NumIvars(-1), + InstanceMethods(0), NumInstanceMethods(-1), + ClassMethods(0), NumClassMethods(-1), ListCategories(0), ForwardDecl(FD) { AllocIntfRefProtocols(numRefProtos); } @@ -85,24 +87,26 @@ public: // This is necessary when converting a forward declaration to a definition. void AllocIntfRefProtocols(unsigned numRefProtos) { if (numRefProtos) { - IntfRefProtocols = new ObjcProtocolDecl*[numRefProtos]; - memset(IntfRefProtocols, '\0', + ReferencedProtocols = new ObjcProtocolDecl*[numRefProtos]; + memset(ReferencedProtocols, '\0', numRefProtos*sizeof(ObjcProtocolDecl*)); - NumIntfRefProtocols = numRefProtos; + NumReferencedProtocols = numRefProtos; } } - ObjcProtocolDecl **getIntfRefProtocols() const { return IntfRefProtocols; } - int getNumIntfRefProtocols() const { return NumIntfRefProtocols; } + ObjcProtocolDecl **getReferencedProtocols() const { + return ReferencedProtocols; + } + int getNumIntfRefProtocols() const { return NumReferencedProtocols; } ObjcIvarDecl **getIntfDeclIvars() const { return Ivars; } int getIntfDeclNumIvars() const { return NumIvars; } - ObjcMethodDecl** getInsMethods() const { return InsMethods; } - int getNumInsMethods() const { return NumInsMethods; } + ObjcMethodDecl** getInstanceMethods() const { return InstanceMethods; } + int getNumInstanceMethods() const { return NumInstanceMethods; } - ObjcMethodDecl** getClsMethods() const { return ClsMethods; } - int getNumClsMethods() const { return NumClsMethods; } + ObjcMethodDecl** getClassMethods() const { return ClassMethods; } + int getNumClassMethods() const { return NumClassMethods; } void ObjcAddInstanceVariablesToClass(ObjcIvarDecl **ivars, unsigned numIvars); @@ -114,8 +118,8 @@ public: void setForwardDecl(bool val) { ForwardDecl = val; } void setIntfRefProtocols(int idx, ObjcProtocolDecl *OID) { - assert((idx < NumIntfRefProtocols) && "index out of range"); - IntfRefProtocols[idx] = OID; + assert((idx < NumReferencedProtocols) && "index out of range"); + ReferencedProtocols[idx] = OID; } ObjcInterfaceDecl *getSuperClass() const { return SuperClass; } @@ -277,12 +281,12 @@ class ObjcProtocolDecl : public TypeDecl { int NumReferencedProtocols; // -1 if none /// protocol instance methods - ObjcMethodDecl **ProtoInsMethods; // Null if not defined - int NumProtoInsMethods; // -1 if not defined + ObjcMethodDecl **InstanceMethods; // Null if not defined + int NumInstanceMethods; // -1 if not defined /// protocol class methods - ObjcMethodDecl **ProtoClsMethods; // Null if not defined - int NumProtoClsMethods; // -1 if not defined + ObjcMethodDecl **ClassMethods; // Null if not defined + int NumClassMethods; // -1 if not defined bool isForwardProtoDecl; // declared with @protocol. public: @@ -290,8 +294,8 @@ public: IdentifierInfo *Id, bool FD = false) : TypeDecl(ObjcProtocol, L, Id, 0), ReferencedProtocols(0), NumReferencedProtocols(-1), - ProtoInsMethods(0), NumProtoInsMethods(-1), - ProtoClsMethods(0), NumProtoClsMethods(-1), + InstanceMethods(0), NumInstanceMethods(-1), + ClassMethods(0), NumClassMethods(-1), isForwardProtoDecl(FD) { AllocReferencedProtocols(numRefProtos); } @@ -316,11 +320,11 @@ public: } int getNumReferencedProtocols() const { return NumReferencedProtocols; } - ObjcMethodDecl** getInsMethods() const { return ProtoInsMethods; } - int getNumInsMethods() const { return NumProtoInsMethods; } + ObjcMethodDecl** getInstanceMethods() const { return InstanceMethods; } + int getNumInstanceMethods() const { return NumInstanceMethods; } - ObjcMethodDecl** getClsMethods() const { return ProtoClsMethods; } - int getNumClsMethods() const { return NumProtoClsMethods; } + ObjcMethodDecl** getClassMethods() const { return ClassMethods; } + int getNumClassMethods() const { return NumClassMethods; } bool isForwardDecl() const { return isForwardProtoDecl; } void setForwardDecl(bool val) { isForwardProtoDecl = val; } @@ -363,20 +367,20 @@ public: /// @protocol NSTextInput, NSChangeSpelling, NSDraggingInfo; /// class ObjcForwardProtocolDecl : public TypeDecl { - ObjcProtocolDecl **ForwardProtocolDecls; // Null if not defined. - int NumForwardProtocolDecls; // -1 if not defined. + ObjcProtocolDecl **ReferencedProtocols; // Null if not defined. + int NumReferencedProtocols; // -1 if not defined. public: ObjcForwardProtocolDecl(SourceLocation L, unsigned nElts) : TypeDecl(ObjcForwardProtocol, L, 0, 0) { if (nElts) { - ForwardProtocolDecls = new ObjcProtocolDecl*[nElts]; - memset(ForwardProtocolDecls, '\0', nElts*sizeof(ObjcProtocolDecl*)); - NumForwardProtocolDecls = nElts; + ReferencedProtocols = new ObjcProtocolDecl*[nElts]; + memset(ReferencedProtocols, '\0', nElts*sizeof(ObjcProtocolDecl*)); + NumReferencedProtocols = nElts; } } void setForwardProtocolDecl(int idx, ObjcProtocolDecl *OID) { - assert((idx < NumForwardProtocolDecls) && "index out of range"); - ForwardProtocolDecls[idx] = OID; + assert((idx < NumReferencedProtocols) && "index out of range"); + ReferencedProtocols[idx] = OID; } static bool classof(const Decl *D) { return D->getKind() == ObjcForwardProtocol; @@ -409,16 +413,16 @@ class ObjcCategoryDecl : public Decl { IdentifierInfo *ObjcCatName; /// referenced protocols in this category - ObjcProtocolDecl **CatReferencedProtocols; // Null if none - int NumCatReferencedProtocols; // -1 if none + ObjcProtocolDecl **ReferencedProtocols; // Null if none + int NumReferencedProtocols; // -1 if none /// category instance methods - ObjcMethodDecl **CatInsMethods; // Null if not defined - int NumCatInsMethods; // -1 if not defined + ObjcMethodDecl **InstanceMethods; // Null if not defined + int NumInstanceMethods; // -1 if not defined /// category class methods - ObjcMethodDecl **CatClsMethods; // Null if not defined - int NumCatClsMethods; // -1 if not defined + ObjcMethodDecl **ClassMethods; // Null if not defined + int NumClassMethods; // -1 if not defined /// Next category belonging to this class ObjcCategoryDecl *NextClassCategory; @@ -430,15 +434,15 @@ public: ObjcCategoryDecl(SourceLocation L, unsigned numRefProtocol) : Decl(ObjcCategory), ClassInterface(0), ObjcCatName(0), - CatReferencedProtocols(0), NumCatReferencedProtocols(-1), - CatInsMethods(0), NumCatInsMethods(-1), - CatClsMethods(0), NumCatClsMethods(-1), + ReferencedProtocols(0), NumReferencedProtocols(-1), + InstanceMethods(0), NumInstanceMethods(-1), + ClassMethods(0), NumClassMethods(-1), NextClassCategory(0), CatLoc(L) { if (numRefProtocol) { - CatReferencedProtocols = new ObjcProtocolDecl*[numRefProtocol]; - memset(CatReferencedProtocols, '\0', + ReferencedProtocols = new ObjcProtocolDecl*[numRefProtocol]; + memset(ReferencedProtocols, '\0', numRefProtocol*sizeof(ObjcProtocolDecl*)); - NumCatReferencedProtocols = numRefProtocol; + NumReferencedProtocols = numRefProtocol; } } @@ -446,20 +450,20 @@ public: void setClassInterface(ObjcInterfaceDecl *IDecl) { ClassInterface = IDecl; } void setCatReferencedProtocols(int idx, ObjcProtocolDecl *OID) { - assert((idx < NumCatReferencedProtocols) && "index out of range"); - CatReferencedProtocols[idx] = OID; + assert((idx < NumReferencedProtocols) && "index out of range"); + ReferencedProtocols[idx] = OID; } - ObjcProtocolDecl **getCatReferencedProtocols() const { - return CatReferencedProtocols; + ObjcProtocolDecl **getReferencedProtocols() const { + return ReferencedProtocols; } - int getNumCatReferencedProtocols() const { return NumCatReferencedProtocols; } + int getNumReferencedProtocols() const { return NumReferencedProtocols; } - ObjcMethodDecl **getCatInsMethods() const { return CatInsMethods; } - int getNumCatInsMethods() const { return NumCatInsMethods; } + ObjcMethodDecl **getInstanceMethods() const { return InstanceMethods; } + int getNumInstanceMethods() const { return NumInstanceMethods; } - ObjcMethodDecl **getCatClsMethods() const { return CatClsMethods; } - int getNumCatClsMethods() const { return NumCatClsMethods; } + ObjcMethodDecl **getClassMethods() const { return ClassMethods; } + int getNumClassMethods() const { return NumClassMethods; } void ObjcAddCatMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, ObjcMethodDecl **clsMethods, unsigned numClsMembers); @@ -491,12 +495,12 @@ class ObjcCategoryImplDecl : public Decl { IdentifierInfo *ObjcCatName; /// category instance methods being implemented - ObjcMethodDecl **CatInsMethods; // Null if category is not implementing any - int NumCatInsMethods; // -1 if category is not implementing any + ObjcMethodDecl **InstanceMethods; // Null if category is not implementing any + int NumInstanceMethods; // -1 if category is not implementing any /// category class methods being implemented - ObjcMethodDecl **CatClsMethods; // Null if category is not implementing any - int NumCatClsMethods; // -1 if category is not implementing any + ObjcMethodDecl **ClassMethods; // Null if category is not implementing any + int NumClassMethods; // -1 if category is not implementing any public: ObjcCategoryImplDecl(SourceLocation L, IdentifierInfo *Id, @@ -505,8 +509,8 @@ class ObjcCategoryImplDecl : public Decl { : Decl(ObjcCategoryImpl), ClassInterface(classInterface), ObjcCatName(catName), - CatInsMethods(0), NumCatInsMethods(-1), - CatClsMethods(0), NumCatClsMethods(-1) {} + InstanceMethods(0), NumInstanceMethods(-1), + ClassMethods(0), NumClassMethods(-1) {} ObjcInterfaceDecl *getClassInterface() const { return ClassInterface; @@ -514,11 +518,11 @@ class ObjcCategoryImplDecl : public Decl { IdentifierInfo *getObjcCatName() const { return ObjcCatName; } - ObjcMethodDecl **getCatInsMethods() const { return CatInsMethods; } - int getNumCatInsMethods() const { return NumCatInsMethods; } + ObjcMethodDecl **getInstanceMethods() const { return InstanceMethods; } + int getNumInstanceMethods() const { return NumInstanceMethods; } - ObjcMethodDecl **getCatClsMethods() const { return CatClsMethods; } - int getNumCatClsMethods() const { return NumCatClsMethods; } + ObjcMethodDecl **getClassMethods() const { return ClassMethods; } + int getNumClassMethods() const { return NumClassMethods; } void ObjcAddCatImplMethods( ObjcMethodDecl **insMethods, unsigned numInsMembers, @@ -555,12 +559,12 @@ class ObjcImplementationDecl : public TypeDecl { int NumIvars; // -1 if not defined. /// implemented instance methods - ObjcMethodDecl **InsMethods; // Null if not defined - int NumInsMethods; // -1 if not defined + ObjcMethodDecl **InstanceMethods; // Null if not defined + int NumInstanceMethods; // -1 if not defined /// implemented class methods - ObjcMethodDecl **ClsMethods; // Null if not defined - int NumClsMethods; // -1 if not defined + ObjcMethodDecl **ClassMethods; // Null if not defined + int NumClassMethods; // -1 if not defined public: ObjcImplementationDecl(SourceLocation L, IdentifierInfo *Id, @@ -568,7 +572,8 @@ class ObjcImplementationDecl : public TypeDecl { : TypeDecl(ObjcImplementation, L, Id, 0), SuperClass(superDecl), Ivars(0), NumIvars(-1), - InsMethods(0), NumInsMethods(-1), ClsMethods(0), NumClsMethods(-1) {} + InstanceMethods(0), NumInstanceMethods(-1), + ClassMethods(0), NumClassMethods(-1) {} void ObjcAddInstanceVariablesToClassImpl(ObjcIvarDecl **ivars, unsigned numIvars); @@ -581,11 +586,11 @@ class ObjcImplementationDecl : public TypeDecl { void setImplSuperClass(ObjcInterfaceDecl * superCls) { SuperClass = superCls; } - ObjcMethodDecl **getInsMethods() const { return InsMethods; } - int getNumInsMethods() const { return NumInsMethods; } + ObjcMethodDecl **getInstanceMethods() const { return InstanceMethods; } + int getNumInstanceMethods() const { return NumInstanceMethods; } - ObjcMethodDecl **getClsMethods() const { return ClsMethods; } - int getNumClsMethods() const { return NumClsMethods; } + ObjcMethodDecl **getClassMethods() const { return ClassMethods; } + int getNumClassMethods() const { return NumClassMethods; } static bool classof(const Decl *D) { return D->getKind() == ObjcImplementation; -- 2.40.0