libabigail
Loading...
Searching...
No Matches
class_decl Class Reference

Abstracts a class declaration. More...

#include <abg-ir.h>

Inheritance diagram for class_decl:
[legend]

Classes

class  base_spec
 Abstraction of a base specifier in a class declaration. More...
 
struct  hash
 Hasher for the class_decl type. More...
 

Public Types

typedef shared_ptr< base_specbase_spec_sptr
 Convenience typedef.
 
typedef vector< base_spec_sptrbase_specs
 Convenience typedef.
 
- Public Types inherited from class_or_union
typedef vector< type_base_sptr > member_types
 Convenience typedef.
 
typedef vector< var_decl_sptrdata_members
 Convenience typedef.
 
typedef vector< method_decl_sptr > member_functions
 Convenience typedef.
 
typedef unordered_map< ssize_t, member_functionsvirtual_mem_fn_map_type
 Convenience typedef.
 
typedef unordered_map< string, method_decl * > string_mem_fn_ptr_map_type
 Convenience typedef.
 
typedef unordered_map< string, method_decl_sptr > string_mem_fn_sptr_map_type
 Convenience typedef.
 
- Public Types inherited from scope_decl
typedef std::vector< decl_base_sptr > declarations
 Convenience typedef for a vector of decl_base_sptr.
 
typedef std::vector< function_type_sptrfunction_types
 Convenience typedef for a vector of function_type_sptr.
 
typedef std::vector< scope_decl_sptrscopes
 Convenience typedef for a vector of scope_decl_sptr.
 
- Public Types inherited from decl_base
enum  binding { BINDING_NONE , BINDING_LOCAL , BINDING_GLOBAL , BINDING_WEAK }
 ELF binding. More...
 
enum  visibility {
  VISIBILITY_NONE , VISIBILITY_DEFAULT , VISIBILITY_PROTECTED , VISIBILITY_HIDDEN ,
  VISIBILITY_INTERNAL
}
 ELF visibility. More...
 
- Public Types inherited from type_or_decl_base
enum  type_or_decl_kind {
  ABSTRACT_TYPE_OR_DECL , ABSTRACT_DECL_BASE , ABSTRACT_SCOPE_DECL , GLOBAL_SCOPE_DECL ,
  NAMESPACE_DECL , VAR_DECL , FUNCTION_DECL , FUNCTION_PARAMETER_DECL ,
  METHOD_DECL , TEMPLATE_DECL , ABSTRACT_TYPE_BASE , ABSTRACT_SCOPE_TYPE_DECL ,
  BASIC_TYPE , SUBRANGE_TYPE , QUALIFIED_TYPE , POINTER_TYPE ,
  REFERENCE_TYPE , POINTER_TO_MEMBER_TYPE , ARRAY_TYPE , ENUM_TYPE ,
  TYPEDEF_TYPE , CLASS_TYPE , UNION_TYPE , FUNCTION_TYPE ,
  METHOD_TYPE
}
 This is a bitmap type which instance is meant to contain the runtime type of a given ABI artifact. Bits of the identifiers of the type of a given artifact as well as the types it inherits from are to be set to 1. More...
 

Public Member Functions

 class_decl (const environment &env, const string &name, bool is_struct, bool is_declaration_only=true)
 A constuctor for instances of class_decl that represent a declaration without definition.
 
 class_decl (const environment &env, const string &name, size_t size_in_bits, size_t align_in_bits, bool is_struct, const location &locus, visibility vis)
 A constructor for instances of class_decl.
 
 class_decl (const environment &env, const string &name, size_t size_in_bits, size_t align_in_bits, bool is_struct, const location &locus, visibility vis, base_specs &bases, member_types &mbrs, data_members &data_mbrs, member_functions &member_fns)
 A Constructor for instances of class_decl.
 
 class_decl (const environment &env, const string &name, size_t size_in_bits, size_t align_in_bits, bool is_struct, const location &locus, visibility vis, base_specs &bases, member_types &mbrs, data_members &data_mbrs, member_functions &member_fns, bool is_anonymous)
 A Constructor for instances of class_decl.
 
 class_decl (const environment &env, const string &name, size_t size_in_bits, size_t align_in_bits, bool is_struct, const location &locus, visibility vis, bool is_anonymous)
 A constructor for instances of class_decl.
 
