Skip to content

Commit 0a3fe04

Browse files
committed
More simplifications.
llvm-svn: 102447
1 parent 38b77a9 commit 0a3fe04

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,7 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl,
781781
CollectInheritedProtocols(SD, Protocols);
782782
SD = SD->getSuperClass();
783783
}
784-
return;
785-
}
786-
if (const ObjCCategoryDecl *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
784+
} else if (const ObjCCategoryDecl *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
787785
for (ObjCInterfaceDecl::protocol_iterator P = OC->protocol_begin(),
788786
PE = OC->protocol_end(); P != PE; ++P) {
789787
ObjCProtocolDecl *Proto = (*P);
@@ -792,9 +790,7 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl,
792790
PE = Proto->protocol_end(); P != PE; ++P)
793791
CollectInheritedProtocols(*P, Protocols);
794792
}
795-
return;
796-
}
797-
if (const ObjCProtocolDecl *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
793+
} else if (const ObjCProtocolDecl *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
798794
for (ObjCProtocolDecl::protocol_iterator P = OP->protocol_begin(),
799795
PE = OP->protocol_end(); P != PE; ++P) {
800796
ObjCProtocolDecl *Proto = (*P);
@@ -803,26 +799,20 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl,
803799
PE = Proto->protocol_end(); P != PE; ++P)
804800
CollectInheritedProtocols(*P, Protocols);
805801
}
806-
return;
807802
}
808803
}
809804

810805
unsigned ASTContext::CountNonClassIvars(const ObjCInterfaceDecl *OI) {
811806
unsigned count = 0;
812807
// Count ivars declared in class extension.
813-
if (const ObjCCategoryDecl *CDecl = OI->getClassExtension()) {
814-
for (ObjCCategoryDecl::ivar_iterator I = CDecl->ivar_begin(),
815-
E = CDecl->ivar_end(); I != E; ++I) {
816-
++count;
817-
}
818-
}
819-
808+
if (const ObjCCategoryDecl *CDecl = OI->getClassExtension())
809+
count += CDecl->ivar_size();
810+
820811
// Count ivar defined in this class's implementation. This
821812
// includes synthesized ivars.
822813
if (ObjCImplementationDecl *ImplDecl = OI->getImplementation())
823-
for (ObjCImplementationDecl::ivar_iterator I = ImplDecl->ivar_begin(),
824-
E = ImplDecl->ivar_end(); I != E; ++I)
825-
++count;
814+
count += ImplDecl->ivar_size();
815+
826816
return count;
827817
}
828818

0 commit comments

Comments
 (0)