libabigail
Loading...
Searching...
No Matches
type_or_decl_base Class Referenceabstract

The base class of both types and declarations. More...

#include <abg-ir.h>

Inheritance diagram for type_or_decl_base:
[legend]

Classes

struct  priv
 The private data of type_or_decl_base. More...
 

Public Types

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

 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.
 
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.
 
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.
 
virtual bool traverse (ir_node_visitor &)
 Traverse the the ABI artifact.
 
- Public Member Functions inherited from traversable_base
virtual ~traversable_base ()
 Destructor of the traversable_base type.
 

Public Attributes

std::unique_ptr< privpriv_
 

Protected Member Functions

virtual hash_t hash_value () const
 Return the hash value of the current IR node.
 
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.
 

Friends

class_declis_class_type (const type_or_decl_base *t)
 Test whether a type is a class.
 
decl_baseis_decl (const type_or_decl_base *d)
 Test if an ABI artifact is a declaration.
 
type_baseis_type (const type_or_decl_base *t)
 Test whether a declaration is a type.
 
type_or_decl_base::type_or_decl_kind operator& (type_or_decl_base::type_or_decl_kind l, type_or_decl_base::type_or_decl_kind r)
 bitwise "AND" operator for the type_or_decl_base::type_or_decl_kind bitmap type.
 
type_or_decl_base::type_or_decl_kindoperator&= (type_or_decl_base::type_or_decl_kind &l, type_or_decl_base::type_or_decl_kind r)
 bitwise "A&=" operator for the type_or_decl_base::type_or_decl_kind bitmap type.
 
type_or_decl_base::type_or_decl_kind operator| (type_or_decl_base::type_or_decl_kind l, type_or_decl_base::type_or_decl_kind r)
 bitwise "OR" operator for the type_or_decl_base::type_or_decl_kind bitmap type.
 
type_or_decl_base::type_or_decl_kindoperator|= (type_or_decl_base::type_or_decl_kind &l, type_or_decl_base::type_or_decl_kind r)
 bitwise "|=" operator for the type_or_decl_base::type_or_decl_kind bitmap type.
 
hash_t peek_hash_value (const type_or_decl_base &artefact)
 Get the hash value associated to an IR node.
 
template<typename T>
hash_t set_or_get_cached_hash_value (const T &type_or_decl)
 Set the hash value of an IR node and return it.
 

Detailed Description

The base class of both types and declarations.

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

Member Enumeration Documentation

◆ type_or_decl_kind

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.

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

Constructor & Destructor Documentation

◆ type_or_decl_base()

type_or_decl_base ( const environment & e,
enum type_or_decl_kind k = ABSTRACT_TYPE_OR_DECL )

Constructor of type_or_decl_base.

Parameters
theenvironment the current ABI artifact is constructed from.
kthe runtime identifier bitmap of the type being built.

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

◆ ~type_or_decl_base()

~type_or_decl_base ( )
virtual

The destructor of the type_or_decl_base type.

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

Member Function Documentation

◆ get_artificial_location()

location & get_artificial_location ( ) const

Getter of the artificial location of the artifact.

The artificial location is a location that was artificially generated by libabigail, not generated by the original emitter of the ABI meta-data. For instance, when reading an XML element from an abixml file, the artificial location is the source location of the XML element within the file, not the value of the 'location'property that might be carried by the element.

Artificial locations might be useful to ensure that the abixml emitted by the abixml writer is sorted the same way as the input abixml read by the reader.

Returns
the new artificial location.

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

◆ get_corpus() [1/2]

corpus * get_corpus ( )

Get the corpus this ABI artifact belongs to.

Returns
the corpus this ABI artifact belongs to, or nil if it belongs to none for now.

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

◆ get_corpus() [2/2]

const corpus * get_corpus ( ) const

Get the corpus this ABI artifact belongs to.

Returns
the corpus this ABI artifact belongs to, or nil if it belongs to none for now.

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

◆ get_environment()

const environment & get_environment ( ) const

Getter of the environment of the current ABI artifact.

Returns
the environment of the artifact.

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

◆ get_is_artificial()

bool get_is_artificial ( ) const

Getter of the flag that says if the artefact is artificial.

Being artificial means it was not explicitely mentionned in the source code, but was rather artificially created by the compiler or libabigail.

Returns
true iff the declaration is artificial.

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

◆ get_pretty_representation()

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

◆ get_translation_unit() [1/2]

translation_unit * get_translation_unit ( )

Get the translation_unit this ABI artifact belongs to.

Returns
the translation unit this ABI artifact belongs to, or nil if belongs to none for now.

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

◆ get_translation_unit() [2/2]

const translation_unit * get_translation_unit ( ) const

Get the translation_unit this ABI artifact belongs to.

Returns
the translation unit this ABI artifact belongs to, or nil if belongs to none for now.

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

◆ has_artificial_location()

bool has_artificial_location ( ) const

Test if the current ABI artifact carries an artificial location.

Returns
true iff the current ABI artifact carries an artificial location.

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

◆ hash_value()