virtual ~class_decl ()
 Destructor of the class_decl type.
 
void add_base_specifier (shared_ptr< base_spec > b)
 Add a base specifier to this class.
 
class_decl_sptr find_base_class (const string &qualified_name) const
 Find a base class of a given qualified name for the current class.
 
const base_specsget_base_specifiers () const
 Get the base specifiers for this class.
 
ssize_t get_biggest_vtable_offset () const
 Get the highest vtable offset of all the virtual methods of the class.
 
virtual string get_pretty_representation (bool internal=false, bool qualified_name=true) const
 Getter of the pretty representation of the current instance of class_decl.
 
const member_functionsget_virtual_mem_fns () const
 Get the virtual member functions of this class.
 
const virtual_mem_fn_map_typeget_virtual_mem_fns_map () const
 Get the map that associates a virtual table offset to the virtual member functions with that virtual table offset.
 
bool has_no_base_nor_member () const
 Return true iff the class has no entity in its scope.
 
bool has_virtual_bases () const
 Test if the current instance of class_decl has at least one virtual base.
 
bool has_virtual_member_functions () const
 Test if the current instance of class_decl has virtual member functions.
 
bool has_vtable () const
 Test if the current instance has a vtable.
 
virtual hash_t hash_value () const
 Return the hash value of the current IR node.
 
bool is_struct () const
 Test if the class is a struct.
 
void is_struct (bool f)
 Set the "is-struct" flag of the class.
 
virtual bool operator== (const class_decl &) const
 Comparison operator for class_decl.
 
virtual bool operator== (const class_or_union &) const
 Equality operator for class_decl.
 
virtual bool operator== (const decl_base &) const
 Comparison operator for class_decl.
 
virtual bool operator== (const type_base &) const
 Equality operator for class_decl.
 
void sort_virtual_mem_fns ()
 Sort the virtual member functions by their virtual index.
 
virtual bool traverse (ir_node_visitor &v)
 This implements the ir_traversable_base::traverse pure virtual function.
 
- Public Member Functions inherited from class_or_union
 class_or_union (const environment &env, const string &name, bool is_declaration_only=true)
 Constructor of the class_or_union type.
 
 class_or_union (const environment &env, const string &name, size_t size_in_bits, size_t align_in_bits, const location &locus, visibility vis)
 A constructor for instances of class_or_union.
 
 class_or_union (const environment &env, const string &name, size_t size_in_bits, size_t align_in_bits, const location &locus, visibility vis, member_types &mbrs, data_members &data_mbrs, member_functions &member_fns)
 A Constructor for instances of class_or_union.
 
virtual ~class_or_union ()
 Destrcutor of the class_or_union type.
 
void add_data_member (var_decl_sptr v, access_specifier a, bool is_laid_out, bool is_static, size_t offset_in_bits)
 Add a data member to the current instance of class_or_union.
 
void add_member_class_template (member_class_template_sptr m)
 Append a member class template to the class_or_union.
 
void add_member_function (method_decl_sptr f, access_specifier a, bool is_static, bool is_ctor, bool is_dtor, bool is_const)
 Add a member function.
 
void add_member_function (method_decl_sptr f, access_specifier a, bool is_virtual, size_t vtable_offset, bool is_static, bool is_ctor, bool is_dtor, bool is_const)
 Add a member function to the current instance of class_or_union.
 
void add_member_function_template (member_function_template_sptr)
 Append a member function template to the class_or_union.
 
const var_decl_sptr find_anonymous_data_member (const var_decl_sptr &) const
 Find an anonymous data member in the class.
 
const var_decl_sptr find_data_member (const string &) const
 Find a data member of a given name in the current class_or_union.
 
const var_decl_sptr find_data_member (const var_decl_sptr &) const
 Find a given data member.
 
method_declfind_member_function (const string &mangled_name)
 Find a method, using its linkage name as a key.
 
const method_declfind_member_function (const string &mangled_name) const
 Find a method, using its linkage name as a key.
 
method_declfind_member_function_from_signature (const string &s)
 Find a method (member function) using its signature (pretty representation) as a key.
 
const method_declfind_member_function_from_signature (const string &s) const
 Find a method (member function) using its signature (pretty representation) as a key.
 
