libabigail
Public Member Functions | Friends | List of all members
method_decl Class Reference

Abstraction of the declaration of a method. More...

#include <abg-ir.h>

Inheritance diagram for method_decl:
[legend]

Public Member Functions

 method_decl (const string &name, function_type_sptr type, bool declared_inline, const location &locus, const string &mangled_name="", visibility vis=VISIBILITY_DEFAULT, binding bind=BINDING_GLOBAL)
 A constructor for instances of method_decl. More...
 
 method_decl (const string &name, method_type_sptr type, bool declared_inline, const location &locus, const string &mangled_name="", visibility vis=VISIBILITY_DEFAULT, binding bind=BINDING_GLOBAL)
 A constructor for instances of method_decl. More...
 
 method_decl (const string &name, type_base_sptr type, bool declared_inline, const location &locus, const string &mangled_name="", visibility vis=VISIBILITY_DEFAULT, binding bind=BINDING_GLOBAL)
 A constructor for instances of method_decl. More...
 
const method_type_sptr get_type () const
 
virtual void set_linkage_name (const string &)
 Set the linkage name of the method. More...
 
void set_type (const method_type_sptr fn_type)
 
- Public Member Functions inherited from function_decl
 function_decl (const string &name, function_type_sptr function_type, bool declared_inline, const location &locus, const string &mangled_name, visibility vis, binding bind)
 Constructor of the function_decl. More...
 
 function_decl (const string &name, type_base_sptr fn_type, bool declared_inline, const location &locus, const string &mangled_name="", visibility vis=VISIBILITY_DEFAULT, binding bind=BINDING_GLOBAL)
 Constructor of the function_decl type. More...
 
virtual ~function_decl ()
 Destructor of the function_decl type. More...
 
void append_parameter (parameter_sptr parm)
 Append a parameter to the type of this function. More...
 
void append_parameters (std::vector< parameter_sptr > &parms)
 Append a vector of parameters to the type of this function. More...
 
function_decl_sptr clone () const
 Create a new instance of function_decl that is a clone of the current one. More...
 
binding get_binding () const
 
parameters::const_iterator get_first_non_implicit_parm () const
 Getter for the first non-implicit parameter of a function decl. More...
 
interned_string get_id () const
 Return an ID that tries to uniquely identify the function inside a program or a library. More...
 
const function_typeget_naked_type () const
 Fast getter of the type of the current instance of function_decl. More...
 
const std::vector< parameter_sptr > & get_parameters () const
 
virtual string get_pretty_representation (bool internal=false, bool qualified_name=true) const
 Get the pretty representation of the current instance of function_decl. More...
 
string get_pretty_representation_of_declarator (bool internal=false) const
 Compute and return the pretty representation for the part of the function declaration that starts at the declarator. That is, the return type and the other specifiers of the beginning of the function's declaration ar omitted. More...
 
const type_base_sptr get_return_type () const
 
const elf_symbol_sptrget_symbol () const
 Gets the the underlying ELF symbol for the current variable, that was set using function_decl::set_symbol(). Please read the documentation for that member function for more information about "underlying ELF symbols". More...
 
const function_type_sptr get_type () const
 Return the type of the current instance of function_decl. More...
 
bool is_declared_inline () const
 Test if the function was declared inline. More...
 
void is_declared_inline (bool)
 Set the property of the function being declared inline. More...
 
bool is_variadic () const
 Return true iff the function takes a variable number of parameters. More...
 
virtual bool operator== (const decl_base &o) const
 Comparison operator for function_decl. More...
 
void set_symbol (const elf_symbol_sptr &sym)
 This sets the underlying ELF symbol for the current function decl. More...
 
void set_type (const function_type_sptr &fn_type)
 
virtual bool traverse (ir_node_visitor &)
 This implements the ir_traversable_base::traverse pure virtual function. More...
 
- Public Member Functions inherited from decl_base
 decl_base (const environment &, const location &)
 Constructor for the decl_base type. More...
 
 decl_base (const environment &e, const interned_string &name, const location &locus, const interned_string &mangled_name=interned_string(), visibility vis=VISIBILITY_DEFAULT)
 Constructor. More...
 
 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. More...
 
virtual ~decl_base ()
 Destructor of the decl_base type. More...
 
const interned_stringget_cached_pretty_representation (bool internal=false) const
 Get the pretty representation of the current decl. More...
 
