@@ -781,9 +781,7 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl,
781
781
CollectInheritedProtocols (SD, Protocols);
782
782
SD = SD->getSuperClass ();
783
783
}
784
- return ;
785
- }
786
- if (const ObjCCategoryDecl *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
784
+ } else if (const ObjCCategoryDecl *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
787
785
for (ObjCInterfaceDecl::protocol_iterator P = OC->protocol_begin (),
788
786
PE = OC->protocol_end (); P != PE; ++P) {
789
787
ObjCProtocolDecl *Proto = (*P);
@@ -792,9 +790,7 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl,
792
790
PE = Proto->protocol_end (); P != PE; ++P)
793
791
CollectInheritedProtocols (*P, Protocols);
794
792
}
795
- return ;
796
- }
797
- if (const ObjCProtocolDecl *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
793
+ } else if (const ObjCProtocolDecl *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
798
794
for (ObjCProtocolDecl::protocol_iterator P = OP->protocol_begin (),
799
795
PE = OP->protocol_end (); P != PE; ++P) {
800
796
ObjCProtocolDecl *Proto = (*P);
@@ -803,26 +799,20 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl,
803
799
PE = Proto->protocol_end (); P != PE; ++P)
804
800
CollectInheritedProtocols (*P, Protocols);
805
801
}
806
- return ;
807
802
}
808
803
}
809
804
810
805
unsigned ASTContext::CountNonClassIvars (const ObjCInterfaceDecl *OI) {
811
806
unsigned count = 0 ;
812
807
// 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
+
820
811
// Count ivar defined in this class's implementation. This
821
812
// includes synthesized ivars.
822
813
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
+
826
816
return count;
827
817
}
828
818
0 commit comments