method_decl_sptr find_member_function_sptr (const string &mangled_name)
 Find a method, using its linkage name as a key.
 
virtual size_t get_alignment_in_bits () const
 Getter of the alignment of the class_or_union type.
 
const data_membersget_data_members () const
 Get the data members of this class_or_union.
 
const member_class_templates & get_member_class_templates () const
 Get the member class templates of this class.
 
const member_function_templates & get_member_function_templates () const
 Get the member function templates of this class.
 
const member_functionsget_member_functions () const
 Get the member functions of this class_or_union.
 
const data_membersget_non_static_data_members () const
 Get the non-static data members of this class_or_union.
 
virtual size_t get_num_anonymous_member_classes () const
 Get the number of anonymous member classes contained in this class.
 
virtual size_t get_num_anonymous_member_enums () const
 Get the number of anonymous member enums contained in this class.
 
virtual size_t get_num_anonymous_member_unions () const
 Get the number of anonymous member unions contained in this class.
 
virtual size_t get_size_in_bits () const
 Getter of the size of the class_or_union type.
 
const data_membersget_static_data_members () const
 Get the static data memebers of this class_or_union.
 
bool has_no_member () const
 
virtual void set_alignment_in_bits (size_t)
 Setter of the alignment of the class type.
 
virtual void set_size_in_bits (size_t)
 Setter of the size of the class_or_union type.
 
- Public Member Functions inherited from scope_type_decl
 scope_type_decl (const environment &env, const string &name, size_t size_in_bits, size_t alignment_in_bits, const location &locus, visibility vis=VISIBILITY_DEFAULT)
 Constructor.
 
- Public Member Functions inherited from scope_decl
 scope_decl (const environment &env, const string &name, const location &locus, visibility vis=VISIBILITY_DEFAULT)
 Constructor of the scope_decl type.
 
 scope_decl (const environment &env, location &l)
 Constructor of the scope_decl type.
 
void add_member_type (type_base_sptr t)
 Add a member type to the current instance of class_or_union.
 
type_base_sptr add_member_type (type_base_sptr t, access_specifier a)
 Add a member type to the current instance of class_or_union.
 
bool find_iterator_for_member (const decl_base *, declarations::iterator &)
 Find a member of the current scope and return an iterator on it.
 
bool find_iterator_for_member (const decl_base_sptr, declarations::iterator &)
 Find a member of the current scope and return an iterator on it.
 
type_base_sptr find_member_type (const string &name) const
 Find a member type of a given name, inside the current scope_decl.
 
canonical_type_sptr_set_typeget_canonical_types ()
 @eturn the set of canonical types of the the current scope.
 
const canonical_type_sptr_set_typeget_canonical_types () const
 @eturn the set of canonical types of the the current scope.
 
declarationsget_member_decls ()
 Getter for the member declarations carried by the current scope_decl.
 
const declarationsget_member_decls () const
 Getter for the member declarations carried by the current scope_decl.
 
scopesget_member_scopes ()
 Getter for the scopes carried by the current scope.
 
const scopesget_member_scopes () const
 Getter for the scopes carried by the current scope.
 
const type_base_sptrs_typeget_member_types () const
 Get the member types of this scope_decl.
 
const type_base_sptrs_typeget_sorted_canonical_types () const
 Return a vector of sorted canonical types of the current scope.
 
const declarationsget_sorted_member_decls () const
 Getter for the sorted member declarations carried by the current scope_decl.
 
const type_base_sptrs_typeget_sorted_member_types () const
 Get the sorted member types of this scope_decl.
 
void insert_member_type (type_base_sptr t, declarations::iterator before)
 Insert a member type.
 
bool is_empty () const
 Test if the current scope is empty.
 
void remove_member_type (type_base_sptr t)
 Remove a member type from the current class_or_union scope.
 
- Public Member Functions inherited from decl_base
 decl_base (const environment &, const location &)
 Constructor for the decl_base type.
 
 decl_base (const environment &e, const interned_string &name, const location &locus, const interned_string &mangled_name=interned_string(), visibility vis=VISIBILITY_DEFAULT)
 Constructor.
 
 decl_base (const environment &e, const string &name, const location &locus, const string &mangled_name="", visibility vis=VISIBILITY_DEFAULT)
 Constructor for the decl_base type.
 
