[PATCH 1/2] corpus: is_empty: consider actual translation unit contents

Dodji Seketeli dodji@seketeli.org
Wed Jan 1 00:00:00 GMT 2020


Hello Matthias,

Matthias Maennich <maennich@google.com> a écrit:

[...]

> diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc
> index e37c35f5fbbb..bee87ddbb307 100644
> --- a/src/abg-corpus.cc
> +++ b/src/abg-corpus.cc
> @@ -859,7 +859,18 @@ corpus::set_architecture_name(const string& arch)
>  bool
>  corpus::is_empty() const
>  {
> -  return (priv_->members.empty()
> +  bool members_empty = true;
> +  for (translation_units::const_iterator i = priv_->members.begin(),
> +					 e = priv_->members.end();
> +       i != e; ++i)
> +    {
> +      if (!(*i)->is_empty())
> +	{
> +	  members_empty = false;
> +	  break;
> +	}
> +    }
> +  return (members_empty
>  	  && priv_->fun_symbol_map
>  	  && priv_->fun_symbol_map->empty()
>  	  && priv_->var_symbol_map

This change obviously looks good to me.  However, I think it's useful to
update the comment of the corpus::is_empty function to say that the
function tests if the corpus contains no non-empty translation unit.

[...]


> Hence, teach is_empty() to have a look at the actual translation units.
>
> 	* src/abg-corpus.cc (corpus::is_empty): consider a list of
> 	  empty members to be empty.

This is thus OK to commit to master with the the comment update above.

Thanks for working on this!

Cheers,

-- 
		Dodji



More information about the Libabigail mailing list