hash_t hash_value ( ) const
protectedvirtual

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 in array_type_def, array_type_def::subrange_type, class_decl::base_spec, class_decl, class_or_union, enum_type_decl, function_type, method_type, pointer_type_def, ptr_to_mbr_type, qualified_type_def, reference_type_def, type_base, type_decl, typedef_decl, and union_decl.

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

◆ kind() [1/2]

Getter for the "kind" property of type_or_decl_base type.

This property holds the identifier bitmap of the runtime type of an ABI artifact.

Returns
the runtime type identifier bitmap of the current ABI artifact.

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

◆ kind() [2/2]

void kind ( enum type_or_decl_kind k)
protected

Setter for the "kind" property of type_or_decl_base type.

This property holds the identifier bitmap of the runtime type of an ABI artifact.

Parameters
theruntime type identifier bitmap of the current ABI artifact.

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

◆ runtime_type_instance() [1/3]

void * runtime_type_instance ( )
protected

Getter of the pointer to the runtime type sub-object of the current instance.

Returns
the pointer to the runtime type sub-object of the current instance.

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

◆ runtime_type_instance() [2/3]

const void * runtime_type_instance ( ) const
protected

Getter of the pointer to the runtime type sub-object of the current instance.

Returns
the pointer to the runtime type sub-object of the current instance.

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

◆ runtime_type_instance() [3/3]

void runtime_type_instance ( void * i)
protected

Setter of the pointer to the runtime type sub-object of the current instance.

Parameters
ithe new pointer to the runtime type sub-object of the current instance.

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

◆ set_artificial_location()

void set_artificial_location ( const location & l)

Setter of the artificial location of the artificat.

The artificial location is a location that was artificially generated by libabigail, not generated by the original emitter of the ABI meta-data. For instance, when reading an XML element from an abixml file, the artificial location is the source location of the XML element within the file, not the value of the 'location'property that might be carried by the element.

Artificial locations might be useful to ensure that abixml emitted by the abixml writer are sorted the same way as the input abixml read by the reader.

Parameters
lthe new artificial location.

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

◆ set_hash_value()

void set_hash_value ( hash_t h) const
protected

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

◆ set_is_artificial()

void set_is_artificial ( bool f)

Setter of the flag that says if the artefact is artificial.

Being artificial means the artefact was not explicitely mentionned in the source code, but was rather artificially created by the compiler or by libabigail.

Parameters
fthe new value of the flag that says if the artefact is artificial.

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

◆ set_translation_unit()

void set_translation_unit ( translation_unit * tu)

Set the translation_unit this ABI artifact belongs to.

Note that adding an ABI artifact to a containining on should invoke this member function.

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

◆ traverse()

◆ type_or_decl_base_pointer() [1/2]

void * type_or_decl_base_pointer ( )
protected

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.

Returns
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.

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

◆ type_or_decl_base_pointer() [2/2]

const void * type_or_decl_base_pointer ( ) const
protected

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.

Returns
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.

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

Friends And Related Symbol Documentation

◆ is_class_type

class_decl * is_class_type ( const type_or_decl_base * t)
friend

Test whether a type is a class.

@parm t the type to consider.

Returns
the class_decl if t is a class_decl or null otherwise.

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

◆ is_decl

decl_base * is_decl ( const type_or_decl_base * d)
friend

Test if an ABI artifact is a declaration.

Parameters
dthe artifact to consider.
returnthe declaration sub-object of d if it's a declaration, or NULL if it is not.

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

◆ is_type

type_base * is_type ( const type_or_decl_base * t)
friend

Test whether a declaration is a type.

Parameters
dthe IR artefact to test for.
Returns
true if the artifact is a type, false otherwise.

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

◆ operator&

bitwise "AND" operator for the type_or_decl_base::type_or_decl_kind bitmap type.

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

◆ operator&=

bitwise "A&=" operator for the type_or_decl_base::type_or_decl_kind bitmap type.

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

◆ operator|

bitwise "OR" operator for the type_or_decl_base::type_or_decl_kind bitmap type.

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

◆ operator|=

bitwise "|=" operator for the type_or_decl_base::type_or_decl_kind bitmap type.

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

◆ peek_hash_value

hash_t peek_hash_value ( const type_or_decl_base & artefact)
friend

Get the hash value associated to an IR node.

Unlike type_or_decl_base::hash_value(), if the IR has no associated hash value, an empty hash value is returned.

Parameters
artefactthe IR node to consider.
Returns
the hash value stored on the IR node or an empty hash if no hash value is stored in the artefact.

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

◆ set_or_get_cached_hash_value

template<typename T>
hash_t set_or_get_cached_hash_value ( const T & type_or_decl)
friend

Set the hash value of an IR node and return it.

If the IR node already has a hash value set, this function just returns it. Otherwise, the function computes a new hash value and sets it to the IR node.

Note that if the IR node is a non-canonicalizeable type, no hash value is computed and an empty hash is returned.

This is a sub-routine of the type_or_decl_base::hash_value() virtual member functions.

Parameters
type_or_declthe IR node to compute the value for.
Returns
the hash value computed and set to the IR node, or the hash value the IR node already had.

Definition at line 414 of file abg-ir-priv.h.

Member Data Documentation

◆ priv_

std::unique_ptr<priv> priv_
mutable

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


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