diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 4b8982d2..eb607a58 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -286,6 +286,19 @@ decl_base_hash::operator()(const decl_base& d) const // +/// Add a member decl to this scope. Note that user code should not +/// use this, but rather use #add_decl_to_scope. +/// +/// \param member the new member decl to add to this scope. +void +scope_decl::add_member_decl(const shared_ptr member) +{ + m_members.push_back(member); + + if (shared_ptr m = dynamic_pointer_cast(member)) + m_member_scopes.push_back(m); +} + /// Return true iff both scopes have the same names and have the same /// member decls. /// diff --git a/src/abg-ir.h b/src/abg-ir.h index 92b7febe..511667af 100644 --- a/src/abg-ir.h +++ b/src/abg-ir.h @@ -282,13 +282,9 @@ class scope_decl : public virtual decl_base { scope_decl(); - /// Add a member decl to this scope. Note that user code should not - /// use this, but rather use #add_decl_to_scope. - /// - /// \param member the new member decl to add to this scope. + void - add_member_decl(const shared_ptr member) - {m_members.push_back(member);} + add_member_decl(const shared_ptr); public: scope_decl(const std::string& name, @@ -309,6 +305,10 @@ public: get_member_decls() const {return m_members;} + const std::list >& + get_member_scopes() const + {return m_member_scopes;} + bool is_empty() const {return get_member_decls().empty();} @@ -321,6 +321,7 @@ public: private: std::list > m_members; + std::list > m_member_scopes; };// end class scope_decl. /// \brief Facility to hash instances of decl_base.