virtual ~decl_base ()
 Destructor of the decl_base type.
 
const interned_stringget_cached_pretty_representation (bool internal=false) const
 Get the pretty representation of the current decl.
 
context_relget_context_rel ()
 Getter for the context relationship.
 
const context_relget_context_rel () const
 Getter for the context relationship.
 
const decl_base_sptr get_definition_of_declaration () const
 If this decl_base is declaration-only, get its definition, if any.
 
const decl_base_sptr get_earlier_declaration () const
 If this decl_base is a definition, get its earlier declaration.
 
bool get_has_anonymous_parent () const
 Get the "has_anonymous_parent" flag of the current declaration.
 
bool get_is_anonymous () const
 Test if the current declaration is anonymous.
 
bool get_is_anonymous_or_has_anonymous_parent () const
 
bool get_is_declaration_only () const
 Test if a decl_base is a declaration-only decl.
 
bool get_is_in_public_symbol_table () const
 Test if the decl is defined in a ELF symbol table as a public symbol.
 
const interned_stringget_linkage_name () const
 Getter for the mangled name.
 
const locationget_location () const
 Get the location of a given declaration.
 
const decl_baseget_naked_definition_of_declaration () const
 If this decl_base is declaration-only, get its definition, if any.
 
virtual const interned_stringget_name () const
 Getter for the name of the current decl.
 
typedef_decl_sptr get_naming_typedef () const
 Getter for the naming typedef of the current decl.
 
virtual const interned_stringget_qualified_name (bool internal=false) const
 Return the qualified name of the decl.
 
virtual void get_qualified_name (interned_string &qualified_name, bool internal=false) const
 Compute the qualified name of the decl.
 
const interned_stringget_qualified_parent_name () const
 Return a copy of the qualified name of the parent of the current decl.
 
scope_declget_scope () const
 Return the type containing the current decl, if any.
 
virtual const interned_stringget_scoped_name () const
 Return the scoped name of the decl.
 
visibility get_visibility () const
 Getter for the visibility of the decl.
 
virtual bool operator!= (const decl_base &) const
 Inequality operator.
 
void set_definition_of_declaration (const decl_base_sptr &)
 Set the definition of this declaration-only decl_base.
 
void set_earlier_declaration (const decl_base_sptr &)
 set the earlier declaration of this decl_base definition.
 
void set_is_anonymous (bool)
 Set the "is_anonymous" flag of the current declaration.
 
void set_is_declaration_only (bool f)
 Set a flag saying if the enum_type_decl is a declaration-only enum_type_decl.
 
void set_is_in_public_symbol_table (bool)
 Set the flag saying if this decl is from a symbol that is in a public symbols table, defined as public (global or weak).
 
virtual void set_linkage_name (const string &m)
 Setter for the linkage name.
 
void set_location (const location &l)
 Set the location for a given declaration.
 
virtual void set_name (const string &n)
 Setter for the name of the decl.
 
void set_naming_typedef (const typedef_decl_sptr &)
 Set the naming typedef of the current instance of decl_base.
 
virtual void set_scope (scope_decl *)
 Setter of the scope of the current decl.
 
void set_visibility (visibility v)
 Setter for the visibility of the decl.
 
- Public Member Functions inherited from type_or_decl_base
 type_or_decl_base (const environment &, enum type_or_decl_kind k=ABSTRACT_TYPE_OR_DECL)
 Constructor of type_or_decl_base.
 
virtual ~type_or_decl_base ()
 The destructor of the type_or_decl_base type.
 
locationget_artificial_location () const
 Getter of the artificial location of the artifact.
 
corpusget_corpus ()
 Get the corpus this ABI artifact belongs to.
 
const corpusget_corpus () const
 Get the corpus this ABI artifact belongs to.
 
const environmentget_environment () const
 Getter of the environment of the current ABI artifact.
 
bool get_is_artificial () const
 Getter of the flag that says if the artefact is artificial.
 
translation_unitget_translation_unit ()
 Get the translation_unit this ABI artifact belongs to.
 
const translation_unitget_translation_unit () const
 Get the translation_unit this ABI artifact belongs to.
 
bool has_artificial_location () const
 Test if the current ABI artifact carries an artificial location.
 
enum type_or_decl_kind kind () const
 Getter for the "kind" property of type_or_decl_base type.
 
