libabigail
Classes | Public Member Functions | Protected Member Functions | Friends | List of all members
scope_diff Class Reference

An abstractions of the changes between two scopes. More...

#include <abg-comparison.h>

Inheritance diagram for scope_diff:
[legend]

Classes

struct  priv
 

Public Member Functions

const string_decl_base_sptr_mapadded_decls () const
 
const string_decl_base_sptr_mapadded_types () const
 
virtual void chain_into_hierarchy ()
 Populate the vector of children node of the diff base type sub-object of this instance of scope_diff. More...
 
const diff_sptrs_typechanged_decls () const
 
const diff_sptrs_typechanged_types () const
 
const decl_base_sptr deleted_member_at (unsigned index) const
 Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member that is reported (in the edit script) as deleted at a given index. More...
 
const decl_base_sptr deleted_member_at (vector< deletion >::const_iterator) const
 Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member (of the first scope of this diff instance) that is reported (in the edit script) as deleted at a given iterator. More...
 
const scope_decl_sptr first_scope () const
 Getter for the first scope of the diff. More...
 
virtual const string & get_pretty_representation () const
 
virtual bool has_changes () const
 Return true iff the current diff node carries a change. More...
 
virtual enum change_kind has_local_changes () const
 
const decl_base_sptr inserted_member_at (unsigned i)
 Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member (of the second scope of this diff instance) that is reported as being inserted from a given index. More...
 
const decl_base_sptr inserted_member_at (vector< unsigned >::const_iterator i)
 Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member (of the second scope of this diff instance) that is reported as being inserted from a given iterator. More...
 
edit_scriptmember_changes ()
 Accessor of the edit script of the members of a scope. More...
 
const edit_scriptmember_changes () const
 Accessor of the edit script of the members of a scope. More...
 
const string_decl_base_sptr_mapremoved_decls () const
 
const string_decl_base_sptr_mapremoved_types () const
 
virtual void report (ostream &out, const string &indent="") const
 Report the changes of one scope against another. More...
 
const scope_decl_sptr second_scope () const
 Getter for the second scope of the diff. More...
 
- Public Member Functions inherited from diff
diff_category add_to_category (diff_category c)
 Adds the current diff tree node to an additional set of categories. Note that the categories include thoses inherited from the children nodes of this diff node. More...
 
void add_to_local_and_inherited_categories (diff_category c)
 Adds the current diff tree node to the categories resulting from the local and inherited changes of the current diff node. More...
 
diff_category add_to_local_category (diff_category c)
 Adds the current diff tree node to the categories resulting from the local changes of the current diff node. More...
 
void append_child_node (diff_sptr)
 Add a new child node to the vector of children nodes for the current diff node. More...
 
const vector< diff * > & children_nodes () const
 Getter for the children nodes of the current diff node. More...
 
const diff_context_sptr context () const
 Getter of the context of the current diff. More...
 
void context (diff_context_sptr c)
 Setter of the context of the current diff. More...
 
bool currently_reporting () const
 Tests if we are currently in the middle of emitting a report for this diff. More...
 
void currently_reporting (bool f) const
 Sets a flag saying if we are currently in the middle of emitting a report for this diff. More...
 
type_or_decl_base_sptr first_subject () const
 Getter of the first subject of the diff. More...
 
diffget_canonical_diff () const
 Getter for the canonical diff of the current instance of diff. More...
 
diff_category get_category () const
 Getter for the category of the current diff tree node. More...
 
diff_category get_class_of_equiv_category () const
 Getter of the category of the class of equivalence of the current diff tree node. More...
 
diff_category get_local_category () const
 Getter for the local category of the current diff tree node. More...
 
bool has_descendant_allowed_by_specific_negated_suppression () const
 Test if the current diff node has a descendant node which is specifically allowed by a negated suppression specification. More...
 
bool has_local_changes_to_be_reported () const
 Test if this diff tree node should be reported when considering the categories that were *NOT* inherited from its children nodes. More...
 
