From: Steve Naroff Date: Tue, 2 Oct 2007 20:26:23 +0000 (+0000) Subject: Rename ObjcInterfaceDecl::getIsForwardDecl() to isForwardDecl(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=768f26ee5892cd63ff0335a15d71a2385ba7c5ea;p=clang Rename ObjcInterfaceDecl::getIsForwardDecl() to isForwardDecl(). Rename ObjcProtocolDecl::getIsForwardProtoDecl() to isForwardDecl(). Rename ObjcInterfaceDecl::setIsForwardDecl() to setForwardDecl(). Rename ObjcProtocolDecl::setIsForwardProtoDecl() to setForwardDecl(). Two reasons: #1: boolean predicates should start with "is". #2: Since these two sets of methods represent the same concept, they should be named the same (polymorphism is good:-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42545 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index aff4b66f95..64789bc3f5 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -915,10 +915,10 @@ Sema::DeclTy *Sema::ObjcStartClassInterface(Scope* S, ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(ClassName); if (IDecl) { // Class already seen. Is it a forward declaration? - if (!IDecl->getIsForwardDecl()) + if (!IDecl->isForwardDecl()) Diag(AtInterfaceLoc, diag::err_duplicate_class_def, ClassName->getName()); else { - IDecl->setIsForwardDecl(false); + IDecl->setForwardDecl(false); IDecl->AllocIntfRefProtocols(NumProtocols); } } @@ -945,7 +945,7 @@ Sema::DeclTy *Sema::ObjcStartClassInterface(Scope* S, // Check that super class is previously defined SuperClassEntry = getObjCInterfaceDecl(SuperName); - if (!SuperClassEntry || SuperClassEntry->getIsForwardDecl()) { + if (!SuperClassEntry || SuperClassEntry->isForwardDecl()) { Diag(AtInterfaceLoc, diag::err_undef_superclass, SuperName->getName(), ClassName->getName()); } @@ -957,7 +957,7 @@ Sema::DeclTy *Sema::ObjcStartClassInterface(Scope* S, for (unsigned int i = 0; i != NumProtocols; i++) { ObjcProtocolDecl* RefPDecl = getObjCProtocolDecl(S, ProtocolNames[i], ClassLoc); - if (!RefPDecl || RefPDecl->getIsForwardProtoDecl()) + if (!RefPDecl || RefPDecl->isForwardDecl()) Diag(ClassLoc, diag::err_undef_protocolref, ProtocolNames[i]->getName(), ClassName->getName()); @@ -975,18 +975,18 @@ Sema::DeclTy *Sema::ObjcStartProtoInterface(Scope* S, ObjcProtocolDecl *PDecl = getObjCProtocolDecl(S, ProtocolName, ProtocolLoc); if (PDecl) { // Protocol already seen. Better be a forward protocol declaration - if (!PDecl->getIsForwardProtoDecl()) + if (!PDecl->isForwardDecl()) Diag(ProtocolLoc, diag::err_duplicate_protocol_def, ProtocolName->getName()); else { - PDecl->setIsForwardProtoDecl(false); + PDecl->setForwardDecl(false); PDecl->AllocReferencedProtocols(NumProtoRefs); } } else { PDecl = new ObjcProtocolDecl(AtProtoInterfaceLoc, NumProtoRefs, ProtocolName); - PDecl->setIsForwardProtoDecl(false); + PDecl->setForwardDecl(false); // Chain & install the protocol decl into the identifier. PDecl->setNext(ProtocolName->getFETokenInfo()); ProtocolName->setFETokenInfo(PDecl); @@ -996,7 +996,7 @@ Sema::DeclTy *Sema::ObjcStartProtoInterface(Scope* S, for (unsigned int i = 0; i != NumProtoRefs; i++) { ObjcProtocolDecl* RefPDecl = getObjCProtocolDecl(S, ProtoRefNames[i], ProtocolLoc); - if (!RefPDecl || RefPDecl->getIsForwardProtoDecl()) + if (!RefPDecl || RefPDecl->isForwardDecl()) Diag(ProtocolLoc, diag::err_undef_protocolref, ProtoRefNames[i]->getName(), ProtocolName->getName()); @@ -1042,7 +1042,7 @@ Sema::DeclTy *Sema::ObjcStartCatInterface(Scope* S, CDecl->setClassInterface(IDecl); /// Check that class of this category is already completely declared. - if (!IDecl || IDecl->getIsForwardDecl()) + if (!IDecl || IDecl->isForwardDecl()) Diag(ClassLoc, diag::err_undef_interface, ClassName->getName()); else { /// Check for duplicate interface declaration for this category @@ -1065,7 +1065,7 @@ Sema::DeclTy *Sema::ObjcStartCatInterface(Scope* S, for (unsigned int i = 0; i != NumProtoRefs; i++) { ObjcProtocolDecl* RefPDecl = getObjCProtocolDecl(S, ProtoRefNames[i], CategoryLoc); - if (!RefPDecl || RefPDecl->getIsForwardProtoDecl()) + if (!RefPDecl || RefPDecl->isForwardDecl()) Diag(CategoryLoc, diag::err_undef_protocolref, ProtoRefNames[i]->getName(), CategoryName->getName()); @@ -1087,7 +1087,7 @@ Sema::DeclTy *Sema::ObjcStartCategoryImplementation(Scope* S, ClassName, IDecl, CatName); /// Check that class of this category is already completely declared. - if (!IDecl || IDecl->getIsForwardDecl()) + if (!IDecl || IDecl->isForwardDecl()) Diag(ClassLoc, diag::err_undef_interface, ClassName->getName()); /// TODO: Check that CatName, category name, is not used in another // implementation. diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index bd0b647abd..4509be0953 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -71,17 +71,14 @@ class ObjcInterfaceDecl : public TypeDecl { /// List of categories defined for this class. ObjcCategoryDecl *ListCategories; - bool isForwardDecl; // declared with @class. + bool ForwardDecl; // declared with @class. 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), + : TypeDecl(ObjcInterface, L, Id, 0), SuperClass(0), + IntfRefProtocols(0), NumIntfRefProtocols(-1), Ivars(0), NumIvars(-1), InsMethods(0), NumInsMethods(-1), ClsMethods(0), NumClsMethods(-1), - ListCategories(0), - isForwardDecl(FD) { + ListCategories(0), ForwardDecl(FD) { AllocIntfRefProtocols(numRefProtos); } @@ -112,8 +109,8 @@ public: void ObjcAddMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, ObjcMethodDecl **clsMethods, unsigned numClsMembers); - bool getIsForwardDecl() const { return isForwardDecl; } - void setIsForwardDecl(bool val) { isForwardDecl = val; } + bool isForwardDecl() const { return ForwardDecl; } + void setForwardDecl(bool val) { ForwardDecl = val; } void setIntfRefProtocols(int idx, ObjcProtocolDecl *OID) { assert((idx < NumIntfRefProtocols) && "index out of range"); @@ -324,8 +321,8 @@ public: ObjcMethodDecl** getClsMethods() const { return ProtoClsMethods; } int getNumClsMethods() const { return NumProtoClsMethods; } - bool getIsForwardProtoDecl() const { return isForwardProtoDecl; } - void setIsForwardProtoDecl(bool val) { isForwardProtoDecl = val; } + bool isForwardDecl() const { return isForwardProtoDecl; } + void setForwardDecl(bool val) { isForwardProtoDecl = val; } static bool classof(const Decl *D) { return D->getKind() == ObjcProtocol;