mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-17 23:44:35 +00:00
Ensure add_decl_to_scope properly updates the scope
* src/abg-ir.h (scope_decl::m_member_scopes) (scope_decl::get_member_scopes): New declarations. (scope_decl::add_member_decl): Move this to ... * src/abg-ir.cc (scope_decl::add_member_decl): ... here. Make it update the new scope_decl::m_member_scopes too.
This commit is contained in:
parent
750b14c159
commit
0d0726b1ed
@ -286,6 +286,19 @@ decl_base_hash::operator()(const decl_base& d) const
|
||||
|
||||
// </Decl definition>
|
||||
|
||||
/// 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<decl_base> member)
|
||||
{
|
||||
m_members.push_back(member);
|
||||
|
||||
if (shared_ptr<scope_decl> m = dynamic_pointer_cast<scope_decl>(member))
|
||||
m_member_scopes.push_back(m);
|
||||
}
|
||||
|
||||
/// Return true iff both scopes have the same names and have the same
|
||||
/// member decls.
|
||||
///
|
||||
|
13
src/abg-ir.h
13
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<decl_base> member)
|
||||
{m_members.push_back(member);}
|
||||
add_member_decl(const shared_ptr<decl_base>);
|
||||
|
||||
public:
|
||||
scope_decl(const std::string& name,
|
||||
@ -309,6 +305,10 @@ public:
|
||||
get_member_decls() const
|
||||
{return m_members;}
|
||||
|
||||
const std::list<shared_ptr<scope_decl> >&
|
||||
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<shared_ptr<decl_base> > m_members;
|
||||
std::list<shared_ptr<scope_decl> > m_member_scopes;
|
||||
};// end class scope_decl.
|
||||
|
||||
/// \brief Facility to hash instances of decl_base.
|
||||
|
Loading…
Reference in New Issue
Block a user