bool has_parent_allowed_by_specific_negated_suppression () const
 Test if the current diff node has a parent node which is specifically allowed by a negated suppression specification. More...
 
bool is_allowed_by_specific_negated_suppression () const
 Test if this diff node is allowed (prevented from being suppressed) by at least one negated suppression specification. More...
 
bool is_filtered_out () const
 Test if this diff tree node is to be filtered out for reporting purposes. More...
 
bool is_filtered_out_without_looking_at_allowed_changes () const
 Test if this diff tree node is to be filtered out for reporting purposes, but without considering the categories that can /force/ the node to be unfiltered. More...
 
bool is_filtered_out_wrt_non_inherited_categories () const
 Test if this diff tree node is to be filtered out for reporting purposes, but by considering only the categories that were *NOT* inherited from its children nodes. More...
 
bool is_suppressed () const
 Test if the current diff node has been suppressed by a user-provided suppression specification. More...
 
bool is_suppressed (bool &is_private_type) const
 Test if the current diff node has been suppressed by a user-provided suppression specification or by an auto-generated "private type" suppression specification. More...
 
bool is_traversing () const
 Tell if a given node is being traversed or not. More...
 
const diffparent_node () const
 Getter for the parent node of the current diff node. More...
 
diff_category remove_from_category (diff_category c)
 Remove the current diff tree node from an a existing sef of categories. The categories include those inherited from the children nodes of the current diff node. More...
 
diff_category remove_from_local_category (diff_category c)
 Remove the current diff tree node from the categories resulting from the local changes. More...
 
bool reported_once () const
 Tests if a report has already been emitted for the current diff. More...
 
void reported_once (bool f) const
 Sets a flag saying if a report has already been emitted for the current diff. More...
 
type_or_decl_base_sptr second_subject () const
 Getter of the second subject of the diff. More...
 
void set_category (diff_category c)
 Set the category of the current diff node. This category includes the categories inherited from the children nodes of the current diff node. More...
 
void set_local_category (diff_category c)
 Set the local category of the current diff node. More...
 
bool to_be_reported () const
 Test if this diff tree node should be reported. More...
 
virtual bool traverse (diff_node_visitor &v)
 The generic traversing code that walks a given diff sub-tree. More...
 
- Public Member Functions inherited from traversable_base
virtual ~traversable_base ()
 Destructor of the traversable_base type. More...
 

Protected Member Functions

 scope_diff (scope_decl_sptr first_scope, scope_decl_sptr second_scope, diff_context_sptr ctxt=diff_context_sptr())
 Constructor for scope_diff. More...
 
- Protected Member Functions inherited from diff
 diff (type_or_decl_base_sptr first_subject, type_or_decl_base_sptr second_subject)
 Constructor for the diff type. More...
 
 diff (type_or_decl_base_sptr first_subject, type_or_decl_base_sptr second_subject, diff_context_sptr ctxt)
 Constructor for the diff type. More...
 
void begin_traversing ()
 Flag a given diff node as being traversed. More...
 
bool do_log () const
 Test if logging was requested. More...
 
void do_log (bool)
 Request logging (or not) More...
 
void end_traversing ()
 Flag a given diff node as not being traversed anymore. More...
 
virtual void finish_diff_type ()
 Finish the insertion of a diff tree node into the diff graph. More...
 
void set_canonical_diff (diff *)
 Setter for the canonical diff of the current instance of diff. More...
 
- Protected Member Functions inherited from traversable_base
 traversable_base ()
 Default constructor of the traversable_base type. More...
 
bool visiting () const
 This should returns false before and after the node has been visiting. During the visiting of the node (and of its children) this should return true. More...
 
void visiting (bool f)
 The traversing code should be responsible of calling this, not the user code. More...
 

Friends

scope_diff_sptr compute_diff (const scope_decl_sptr first, const scope_decl_sptr second, scope_diff_sptr d, diff_context_sptr ctxt)
 Compute the diff between two scopes. More...
 