void set_artificial_location (const location &)
 Setter of the artificial location of the artificat.
 
void set_is_artificial (bool)
 Setter of the flag that says if the artefact is artificial.
 
void set_translation_unit (translation_unit *)
 Set the translation_unit this ABI artifact belongs to.
 
- Public Member Functions inherited from ir_traversable_base
- Public Member Functions inherited from traversable_base
virtual ~traversable_base ()
 Destructor of the traversable_base type.
 
- Public Member Functions inherited from type_base
 type_base (const environment &e, size_t s, size_t a)
 The constructor of type_base.
 
const interned_stringget_cached_pretty_representation (bool internal=false) const
 Get the pretty representation of the current type.
 
type_base_sptr get_canonical_type () const
 Getter of the canonical type of the current instance of type_base.
 
type_baseget_naked_canonical_type () const
 Getter of the canonical type pointer.
 
virtual bool operator!= (const type_base &) const
 Inequality operator.
 

Protected Member Functions

decl_base_sptr insert_member_decl (decl_base_sptr member)
 
virtual void on_canonical_type_set ()
 This method is invoked automatically right after the current instance of class_decl has been canonicalized.
 
- Protected Member Functions inherited from class_or_union
virtual decl_base_sptr add_member_decl (const decl_base_sptr &)
 Add a member declaration to the current instance of class_or_union. The member declaration can be either a member type, data member, member function, or member template.
 
decl_base_sptr insert_member_decl (decl_base_sptr member)
 Insert a data member to this class_or_union type.
 
void maybe_fixup_members_of_anon_data_member (var_decl_sptr &anon_dm)
 Fixup the members of the type of an anonymous data member.
 
virtual void remove_member_decl (decl_base_sptr)
 Remove a given decl from the current class_or_union scope.
 
- Protected Member Functions inherited from scope_decl
decl_base_sptr insert_member_decl (decl_base_sptr member, declarations::iterator before)
 Insert a member decl to this scope, right before an element pointed to by a given iterator. Note that user code should not use this, but rather use insert_decl_into_scope.
 
- Protected Member Functions inherited from decl_base
 decl_base (const decl_base &)
 
void clear_qualified_name ()
 Clear the qualified name of this decl.
 
const interned_stringpeek_qualified_name () const
 Getter for the qualified name.
 
const interned_stringpeek_temporary_qualified_name () const
 Getter of the temporary qualified name of the current declaration.
 
void set_context_rel (context_rel *c)
 
void set_qualified_name (const interned_string &) const
 Setter for the qualified name.
 
void set_temporary_qualified_name (const interned_string &) const
 Setter for the temporary qualified name of the current declaration.
 
- Protected Member Functions inherited from type_or_decl_base
void kind (enum type_or_decl_kind)
 Setter for the "kind" property of type_or_decl_base type.
 
type_or_decl_baseoperator= (const type_or_decl_base &)
 
void * runtime_type_instance ()
 Getter of the pointer to the runtime type sub-object of the current instance.
 
const void * runtime_type_instance () const
 Getter of the pointer to the runtime type sub-object of the current instance.
 
void runtime_type_instance (void *)
 Setter of the pointer to the runtime type sub-object of the current instance.
 
void set_hash_value (hash_t) const
 
void * type_or_decl_base_pointer ()
 Getter of the pointer to either the type_base sub-object of the current instance if it's a type, or to the decl_base sub-object of the current instance if it's a decl.
 
const void * type_or_decl_base_pointer () const
 Getter of the pointer to either the type_base sub-object of the current instance if it's a type, or to the decl_base sub-object of the current instance if it's a decl.
 
- Protected Member Functions inherited from traversable_base
 traversable_base ()
 Default constructor of the traversable_base type.
 
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.
 
void visiting (bool f)
 The traversing code should be responsible of calling this, not the user code.
 
- Protected Member Functions inherited from type_base

Friends

class class_or_union
 
bool equals (const class_decl &l, const class_decl &r, change_kind *k)
 Compares two instances of class_decl.
 
void fixup_virtual_member_function (method_decl_sptr method)
 When a virtual member function has seen its virtualness set by set_member_function_is_virtual(), this function ensures that the member function is added to the specific vectors and maps of virtual member function of its class.
 