context_relget_context_rel ()
 Getter for the context relationship. More...
 
const context_relget_context_rel () const
 Getter for the context relationship. More...
 
const decl_base_sptr get_definition_of_declaration () const
 If this decl_base is declaration-only, get its definition, if any. More...
 
const decl_base_sptr get_earlier_declaration () const
 If this decl_base is a definition, get its earlier declaration. More...
 
bool get_has_anonymous_parent () const
 Get the "has_anonymous_parent" flag of the current declaration. More...
 
bool get_is_anonymous () const
 Test if the current declaration is anonymous. More...
 
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. More...
 
bool get_is_in_public_symbol_table () const
 Test if the decl is defined in a ELF symbol table as a public symbol. More...
 
const interned_stringget_linkage_name () const
 Getter for the mangled name. More...
 
const locationget_location () const
 Get the location of a given declaration. More...
 
const decl_baseget_naked_definition_of_declaration () const
 If this decl_base is declaration-only, get its definition, if any. More...
 
virtual const interned_stringget_name () const
 Getter for the name of the current decl. More...
 
typedef_decl_sptr get_naming_typedef () const
 Getter for the naming typedef of the current decl. More...
 
virtual string get_pretty_representation (bool internal=false, bool qualified_name=true) const
 Get the pretty representatin of the current declaration. More...
 
virtual const interned_stringget_qualified_name (bool internal=false) const
 Return the qualified name of the decl. More...
 
virtual void get_qualified_name (interned_string &qualified_name, bool internal=false) const
 Compute the qualified name of the decl. More...
 
const interned_stringget_qualified_parent_name () const
 Return a copy of the qualified name of the parent of the current decl. More...
 
scope_declget_scope () const
 Return the type containing the current decl, if any. More...
 
virtual const interned_stringget_scoped_name () const
 Return the scoped name of the decl. More...
 
visibility get_visibility () const
 Getter for the visibility of the decl. More...
 
virtual bool operator!= (const decl_base &) const
 Inequality operator. More...
 
virtual bool operator== (const decl_base &) const
 Return true iff the two decls have the same name. More...
 
void set_definition_of_declaration (const decl_base_sptr &)
 Set the definition of this declaration-only decl_base. More...
 
void set_earlier_declaration (const decl_base_sptr &)
 set the earlier declaration of this decl_base definition. More...
 
void set_is_anonymous (bool)
 Set the "is_anonymous" flag of the current declaration. More...
 
void set_is_declaration_only (bool f)
 Set a flag saying if the enum_type_decl is a declaration-only enum_type_decl. More...
 
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). More...
 
virtual void set_linkage_name (const string &m)
 Setter for the linkage name. More...
 
void set_location (const location &l)
 Set the location for a given declaration. More...
 
virtual void set_name (const string &n)
 Setter for the name of the decl. More...
 
void set_naming_typedef (const typedef_decl_sptr &)
 Set the naming typedef of the current instance of decl_base. More...
 
virtual void set_scope (scope_decl *)
 Setter of the scope of the current decl. More...
 
void set_visibility (visibility v)
 Setter for the visibility of the decl. More...
 
virtual bool traverse (ir_node_visitor &v)
 This implements the ir_traversable_base::traverse pure virtual function. More...
 
- 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. More...
 
virtual ~type_or_decl_base ()
 The destructor of the type_or_decl_base type. More...
 
locationget_artificial_location () const
 Getter of the artificial location of the artifact. More...
 
corpusget_corpus ()
 Get the corpus this ABI artifact belongs to. More...
 
const corpusget_corpus () const
 Get the corpus this ABI artifact belongs to. More...
 
const environmentget_environment () const
 Getter of the environment of the current ABI artifact. More...
 
bool get_is_artificial () const
 Getter of the flag that says if the artefact is artificial. More...
 
virtual string get_pretty_representation (bool internal=false, bool qualified_name=true) const =0
 
translation_unitget_translation_unit ()
 Get the translation_unit this ABI artifact belongs to. More...
 
const translation_unitget_translation_unit () const
 Get the translation_unit this ABI artifact belongs to. More...
 
bool has_artificial_location () const
 Test if the current ABI artifact carries an artificial location. More...
 
enum type_or_decl_kind kind () const
 Getter for the "kind" property of type_or_decl_base type. More...
 
void set_artificial_location (const location &)
 Setter of the artificial location of the artificat. More...
 