scope_diff_sptr compute_diff (const scope_decl_sptr first_scope, const scope_decl_sptr second_scope, diff_context_sptr ctxt)
 Compute the diff between two scopes. More...
 
class default_reporter
 
class leaf_reporter
 

Additional Inherited Members

- Protected Attributes inherited from diff
std::unique_ptr< priv > priv_
 

Detailed Description

An abstractions of the changes between two scopes.

Definition at line 2024 of file abg-comparison.h.

Constructor & Destructor Documentation

◆ scope_diff()

scope_diff ( scope_decl_sptr  first_scope,
scope_decl_sptr  second_scope,
diff_context_sptr  ctxt = diff_context_sptr() 
)
protected

Constructor for scope_diff.

Parameters
first_scopethe first scope to consider for the diff.
second_scopethe second scope to consider for the diff.
ctxtthe diff context to use. Note that this context object must stay alive at least during the life time of the current instance of scope_diff. Otherwise memory corruption issues occur.

Definition at line 6998 of file abg-comparison.cc.

Member Function Documentation

◆ chain_into_hierarchy()

void chain_into_hierarchy ( )
virtual

Populate the vector of children node of the diff base type sub-object of this instance of scope_diff.

The children node can then later be retrieved using diff::children_node().

Reimplemented from diff.

Definition at line 6973 of file abg-comparison.cc.

◆ changed_decls()

const diff_sptrs_type & changed_decls ( ) const
Returns
a sorted vector of the decls which content has changed from the first scope to the other.

Definition at line 7133 of file abg-comparison.cc.

◆ changed_types()

const diff_sptrs_type & changed_types ( ) const
Returns
a sorted vector of the types which content has changed from the first scope to the other.

Definition at line 7127 of file abg-comparison.cc.

◆ deleted_member_at() [1/2]

const decl_base_sptr deleted_member_at ( unsigned  i) const

Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member that is reported (in the edit script) as deleted at a given index.

Parameters
ithe index (in the edit script) of an element of the first scope that has been reported as being delete.
Returns
the scope member that has been reported by the edit script as being deleted at index i.

Definition at line 7073 of file abg-comparison.cc.

◆ deleted_member_at() [2/2]

const decl_base_sptr deleted_member_at ( vector< deletion >::const_iterator  i) const

Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member (of the first scope of this diff instance) that is reported (in the edit script) as deleted at a given iterator.

Parameters
ithe iterator of an element of the first scope that has been reported as being delete.
Returns
the scope member of the first scope of this diff that has been reported by the edit script as being deleted at iterator i.

Definition at line 7090 of file abg-comparison.cc.

◆ first_scope()

const scope_decl_sptr first_scope ( ) const

Getter for the first scope of the diff.

Returns
the first scope of the diff.

Definition at line 7009 of file abg-comparison.cc.

◆ get_pretty_representation()

const string & get_pretty_representation ( ) const
virtual
Returns
the pretty representation for the current instance of scope_diff.

Reimplemented from diff.

Definition at line 7155 of file abg-comparison.cc.

◆ has_changes()

bool has_changes ( ) const
virtual

Return true iff the current diff node carries a change.

Return true iff the current diff node carries a change.

Implements diff.

Reimplemented in translation_unit_diff.

Definition at line 7174 of file abg-comparison.cc.

◆ has_local_changes()

enum change_kind has_local_changes ( ) const
virtual
Returns
the kind of local change carried by the current diff node. The value returned is zero if the current node carries no local change.

Implements diff.

Reimplemented in translation_unit_diff.

Definition at line 7174 of file abg-comparison.cc.

◆ inserted_member_at() [1/2]

const decl_base_sptr inserted_member_at ( unsigned  i)

Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member (of the second scope of this diff instance) that is reported as being inserted from a given index.

Parameters
ithe index of an element of the second scope this diff that has been reported by the edit script as being inserted.
Returns
the scope member of the second scope of this diff that has been reported as being inserted from index i.

Definition at line 7104 of file abg-comparison.cc.