class method_decl
 
void set_member_is_static (decl_base &d, bool s)
 Sets the static-ness property of a class member.
 

Additional Inherited Members

- Public Attributes inherited from class_or_union
privpriv_
 
- Public Attributes inherited from decl_base
priv * priv_
 
- Public Attributes inherited from type_or_decl_base
std::unique_ptr< privpriv_
 
- Public Attributes inherited from type_base
privpriv_
 

Detailed Description

Abstracts a class declaration.

Definition at line 4126 of file abg-ir.h.

Member Typedef Documentation

◆ base_spec_sptr

Convenience typedef.

Definition at line 4145 of file abg-ir.h.

◆ base_specs

Convenience typedef.

Definition at line 4146 of file abg-ir.h.

Constructor & Destructor Documentation

◆ class_decl() [1/5]

class_decl ( const environment & env,
const string & name,
size_t size_in_bits,
size_t align_in_bits,
bool is_struct,
const location & locus,
visibility vis,
base_specs & bases,
member_types & mbr_types,
data_members & data_mbrs,
member_functions & mbr_fns )

A Constructor for instances of class_decl.

Parameters
envthe environment we are operating from.
namethe identifier of the class.
size_in_bitsthe size of an instance of class_decl, expressed in bits
align_in_bitsthe alignment of an instance of class_decl, expressed in bits.
locusthe source location of declaration point this class.
visthe visibility of instances of class_decl.
basesthe vector of base classes for this instance of class_decl.
mbrsthe vector of member types of this instance of class_decl.
data_mbrsthe vector of data members of this instance of class_decl.
mbr_fnsthe vector of member functions of this instance of class_decl.

Definition at line 24463 of file abg-ir.cc.

◆ class_decl() [2/5]

class_decl ( const environment & env,
const string & name,
size_t size_in_bits,
size_t align_in_bits,
bool is_struct,
const location & locus,
visibility vis,
base_specs & bases,
member_types & mbr_types,
data_members & data_mbrs,
member_functions & mbr_fns,
bool is_anonymous )

A Constructor for instances of class_decl.

Parameters
envthe environment we are operating from.
namethe identifier of the class.
size_in_bitsthe size of an instance of class_decl, expressed in bits
align_in_bitsthe alignment of an instance of class_decl, expressed in bits.
locusthe source location of declaration point this class.
visthe visibility of instances of class_decl.
basesthe vector of base classes for this instance of class_decl.
mbrsthe vector of member types of this instance of class_decl.
data_mbrsthe vector of data members of this instance of class_decl.
mbr_fnsthe vector of member functions of this instance of class_decl.
is_anonymouswhether the newly created instance is anonymous.

Definition at line 24514 of file abg-ir.cc.

◆ class_decl() [3/5]

class_decl ( const environment & env,
const string & name,
size_t size_in_bits,
size_t align_in_bits,
bool is_struct,
const location & locus,
visibility vis )

A constructor for instances of class_decl.

Parameters
envthe environment we are operating from.
namethe name of the class.
size_in_bitsthe size of an instance of class_decl, expressed in bits
align_in_bitsthe alignment of an instance of class_decl, expressed in bits.
locusthe source location of declaration point this class.
visthe visibility of instances of class_decl.

Definition at line 24560 of file abg-ir.cc.

◆ class_decl() [4/5]

class_decl ( const environment & env,
const string & name,
size_t size_in_bits,
size_t align_in_bits,
bool is_struct,
const location & locus,
visibility vis,
bool is_anonymous )

A constructor for instances of class_decl.

Parameters
envthe environment we are operating from.
namethe name of the class.
size_in_bitsthe size of an instance of class_decl, expressed in bits
align_in_bitsthe alignment of an instance of class_decl, expressed in bits.
locusthe source location of declaration point this class.
visthe visibility of instances of class_decl.
is_anonymouswhether the newly created instance is anonymous.

Definition at line 24597 of file abg-ir.cc.

◆ class_decl() [5/5]

class_decl ( const environment & env,
const string & name,
bool is_struct,
bool is_declaration_only = true )

A constuctor for instances of class_decl that represent a declaration without definition.

Parameters
envthe environment we are operating from.
namethe name of the class.
is_declaration_onlya boolean saying whether the instance represents a declaration only, or not.

