libabigail
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
type_suppression Class Reference

Abstraction of a type suppression specification. More...

#include <abg-suppression.h>

Inheritance diagram for type_suppression:
[legend]

Classes

class  insertion_range
 The abstraction of a range of offsets in which a member of a type might get inserted. More...
 
class  priv
 The private data for type_suppression. More...
 

Public Types

typedef shared_ptr< insertion_rangeinsertion_range_sptr
 A convenience typedef for a shared pointer to insertion_range. More...
 
typedef vector< insertion_range_sptrinsertion_ranges
 A convenience typedef for a vector of insertion_range_sptr. More...
 
enum  reach_kind { DIRECT_REACH_KIND , POINTER_REACH_KIND , REFERENCE_REACH_KIND , REFERENCE_OR_POINTER_REACH_KIND }
 The different ways through which the type diff has been reached. More...
 
enum  type_kind {
  UNKNOWN_TYPE_KIND , CLASS_TYPE_KIND , STRUCT_TYPE_KIND , UNION_TYPE_KIND ,
  ENUM_TYPE_KIND , ARRAY_TYPE_KIND , TYPEDEF_TYPE_KIND , BUILTIN_TYPE_KIND
}
 The kind of the type the current type suppression is supposed to be about. More...
 

Public Member Functions

 type_suppression (const string &label, const string &type_name_regexp, const string &type_name)
 Constructor for type_suppression. More...
 
const vector< string > & get_changed_enumerator_names () const
 Getter of the vector of the changed enumerators that are supposed to be suppressed. Note that this will be "valid" only if the type suppression has the 'type_kind = enum' property. More...
 
const vector< regex::regex_t_sptr > & get_changed_enumerators_regexp () const
 Getter of the vector of the regular expression strings for changed enumerators that are supposed to be suppressed. Note that this will be "valid" only if the type suppression has the 'type_kind = enum' property. More...
 
bool get_consider_reach_kind () const
 Test if the current type suppression specification suggests to consider how the matching diff node is reached. More...
 
bool get_consider_type_kind () const
 Getter of the property that says whether to consider the kind of type this suppression is about. More...
 
insertion_rangesget_data_member_insertion_ranges ()
 Getter for the vector of data member insertion range that specifiers where a data member is inserted as far as this suppression specification is concerned. More...
 
const insertion_rangesget_data_member_insertion_ranges () const
 Getter for the vector of data member insertion range that specifiers where a data member is inserted as far as this suppression specification is concerned. More...
 
bool get_has_size_change () const
 Getter of the "has_size_change" property. More...
 
const string_set_type & get_potential_data_member_names () const
 Getter of the "potential_data_member_names" property. More...
 
const string & get_potential_data_member_names_regex_str () const
 Getter of the "potential_data_member_names_regex" string. More...
 
reach_kind get_reach_kind () const
 Getter of the way the diff node matching the current suppression specification is to be reached. More...
 
const string & get_source_location_to_keep_regex_str () const
 Getter of the regular expression string that designates the source location paths of types that should not be suppressed. More...
 
unordered_set< string > & get_source_locations_to_keep ()
 Getter for the array of source location paths of types that should *NOT* be suppressed. More...
 
const unordered_set< string > & get_source_locations_to_keep () const
 Getter for the array of source location paths of types that should *NOT* be suppressed. More...
 
type_kind get_type_kind () const
 Getter of the kind of type this suppression is about. More...
 
const string & get_type_name () const
 Getter for the name of the type about which diff reports should be suppressed. More...
 
const string & get_type_name_not_regex_str () const
 Getter for the "type_name_not_regex_str" property of the type suppression specification. More...
 
const string & get_type_name_regex_str () const
 Getter for the "type_name_regex" property of the type suppression specification. More...
 
bool has_strict_fam_conversion () const
 Getter of the "has_string_fam_conversion" property. More...
 
void set_changed_enumerator_names (const vector< string > &)
 Setter of the vector of changed enumerators that are supposed to be suppressed. Note that this will be "valid" only if the type suppression has the 'type_kind = enum' property. More...
 
void set_changed_enumerators_regexp (const vector< regex::regex_t_sptr > &)
 Setter of the vector of the regular expression strings for changed enumerators that are supposed to be suppressed. Note that this will be "valid" only if the type suppression has the 'type_kind = enum' property. More...
 
void set_consider_reach_kind (bool f)
 Set a flag saying if the current type suppression specification suggests to consider how the matching diff node is reached. More...
 