◆ inserted_member_at() [2/2]

const decl_base_sptr inserted_member_at ( vector< unsigned >::const_iterator  i)

Accessor that eases the manipulation of the edit script associated to this instance. It returns the scope member (of the second scope of this diff instance) that is reported as being inserted from a given iterator.

Parameters
ithe iterator of an element of the second scope this diff that has been reported by the edit script as being inserted.
Returns
the scope member of the second scope of this diff that has been reported as being inserted from iterator i.

Definition at line 7121 of file abg-comparison.cc.

◆ member_changes() [1/2]

edit_script & member_changes ( )

Accessor of the edit script of the members of a scope.

This edit script is computed using the equality operator that applies to shared_ptr<decl_base>.

That has interesting consequences. For instance, consider two scopes S0 and S1. S0 contains a class C0 and S1 contains a class S0'. C0 and C0' have the same qualified name, but have different members. The edit script will consider that C0 has been deleted from S0 and that S0' has been inserted. This is a low level canonical representation of the changes; a higher level representation would give us a simpler way to say "the class C0 has been modified into C0'". But worry not. We do have such higher representation as well; that is what changed_types() and changed_decls() is for.

Returns
the edit script of the changes encapsulatd in this instance of scope_diff.

Definition at line 7060 of file abg-comparison.cc.

◆ member_changes() [2/2]

const edit_script & member_changes ( ) const

Accessor of the edit script of the members of a scope.

This edit script is computed using the equality operator that applies to shared_ptr<decl_base>.

That has interesting consequences. For instance, consider two scopes S0 and S1. S0 contains a class C0 and S1 contains a class S0'. C0 and C0' have the same qualified name, but have different members. The edit script will consider that C0 has been deleted from S0 and that S0' has been inserted. This is a low level canonical representation of the changes; a higher level representation would give us a simpler way to say "the class C0 has been modified into C0'". But worry not. We do have such higher representation as well; that is what changed_types() and changed_decls() is for.

Returns
the edit script of the changes encapsulatd in this instance of scope_diff.

Definition at line 7038 of file abg-comparison.cc.

◆ report()

void report ( ostream &  out,
const string &  indent = "" 
) const
virtual

Report the changes of one scope against another.

Parameters
outthe out stream to report the changes to.
indentthe string to use for indentation.

Implements diff.

Reimplemented in translation_unit_diff.

Definition at line 7198 of file abg-comparison.cc.

◆ second_scope()

const scope_decl_sptr second_scope ( ) const

Getter for the second scope of the diff.

Returns
the second scope of the diff.

Definition at line 7016 of file abg-comparison.cc.

Friends And Related Function Documentation

◆ compute_diff [1/2]

scope_diff_sptr compute_diff ( const scope_decl_sptr  first,
const scope_decl_sptr  second,
scope_diff_sptr  d,
diff_context_sptr  ctxt 
)
friend

Compute the diff between two scopes.

Note that the two decls must have been created in the same environment, otherwise, this function aborts.

Parameters
firstthe first scope to consider in computing the diff.
secondthe second scope to consider in the diff computation. The second scope is diffed against the first scope.
da pointer to the diff object to populate with the computed diff.
Returns
return the populated d parameter passed to this function.
Parameters
ctxtthe diff context to use.

Definition at line 7221 of file abg-comparison.cc.

◆ compute_diff [2/2]

scope_diff_sptr compute_diff ( const scope_decl_sptr  first_scope,
const scope_decl_sptr  second_scope,
diff_context_sptr  ctxt 
)
friend

Compute the diff between two scopes.

Note that the two decls must have been created in the same environment, otherwise, this function aborts.

Parameters
first_scopethe first scope to consider in computing the diff.
second_scopethe second scope to consider in the diff computation. The second scope is diffed against the first scope.
ctxtthe diff context to use.
Returns
return the resulting diff

Definition at line 7254 of file abg-comparison.cc.


The documentation for this class was generated from the following files: