From: Fariborz Jahanian Date: Tue, 9 Oct 2007 18:22:59 +0000 (+0000) Subject: Minor code clean up to make it more readable. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fe5c2a9022a1470d84d38ef8194e4b10f7b4809;p=clang Minor code clean up to make it more readable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42803 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 6629450387..d85ee6bc30 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -1031,31 +1031,28 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface(Scope* S, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs) { ObjcInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName); - ObjcCategoryDecl *CDecl; /// Check that class of this category is already completely declared. if (!IDecl || IDecl->isForwardDecl()) { Diag(ClassLoc, diag::err_undef_interface, ClassName->getName()); return 0; } - else { - CDecl = new ObjcCategoryDecl(AtInterfaceLoc, NumProtoRefs, - CategoryName); - CDecl->setClassInterface(IDecl); - /// Check for duplicate interface declaration for this category - ObjcCategoryDecl *CDeclChain; - for (CDeclChain = IDecl->getListCategories(); CDeclChain; - CDeclChain = CDeclChain->getNextClassCategory()) { - if (CDeclChain->getIdentifier() == CategoryName) { - Diag(CategoryLoc, diag::err_dup_category_def, ClassName->getName(), - CategoryName->getName()); - break; - } + ObjcCategoryDecl *CDecl = new ObjcCategoryDecl(AtInterfaceLoc, NumProtoRefs, + CategoryName); + CDecl->setClassInterface(IDecl); + /// Check for duplicate interface declaration for this category + ObjcCategoryDecl *CDeclChain; + for (CDeclChain = IDecl->getListCategories(); CDeclChain; + CDeclChain = CDeclChain->getNextClassCategory()) { + if (CDeclChain->getIdentifier() == CategoryName) { + Diag(CategoryLoc, diag::err_dup_category_def, ClassName->getName(), + CategoryName->getName()); + break; } - if (!CDeclChain) - CDecl->insertNextClassCategory(); } - + if (!CDeclChain) + CDecl->insertNextClassCategory(); + /// Check then save referenced protocols for (unsigned int i = 0; i != NumProtoRefs; i++) { ObjcProtocolDecl* RefPDecl = ObjcProtocols[ProtoRefNames[i]];