void set_consider_type_kind (bool f)
 Setter of the property that says whether to consider the kind of type this suppression is about. More...
 
void set_data_member_insertion_ranges (const insertion_ranges &r)
 Setter for the vector of data member insertion ranges that specifies where a data member is inserted as far as this suppression specification is concerned. More...
 
void set_has_size_change (bool flag)
 Setter of the "has_size_change" property. More...
 
void set_has_strict_fam_conversion (bool)
 Setter of the "has_string_fam_conversion" property. More...
 
void set_potential_data_member_names (const string_set_type &) const
 Setter of the "potential_data_member_names" property. More...
 
void set_potential_data_member_names_regex_str (const string &) const
 Setter of the "potential_data_member_names_regex" string. More...
 
void set_reach_kind (reach_kind k)
 Setter of the way the diff node matching the current suppression specification is to be reached. More...
 
void set_source_location_to_keep_regex_str (const string &)
 Setter of the regular expression string that designates the source location paths of types that should not be suppressed. More...
 
void set_source_locations_to_keep (const unordered_set< string > &)
 Setter for the array of source location paths of types that should *NOT* be suppressed. More...
 
void set_type_kind (type_kind k)
 Setter of the kind of type this suppression is about. More...
 
void set_type_name (const string &name)
 Setter for the name of the type about which diff reports should be suppressed. More...
 
void set_type_name_not_regex_str (const string &name_regex_str)
 Setter for the "type_name_not_regex_str" property of the type suppression specification. More...
 
void set_type_name_regex_str (const string &name_regex_str)
 Setter for the "type_name_regex" property of the type suppression specification. More...
 
virtual bool suppresses_diff (const diff *diff) const
 Evaluate this suppression specification on a given diff node and say if the diff node should be suppressed or not. More...
 
bool suppresses_type (const type_base_sptr &type) const
 Test if the current instance of type_suppression matches a given type. More...
 
bool suppresses_type (const type_base_sptr &type, const diff_context_sptr &ctxt) const
 Test if the current instance of type_suppression suppresses a change reports about a given type. More...
 
bool suppresses_type (const type_base_sptr &type, const scope_decl *type_scope) const
 Test if the current instance of type_suppression matches a given type in a given scope. More...
 
- Public Member Functions inherited from suppression_base
 suppression_base (const string &label)
 Constructor for suppression_base. More...
 
 suppression_base (const string &label, const string &file_name_regex_str, const string &file_name_not_regex_str)
 Constructor for suppression_base. More...
 
bool get_drops_artifact_from_ir () const
 Tests if the current suppression specification is to avoid adding the matched ABI artifact to the internal representation or not. More...
 
const string & get_file_name_not_regex_str () const
 Getter for the "file_name_not_regex" property of the current instance of suppression_base. More...
 
const string & get_file_name_regex_str () const
 Getter for the "file_name_regex" property of the current instance of suppression_base. More...
 
bool get_is_artificial () const
 Test is the suppression specification is artificial. More...
 
const string get_label () const
 Getter for the label associated to this suppression specification. More...
 
const string & get_soname_not_regex_str () const
 Getter of the "soname_not_regex_str property of the current instance of suppression_base. More...
 
const string & get_soname_regex_str () const
 Getter of the "soname_regex_str property of the current instance of suppression_base. More...
 
bool has_file_name_related_property () const
 Test if the current suppression has a property related to file name. More...
 
bool has_soname_related_property () const
 Test if the current suppression has a property related to SONAMEs. More...
 
void set_drops_artifact_from_ir (bool)
 Set the flag that says whether the current suppression specification is to avoid adding the matched ABI artifact to the internal representation or not. More...
 
void set_file_name_not_regex_str (const string &regexp)
 Setter for the "file_name_not_regex" property of the current instance of suppression_base. More...
 
void set_file_name_regex_str (const string &regexp)
 Setter for the "file_name_regex" property of the current instance of suppression_base. More...
 
void set_is_artificial (bool)
 Set a flag saying if the suppression specification is artificial or not. More...
 
void set_label (const string &)
 Setter for the label associated to this suppression specification. More...
 
void set_soname_not_regex_str (const string &regexp)
 Setter of the "soname_not_regex_str property of the current instance of suppression_base. More...
 
void set_soname_regex_str (const string &regexp)
 Setter of the "soname_regex_str property of the current instance of suppression_base. More...
 

Public Attributes

std::unique_ptr< privpriv_
 
- Public Attributes inherited from suppression_base
std::unique_ptr< privpriv_
 