void set_is_artificial (bool)
 Setter of the flag that says if the artefact is artificial. More...
 
void set_translation_unit (translation_unit *)
 Set the translation_unit this ABI artifact belongs to. More...
 
virtual bool traverse (ir_node_visitor &)
 Traverse the the ABI artifact. More...
 
virtual bool traverse (ir_node_visitor &v)
 Traverse a given IR node and its children, calling an visitor on each node. More...
 
- Public Member Functions inherited from traversable_base
virtual ~traversable_base ()
 Destructor of the traversable_base type. More...
 

Friends

bool get_member_function_is_const (const function_decl &)
 Test whether a member function is const. More...
 
bool get_member_function_is_ctor (const function_decl &)
 Test whether a member function is a constructor. More...
 
bool get_member_function_is_dtor (const function_decl &)
 Test whether a member function is a destructor. More...
 
bool get_member_function_is_static (const function_decl &)
 
ssize_t get_member_function_vtable_offset (const function_decl &)
 Get the vtable offset of a member function. More...
 
bool member_function_has_vtable_offset (const function_decl &)
 Test if a virtual member function has a vtable offset set. More...
 
void set_member_function_is_const (const function_decl_sptr &, bool)
 set the const-ness property of a member function. More...
 
void set_member_function_is_const (function_decl &, bool)
 set the const-ness property of a member function. More...
 
void set_member_function_is_ctor (const function_decl_sptr &, bool)
 Setter for the is_ctor property of the member function. More...
 
void set_member_function_is_ctor (function_decl &, bool)
 Setter for the is_ctor property of the member function. More...
 
void set_member_function_is_dtor (const function_decl_sptr &, bool)
 Set the destructor-ness property of a member function. More...
 
void set_member_function_is_dtor (function_decl &, bool)
 Set the destructor-ness property of a member function. More...
 
void set_member_function_is_static (const function_decl &, bool)
 

Additional Inherited Members

- Public Types inherited from function_decl
typedef shared_ptr< parameterparameter_sptr
 Convenience typedef for a shared pointer on a function_decl::parameter. More...
 
typedef std::vector< parameter_sptrparameters
 Convenience typedef for a vector of parameter_sptr. More...
 
- 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 Attributes inherited from decl_base
priv * priv_
 
- Public Attributes inherited from type_or_decl_base
std::unique_ptr< privpriv_
 
- Protected Member Functions inherited from decl_base
 decl_base (const decl_base &)
 
void clear_qualified_name ()
 Clear the qualified name of this decl. More...
 
const interned_stringpeek_qualified_name () const
 Getter for the qualified name. More...
 
const interned_stringpeek_temporary_qualified_name () const
 Getter of the temporary qualified name of the current declaration. More...
 
void set_context_rel (context_rel *c)
 
void set_qualified_name (const interned_string &) const
 Setter for the qualified name. More...
 
void set_temporary_qualified_name (const interned_string &) const
 Setter for the temporary qualified name of the current declaration. More...
 
- Protected Member Functions inherited from type_or_decl_base
virtual hash_t hash_value () const
 Return the hash value of the current IR node. More...
 
void kind (enum type_or_decl_kind)
 Setter for the "kind" property of type_or_decl_base type. More...
 
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. More...
 
const void * runtime_type_instance () const
 Getter of the pointer to the runtime type sub-object of the current instance. More...
 
void runtime_type_instance (void *)
 Setter of the pointer to the runtime type sub-object of the current instance. More...
 
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. More...
 
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. 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...
 

Detailed Description

Abstraction of the declaration of a method.

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

Constructor & Destructor Documentation

◆ method_decl() [1/3]

method_decl ( const string &  name,
method_type_sptr  type,
bool  declared_inline,
const location locus,
const string &  linkage_name = "",
visibility  vis = VISIBILITY_DEFAULT,
binding  bind = BINDING_GLOBAL 
)

A constructor for instances of method_decl.

Parameters
namethe name of the method.
typethe type of the method.
declared_inlinewhether the method was declared inline or not.
locusthe source location of the method.
linkage_namethe mangled name of the method.
visthe visibility of the method.
bindthe binding of the method.

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

◆ method_decl() [2/3]

method_decl ( const string &  name,
function_type_sptr  type,
bool  declared_inline,
const location locus,
const string &  linkage_name = "",
visibility  vis = VISIBILITY_DEFAULT,
binding  bind = BINDING_GLOBAL 
)

