File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -692,6 +692,13 @@ class IterableDeclContext {
692
692
// / member loading, as a key when doing lookup in this IDC.
693
693
serialization::DeclID SerialID;
694
694
695
+ // / Because \c parseDelayedDecl and lazy member adding can add members *after*
696
+ // / an \c ASTScope tree is created, there must be some way for the tree to
697
+ // / detect when a member has been added. A bit would suffice,
698
+ // / but would be more fragile, The scope code could count the members each
699
+ // / time, but I think it's a better trade to just keep a count here.
700
+ unsigned memberCount = 0 ;
701
+
695
702
template <class A , class B , class C >
696
703
friend struct ::llvm::cast_convert_val;
697
704
@@ -721,6 +728,9 @@ class IterableDeclContext {
721
728
// / is inserted immediately after the hint.
722
729
void addMember (Decl *member, Decl *hint = nullptr );
723
730
731
+ // / See \c memberCount
732
+ unsigned getMemberCount () const { return memberCount; }
733
+
724
734
// / Check whether there are lazily-loaded members.
725
735
bool hasLazyMembers () const {
726
736
return FirstDeclAndLazyMembers.getInt () & LazyMembers::Present;
Original file line number Diff line number Diff line change @@ -716,6 +716,7 @@ DeclRange IterableDeclContext::getMembers() const {
716
716
void IterableDeclContext::addMember (Decl *member, Decl *Hint) {
717
717
// Add the member to the list of declarations without notification.
718
718
addMemberSilently (member, Hint);
719
+ ++memberCount;
719
720
720
721
// Notify our parent declaration that we have added the member, which can
721
722
// be used to update the lookup tables.
You can’t perform that action at this time.
0 commit comments