Skip to content

Commit f718a4c

Browse files
committed
AST: Remove IterableDeclContext::getMemberCount()
1 parent ccee48d commit f718a4c

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

include/swift/AST/DeclContext.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -712,13 +712,6 @@ class IterableDeclContext {
712712
/// member loading, as a key when doing lookup in this IDC.
713713
serialization::DeclID SerialID;
714714

715-
/// Because \c parseDelayedDecl and lazy member adding can add members *after*
716-
/// an \c ASTScope tree is created, there must be some way for the tree to
717-
/// detect when a member has been added. A bit would suffice,
718-
/// but would be more fragile, The scope code could count the members each
719-
/// time, but I think it's a better trade to just keep a count here.
720-
unsigned MemberCount : 29;
721-
722715
/// Whether we have already added the parsed members into the context.
723716
unsigned AddedParsedMembers : 1;
724717

@@ -741,7 +734,6 @@ class IterableDeclContext {
741734
public:
742735
IterableDeclContext(IterableDeclContextKind kind)
743736
: LastDeclAndKind(nullptr, kind) {
744-
MemberCount = 0;
745737
AddedParsedMembers = 0;
746738
HasOperatorDeclarations = 0;
747739
HasNestedClassDeclarations = 0;
@@ -794,9 +786,6 @@ class IterableDeclContext {
794786
/// is inserted immediately after the hint.
795787
void addMember(Decl *member, Decl *hint = nullptr);
796788

797-
/// See \c MemberCount
798-
unsigned getMemberCount() const;
799-
800789
/// Check whether there are lazily-loaded members.
801790
bool hasLazyMembers() const {
802791
return FirstDeclAndLazyMembers.getInt();

lib/AST/DeclContext.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ ArrayRef<Decl *> IterableDeclContext::getSemanticMembers() const {
768768
void IterableDeclContext::addMember(Decl *member, Decl *Hint) {
769769
// Add the member to the list of declarations without notification.
770770
addMemberSilently(member, Hint);
771-
++MemberCount;
772771

773772
// Notify our parent declaration that we have added the member, which can
774773
// be used to update the lookup tables.
@@ -847,12 +846,6 @@ bool IterableDeclContext::hasUnparsedMembers() const {
847846
return true;
848847
}
849848

850-
unsigned IterableDeclContext::getMemberCount() const {
851-
if (hasUnparsedMembers())
852-
loadAllMembers();
853-
return MemberCount;
854-
}
855-
856849
void IterableDeclContext::loadAllMembers() const {
857850
ASTContext &ctx = getASTContext();
858851

0 commit comments

Comments
 (0)