A constructor for instances of method_decl.

Parameters
namethe name of the method.
typethe type of the method. Must be an instance of method_type.
declared_inlinewhether the method was declared inline or not.
locusthe source location of the method.
linkage_namethe mangled name of the method.
visthe visibility of the method.
bindthe binding of the method.

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

◆ method_decl() [3/3]

method_decl ( const string &  name,
type_base_sptr  type,
bool  declared_inline,
const location locus,
const string &  linkage_name = "",
visibility  vis = VISIBILITY_DEFAULT,
binding  bind = BINDING_GLOBAL 
)

A constructor for instances of method_decl.

Parameters
namethe name of the method.
typethe type of the method. Must be an instance of method_type.
declared_inlinewhether the method was declared inline or not.
locusthe source location of the method.
linkage_namethe mangled name of the method.
visthe visibility of the method.
bindthe binding of the method.

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

◆ ~method_decl()

~method_decl ( )
virtual

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

Member Function Documentation

◆ get_type()

const method_type_sptr get_type ( ) const
Returns
the type of the current instance of the method_decl.

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

◆ set_linkage_name()

void set_linkage_name ( const string &  l)
virtual

Set the linkage name of the method.

Parameters
lthe new linkage name of the method.

Reimplemented from decl_base.

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

◆ set_type()

void set_type ( const method_type_sptr  fn_type)
inline

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

Friends And Related Function Documentation

◆ get_member_function_is_const

bool get_member_function_is_const ( const function_decl )
friend

Test whether a member function is const.

Parameters
fthe function to test.
Returns
true if f is const, false otherwise.

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

◆ get_member_function_is_ctor

bool get_member_function_is_ctor ( const function_decl )
friend

Test whether a member function is a constructor.

Parameters
fthe member function to test.
Returns
true if f is a constructor, false otherwise.

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

◆ get_member_function_is_dtor

bool get_member_function_is_dtor ( const function_decl )
friend

Test whether a member function is a destructor.

Parameters
fthe function to test.
Returns
true if f is a destructor, false otherwise.

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

◆ get_member_function_vtable_offset

ssize_t get_member_function_vtable_offset ( const function_decl )
friend

Get the vtable offset of a member function.

Parameters
fthe member function to consider.
Returns
the vtable offset of f. Note that a vtable offset of value -1 means that the member function does *NOT* yet have a vtable offset associated to it.

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

◆ member_function_has_vtable_offset

bool member_function_has_vtable_offset ( const function_decl )
friend

Test if a virtual member function has a vtable offset set.

Parameters
fthe virtual member function to consider.
Returns
true iff the virtual member function has its vtable offset set, i.e, if the vtable offset of is different from -1.

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

◆ set_member_function_is_const [1/2]

void set_member_function_is_const ( const function_decl_sptr ,
bool   
)
friend

set the const-ness property of a member function.

Parameters
fthe function to set.
is_constthe new value of the const-ness property of f

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

◆ set_member_function_is_const [2/2]

void set_member_function_is_const ( function_decl ,
bool   
)
friend

set the const-ness property of a member function.

Parameters
fthe function to set.
is_constthe new value of the const-ness property of f

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

◆ set_member_function_is_ctor [1/2]

void set_member_function_is_ctor ( const function_decl_sptr ,
bool   
)
friend

Setter for the is_ctor property of the member function.

Parameters
fthe member function to set.
fthe new boolean value of the is_ctor property. Is true if f is a constructor, false otherwise.

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

◆ set_member_function_is_ctor [2/2]

void set_member_function_is_ctor ( function_decl f,
bool  c 
)
friend

Setter for the is_ctor property of the member function.

Parameters
fthe member function to set.
fthe new boolean value of the is_ctor property. Is true if f is a constructor, false otherwise.

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

◆ set_member_function_is_dtor [1/2]

void set_member_function_is_dtor ( const function_decl_sptr ,
bool   
)
friend

Set the destructor-ness property of a member function.

Parameters
fthe function to set.
dtrue if f is a destructor, false otherwise.

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

◆ set_member_function_is_dtor [2/2]

void set_member_function_is_dtor ( function_decl ,
bool   
)
friend

Set the destructor-ness property of a member function.

Parameters
fthe function to set.
dtrue if f is a destructor, false otherwise.

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


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