Detailed Description

Abstraction of a type suppression specification.

Specifies under which condition reports about a type diff node should be dropped on the floor.

Definition at line 186 of file abg-suppression.h.

Member Typedef Documentation

◆ insertion_range_sptr

A convenience typedef for a shared pointer to insertion_range.

Definition at line 233 of file abg-suppression.h.

◆ insertion_ranges

A convenience typedef for a vector of insertion_range_sptr.

Definition at line 235 of file abg-suppression.h.

Member Enumeration Documentation

◆ reach_kind

enum reach_kind

The different ways through which the type diff has been reached.

Enumerator
DIRECT_REACH_KIND 

The type diff has been reached (from a function or variable change) directly.

POINTER_REACH_KIND 

The type diff has been reached (from a function or variable change) through a pointer.

REFERENCE_REACH_KIND 

The type diff has been reached (from a function or variable change) through a reference; you know, like a c++ reference..

REFERENCE_OR_POINTER_REACH_KIND 

The type diff has been reached (from a function or variable change) through either a reference or a pointer.

Definition at line 211 of file abg-suppression.h.

◆ type_kind

enum type_kind

The kind of the type the current type suppression is supposed to be about.

Definition at line 198 of file abg-suppression.h.

Constructor & Destructor Documentation

◆ type_suppression()

type_suppression ( const string &  label,
const string &  type_name_regexp,
const string &  type_name 
)

Constructor for type_suppression.

Parameters
labelthe label of the suppression. This is just a free form comment explaining what the suppression is about.
type_name_regexpthe regular expression describing the types about which diff reports should be suppressed. If it's an empty string, the parameter is ignored.
type_namethe name of the type about which diff reports should be suppressed. If it's an empty string, the parameter is ignored.

Note that parameter type_name_regexp and type_name_regexp should not necessarily be populated. It usually is either one or the other that the user wants.

Definition at line 503 of file abg-suppression.cc.

Member Function Documentation

◆ get_changed_enumerator_names()

const vector< string > & get_changed_enumerator_names ( ) const

Getter of the vector of the changed enumerators that are supposed to be suppressed. Note that this will be "valid" only if the type suppression has the 'type_kind = enum' property.

Returns
the vector of the changed enumerators that are supposed to be suppressed.

Definition at line 776 of file abg-suppression.cc.

◆ get_changed_enumerators_regexp()

const vector< regex::regex_t_sptr > & get_changed_enumerators_regexp ( ) const

Getter of the vector of the regular expression strings for changed enumerators that are supposed to be suppressed. Note that this will be "valid" only if the type suppression has the 'type_kind = enum' property.

Returns
the vector of the regular expression strings that are supposed to match enumertor names to be suppressed.

Definition at line 797 of file abg-suppression.cc.

◆ get_consider_reach_kind()

bool get_consider_reach_kind ( ) const

Test if the current type suppression specification suggests to consider how the matching diff node is reached.

Returns
true if the current type suppression specification suggests to consider how the matching diff node is reached.

Definition at line 622 of file abg-suppression.cc.

◆ get_consider_type_kind()

bool get_consider_type_kind ( ) const

Getter of the property that says whether to consider the kind of type this suppression is about.

Returns
the boolean value of the property.

Definition at line 583 of file abg-suppression.cc.

◆ get_data_member_insertion_ranges() [1/2]

type_suppression::insertion_ranges & get_data_member_insertion_ranges ( )

Getter for the vector of data member insertion range that specifiers where a data member is inserted as far as this suppression specification is concerned.

Returns
the vector of insertion ranges.

Definition at line 723 of file abg-suppression.cc.

◆ get_data_member_insertion_ranges() [2/2]

const type_suppression::insertion_ranges & get_data_member_insertion_ranges ( ) const

Getter for the vector of data member insertion range that specifiers where a data member is inserted as far as this suppression specification is concerned.

Returns
the vector of insertion ranges.

Definition at line 714 of file abg-suppression.cc.

◆ get_has_size_change()

bool get_has_size_change ( ) const

Getter of the "has_size_change" property.

Returns
the value of the "has_size_change" property.

Definition at line 657 of file abg-suppression.cc.

◆ get_potential_data_member_names()

const unordered_set< string > & get_potential_data_member_names ( ) const

Getter of the "potential_data_member_names" property.

Returns
the set of potential data member names of this suppression.

Definition at line 672 of file abg-suppression.cc.

◆ get_potential_data_member_names_regex_str()

const string & get_potential_data_member_names_regex_str ( ) const

