diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-09 18:22:59 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-09 18:22:59 +0000 |
commit | c8e7a93b02b1bb6aa5d03314a404e79558a02d6d (patch) | |
tree | faff9816e11bb47cbba47b25b3fe7b39a9262718 | |
parent | 516ca70f5dd58878bc0d74962f9bf0968c52b7da (diff) | |
download | bcm5719-llvm-c8e7a93b02b1bb6aa5d03314a404e79558a02d6d.tar.gz bcm5719-llvm-c8e7a93b02b1bb6aa5d03314a404e79558a02d6d.zip |
Minor code clean up to make it more readable.
llvm-svn: 42803
-rw-r--r-- | clang/Sema/SemaDecl.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp index 6629450387c..d85ee6bc301 100644 --- a/clang/Sema/SemaDecl.cpp +++ b/clang/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]]; |