Definition at line 24635 of file abg-ir.cc.

◆ ~class_decl()

~class_decl ( )
virtual

Destructor of the class_decl type.

Definition at line 26032 of file abg-ir.cc.

Member Function Documentation

◆ add_base_specifier()

void add_base_specifier ( shared_ptr< base_spec > b)

Add a base specifier to this class.

Parameters
bthe new base specifier.

Definition at line 24686 of file abg-ir.cc.

◆ find_base_class()

class_decl_sptr find_base_class ( const string & qualified_name) const

Find a base class of a given qualified name for the current class.

Parameters
qualified_namethe qualified name of the base class to look for.
Returns
a pointer to the class_decl that represents the base class of name qualified_name, if found.

Definition at line 24706 of file abg-ir.cc.

◆ get_base_specifiers()

const class_decl::base_specs & get_base_specifiers ( ) const

Get the base specifiers for this class.

Returns
a vector of the base specifiers.

Definition at line 24696 of file abg-ir.cc.

◆ get_biggest_vtable_offset()

ssize_t get_biggest_vtable_offset ( ) const

Get the highest vtable offset of all the virtual methods of the class.

Returns
the highest vtable offset of all the virtual methods of the class.

Definition at line 25497 of file abg-ir.cc.

◆ get_pretty_representation()

string get_pretty_representation ( bool internal = false,
bool qualified_name = true ) const
virtual

Getter of the pretty representation of the current instance of class_decl.

Parameters
internalset to true if the call is intended to get a representation of the decl (or type) for the purpose of canonical type comparison. This is mainly used in the function type_base::get_canonical_type_for().

In other words if the argument for this parameter is true then the call is meant for internal use (for technical use inside the library itself), false otherwise. If you don't know what this is for, then set it to false.

Parameters
qualified_nameif true, names emitted in the pretty representation are fully qualified.
Returns
the pretty representaion for a class_decl.

Reimplemented from decl_base.

Definition at line 24767 of file abg-ir.cc.

◆ get_virtual_mem_fns()

const class_decl::member_functions & get_virtual_mem_fns ( ) const

Get the virtual member functions of this class.

Parameters
returna vector of the virtual member functions of this class.

Definition at line 24722 of file abg-ir.cc.

◆ get_virtual_mem_fns_map()

const class_decl::virtual_mem_fn_map_type & get_virtual_mem_fns_map ( ) const

Get the map that associates a virtual table offset to the virtual member functions with that virtual table offset.

Usually, there should be a 1:1 mapping between a given vtable offset and virtual member functions of that vtable offset. But because of some implementation details, there can be several C++ destructor functions that are *generated* by compilers, for a given destructor that is defined in the source code. If the destructor is virtual then those generated functions have some DWARF attributes in common with the constructor that the user actually defined in its source code. Among those attributes are the vtable offset of the destructor.

Returns
the map that associates a virtual table offset to the virtual member functions with that virtual table offset.

Definition at line 24741 of file abg-ir.cc.

◆ has_no_base_nor_member()

bool has_no_base_nor_member ( ) const

Return true iff the class has no entity in its scope.

Definition at line 25446 of file abg-ir.cc.

◆ has_virtual_bases()

bool has_virtual_bases ( ) const

Test if the current instance of class_decl has at least one virtual base.

Returns
true iff the current instance of class_decl has a virtual member function.

Definition at line 25464 of file abg-ir.cc.

◆ has_virtual_member_functions()

bool has_virtual_member_functions ( ) const

Test if the current instance of class_decl has virtual member functions.

Returns
true iff the current instance of class_decl has virtual member functions.

Definition at line 25455 of file abg-ir.cc.

◆ has_vtable()

bool has_vtable ( ) const

Test if the current instance has a vtable.

This is only valid for a C++ program.

Basically this function checks if the class has either virtual functions, or virtual bases.

Definition at line 25483 of file abg-ir.cc.

◆ hash_value()

hash_t hash_value ( ) const
virtual

Return the hash value of the current IR node.

Note that upon the first invocation, this member functions computes the hash value and returns it. Subsequent invocations just return the hash value that was previously calculated.

Returns
the hash value of the current IR node.

Reimplemented from class_or_union.

Definition at line 25518 of file abg-ir.cc.

◆ insert_member_decl()

