From b170ca5f4a8397c10e52050ff5df6885a3e6eca9 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 27 Apr 2010 17:47:25 +0000 Subject: [PATCH] More simplifications. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102447 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTContext.cpp | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 91fafbabc2..4d7ea40079 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -781,9 +781,7 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl, CollectInheritedProtocols(SD, Protocols); SD = SD->getSuperClass(); } - return; - } - if (const ObjCCategoryDecl *OC = dyn_cast(CDecl)) { + } else if (const ObjCCategoryDecl *OC = dyn_cast(CDecl)) { for (ObjCInterfaceDecl::protocol_iterator P = OC->protocol_begin(), PE = OC->protocol_end(); P != PE; ++P) { ObjCProtocolDecl *Proto = (*P); @@ -792,9 +790,7 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl, PE = Proto->protocol_end(); P != PE; ++P) CollectInheritedProtocols(*P, Protocols); } - return; - } - if (const ObjCProtocolDecl *OP = dyn_cast(CDecl)) { + } else if (const ObjCProtocolDecl *OP = dyn_cast(CDecl)) { for (ObjCProtocolDecl::protocol_iterator P = OP->protocol_begin(), PE = OP->protocol_end(); P != PE; ++P) { ObjCProtocolDecl *Proto = (*P); @@ -803,26 +799,20 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl, PE = Proto->protocol_end(); P != PE; ++P) CollectInheritedProtocols(*P, Protocols); } - return; } } unsigned ASTContext::CountNonClassIvars(const ObjCInterfaceDecl *OI) { unsigned count = 0; // Count ivars declared in class extension. - if (const ObjCCategoryDecl *CDecl = OI->getClassExtension()) { - for (ObjCCategoryDecl::ivar_iterator I = CDecl->ivar_begin(), - E = CDecl->ivar_end(); I != E; ++I) { - ++count; - } - } - + if (const ObjCCategoryDecl *CDecl = OI->getClassExtension()) + count += CDecl->ivar_size(); + // Count ivar defined in this class's implementation. This // includes synthesized ivars. if (ObjCImplementationDecl *ImplDecl = OI->getImplementation()) - for (ObjCImplementationDecl::ivar_iterator I = ImplDecl->ivar_begin(), - E = ImplDecl->ivar_end(); I != E; ++I) - ++count; + count += ImplDecl->ivar_size(); + return count; } -- 2.40.0