Getter of the "potential_data_member_names_regex" string.

Returns
the "potential_data_member_names_regex" string.

Definition at line 688 of file abg-suppression.cc.

◆ get_reach_kind()

type_suppression::reach_kind get_reach_kind ( ) const

Getter of the way the diff node matching the current suppression specification is to be reached.

Returns
the way the diff node matching the current suppression specification is to be reached.

Definition at line 641 of file abg-suppression.cc.

◆ get_source_location_to_keep_regex_str()

const string & get_source_location_to_keep_regex_str ( ) const

Getter of the regular expression string that designates the source location paths of types that should not be suppressed.

Returns
the regular expression string.

Definition at line 758 of file abg-suppression.cc.

◆ get_source_locations_to_keep() [1/2]

unordered_set< string > & get_source_locations_to_keep ( )

Getter for the array of source location paths of types that should *NOT* be suppressed.

Returns
the array of source locations of types that should *NOT* be supressed.

Definition at line 741 of file abg-suppression.cc.

◆ get_source_locations_to_keep() [2/2]

const unordered_set< string > & get_source_locations_to_keep ( ) const

Getter for the array of source location paths of types that should *NOT* be suppressed.

Returns
the set of source locations of types that should *NOT* be supressed.

Definition at line 732 of file abg-suppression.cc.

◆ get_type_kind()

type_suppression::type_kind get_type_kind ( ) const

Getter of the kind of type this suppression is about.

Note that this will be considered during evaluation of the suppression only if type_suppression::get_consider_type_kind() returns true.

Returns
the kind of type this suppression is about.

Definition at line 613 of file abg-suppression.cc.

◆ get_type_name()

const string & get_type_name ( ) const

Getter for the name of the type about which diff reports should be suppressed.

Parameters
returnthe type name.

Definition at line 575 of file abg-suppression.cc.

◆ get_type_name_not_regex_str()

const string & get_type_name_not_regex_str ( ) const

Getter for the "type_name_not_regex_str" property of the type suppression specification.

This returns a regular expression string that specifies the family of types that should be kept after suppression.

Returns
the new regexp string.

Definition at line 559 of file abg-suppression.cc.

◆ get_type_name_regex_str()

const string & get_type_name_regex_str ( ) const

Getter for the "type_name_regex" property of the type suppression specification.

This returns a regular expression string that specifies the family of types about which diff reports should be suppressed.

Returns
the regular expression string.

Definition at line 537 of file abg-suppression.cc.

◆ has_strict_fam_conversion()

bool has_strict_fam_conversion ( ) const

Getter of the "has_string_fam_conversion" property.

Returns
the value of the "has_string_fam_conversion" property.

Definition at line 815 of file abg-suppression.cc.

◆ set_changed_enumerator_names()

void set_changed_enumerator_names ( const vector< string > &  n)

Setter of the vector of changed enumerators that are supposed to be suppressed. Note that this will be "valid" only if the type suppression has the 'type_kind = enum' property.

Parameters
nthe vector of the changed enumerators that are supposed to be suppressed.

Definition at line 786 of file abg-suppression.cc.

◆ set_changed_enumerators_regexp()

void set_changed_enumerators_regexp ( const vector< regex::regex_t_sptr > &  n)

Setter of the vector of the regular expression strings for changed enumerators that are supposed to be suppressed. Note that this will be "valid" only if the type suppression has the 'type_kind = enum' property.

Parameters
nthe vector of the regular expression strings that are supposed to match enumertor names to be suppressed.

Definition at line 808 of file abg-suppression.cc.

◆ set_consider_reach_kind()

void set_consider_reach_kind ( bool  f)

Set a flag saying if the current type suppression specification suggests to consider how the matching diff node is reached.

Parameters
fthe new value of the flag. It's true iff the current type suppression specification suggests to consider how the matching diff node is reached.

Definition at line 632 of file abg-suppression.cc.

◆ set_consider_type_kind()

void set_consider_type_kind ( bool  f)

Setter of the property that says whether to consider the kind of type this suppression is about.

Parameters
fthe new boolean value of the property.

Definition at line 591 of file abg-suppression.cc.

◆ set_data_member_insertion_ranges()

void set_data_member_insertion_ranges ( const insertion_ranges r)

Setter for the vector of data member insertion ranges that specifies where a data member is inserted as far as this suppression specification is concerned.

Parameters
rthe new insertion range vector.

Definition at line 705 of file abg-suppression.cc.

◆ set_has_size_change()