decl_base_sptr insert_member_decl ( decl_base_sptr member)
protected

Definition at line 24797 of file abg-ir.cc.

◆ is_struct() [1/2]

bool is_struct ( ) const

Test if the class is a struct.

Returns
true iff the class is a struct.

Definition at line 24679 of file abg-ir.cc.

◆ is_struct() [2/2]

void is_struct ( bool f)

Set the "is-struct" flag of the class.

Parameters
fthe new value of the flag.

Definition at line 24672 of file abg-ir.cc.

◆ on_canonical_type_set()

void on_canonical_type_set ( )
protectedvirtual

This method is invoked automatically right after the current instance of class_decl has been canonicalized.

Currently, the only thing it does is to sort the virtual member functions vector.

Reimplemented from type_base.

Definition at line 24657 of file abg-ir.cc.

◆ operator==() [1/4]

bool operator== ( const class_decl & other) const
virtual

Comparison operator for class_decl.

Parameters
otherthe instance of class_decl to compare against.
Returns
true iff the current instance of class_decl equals other.

Definition at line 25865 of file abg-ir.cc.

◆ operator==() [2/4]

bool operator== ( const class_or_union & other) const
virtual

Equality operator for class_decl.

Re-uses the equality operator that takes a decl_base.

Parameters
otherthe other class_decl to compare against.
Returns
true iff the current instance equals the other one.

Reimplemented from class_or_union.

Definition at line 25852 of file abg-ir.cc.

◆ operator==() [3/4]

bool operator== ( const decl_base & other) const
virtual

Comparison operator for class_decl.

Parameters
otherthe instance of class_decl to compare against.
Returns
true iff the current instance of class_decl equals other.

Reimplemented from class_or_union.

Definition at line 25796 of file abg-ir.cc.

◆ operator==() [4/4]

bool operator== ( const type_base & other) const
virtual

Equality operator for class_decl.

Re-uses the equality operator that takes a decl_base.

Parameters
otherthe other class_decl to compare against.
Returns
true iff the current instance equals the other one.

Reimplemented from class_or_union.

Definition at line 25836 of file abg-ir.cc.

◆ sort_virtual_mem_fns()

void sort_virtual_mem_fns ( )

Sort the virtual member functions by their virtual index.

Definition at line 24746 of file abg-ir.cc.

◆ traverse()

bool traverse ( ir_node_visitor & v)
virtual

This implements the ir_traversable_base::traverse pure virtual function.

Parameters
vthe visitor used on the current instance and on its members.
Returns
true if the entire IR node tree got traversed, false otherwise.

Reimplemented from class_or_union.

Definition at line 25948 of file abg-ir.cc.

Friends And Related Symbol Documentation

◆ class_or_union

friend class class_or_union
friend

Definition at line 4267 of file abg-ir.h.

◆ equals

bool equals ( const class_decl & l,
const class_decl & r,
change_kind * k )
friend

Compares two instances of class_decl.

If the two intances are different, set a bitfield to give some insight about the kind of differences there are.

Parameters
lthe first artifact of the comparison.
rthe second artifact of the comparison.
ka pointer to a bitfield that gives information about the kind of changes there are between l and r. This one is set iff k is non-null and the function returns false.

Please note that setting k to a non-null value does have a negative performance impact because even if l and r are not equal, the function keeps up the comparison in order to determine the different kinds of ways in which they are different.

Returns
true if l equals r, false otherwise.

Definition at line 25616 of file abg-ir.cc.

◆ fixup_virtual_member_function

void fixup_virtual_member_function ( method_decl_sptr method)
friend

When a virtual member function has seen its virtualness set by set_member_function_is_virtual(), this function ensures that the member function is added to the specific vectors and maps of virtual member function of its class.

Parameters
methodthe method to fixup.

Definition at line 25402 of file abg-ir.cc.

◆ method_decl

friend class method_decl
friend

Definition at line 4266 of file abg-ir.h.

◆ set_member_is_static

void set_member_is_static ( decl_base & d,
bool s )
friend

Sets the static-ness property of a class member.

Parameters
dthe class member to set the static-ness property for. Note that this must be a class member otherwise the function aborts the current process.
sthis must be true if the member is to be static, false otherwise.

Definition at line 26335 of file abg-ir.cc.


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