void set_has_size_change ( bool  flag)

Setter of the "has_size_change" property.

Parameters
flagthe new value of the "has_size_change" property.

Definition at line 664 of file abg-suppression.cc.

◆ set_has_strict_fam_conversion()

void set_has_strict_fam_conversion ( bool  f)

Setter of the "has_string_fam_conversion" property.

Parameters
fthe new value of the "has_string_fam_conversion" property.

Definition at line 823 of file abg-suppression.cc.

◆ set_potential_data_member_names()

void set_potential_data_member_names ( const string_set_type &  s) const

Setter of the "potential_data_member_names" property.

Parameters
sthe new set of potential data member names of this suppression.

Definition at line 680 of file abg-suppression.cc.

◆ set_potential_data_member_names_regex_str()

void set_potential_data_member_names_regex_str ( const string &  d) const

Setter of the "potential_data_member_names_regex" string.

Parameters
dthe new "potential_data_member_names_regex" string.

Definition at line 695 of file abg-suppression.cc.

◆ set_reach_kind()

void set_reach_kind ( reach_kind  k)

Setter of the way the diff node matching the current suppression specification is to be reached.

Parameters
pthe way the diff node matching the current suppression specification is to be reached.

Definition at line 650 of file abg-suppression.cc.

◆ set_source_location_to_keep_regex_str()

void set_source_location_to_keep_regex_str ( const string &  r)

Setter of the regular expression string that designates the source location paths of types that should not be suppressed.

Parameters
rthe new regular expression.

Definition at line 766 of file abg-suppression.cc.

◆ set_source_locations_to_keep()

void set_source_locations_to_keep ( const unordered_set< string > &  l)

Setter for the array of source location paths of types that should *NOT* be suppressed.

Parameters
lthe new array.

Definition at line 749 of file abg-suppression.cc.

◆ set_type_kind()

void set_type_kind ( type_kind  k)

Setter of the kind of type this suppression is about.

Note that this will be considered during evaluation of the suppression only if type_suppression::get_consider_type_kind() returns true.

Parameters
kthe new kind of type this suppression is about.

Definition at line 602 of file abg-suppression.cc.

◆ set_type_name()

void set_type_name ( const string &  name)

Setter for the name of the type about which diff reports should be suppressed.

Parameters
namethe new type name.

Definition at line 567 of file abg-suppression.cc.

◆ set_type_name_not_regex_str()

void set_type_name_not_regex_str ( const string &  r)

Setter for the "type_name_not_regex_str" property of the type suppression specification.

This returns a regular expression string that specifies the family of types that should be kept after suppression.

Parameters
rthe new regexp string.

Definition at line 548 of file abg-suppression.cc.

◆ set_type_name_regex_str()

void set_type_name_regex_str ( const string &  name_regex_str)

Setter for the "type_name_regex" property of the type suppression specification.

This sets a regular expression that specifies the family of types about which diff reports should be suppressed.

Parameters
name_regex_strthe new regular expression to set.

Definition at line 526 of file abg-suppression.cc.

◆ suppresses_diff()

bool suppresses_diff ( const diff diff) const
virtual

Evaluate this suppression specification on a given diff node and say if the diff node should be suppressed or not.

Parameters
diffthe diff node to evaluate this suppression specification against.
Returns
true if diff should be suppressed.

Implements suppression_base.

Reimplemented in negated_type_suppression.

Definition at line 834 of file abg-suppression.cc.

◆ suppresses_type() [1/3]

bool suppresses_type ( const type_base_sptr &  type) const

Test if the current instance of type_suppression matches a given type.

Parameters
typethe type to consider.
Returns
true iff the suppression specification suppresses type type.

Definition at line 1398 of file abg-suppression.cc.

◆ suppresses_type() [2/3]

bool suppresses_type ( const type_base_sptr &  type,
const diff_context_sptr &  ctxt 
) const

Test if the current instance of type_suppression suppresses a change reports about a given type.

Parameters
typethe type to consider.
ctxtthe context of comparison we are involved with.
Returns
true iff the suppression specification suppresses type type.

Definition at line 1119 of file abg-suppression.cc.

◆ suppresses_type() [3/3]

bool suppresses_type ( const type_base_sptr &  type,
const scope_decl type_scope 
) const

Test if the current instance of type_suppression matches a given type in a given scope.

Parameters
typethe type to consider.
type_scopethe scope of type type.
Returns
true iff the suppression specification suppresses type type from scope type_scope.

Definition at line 1419 of file abg-suppression.cc.


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