libabigail
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | List of all members
translation_unit Class Reference

#include <abg-ir.h>

Inheritance diagram for translation_unit:
[legend]

Classes

struct  priv
 

Public Types

typedef shared_ptr< global_scopeglobal_scope_sptr
 

Public Member Functions

 translation_unit (const std::string &path, char address_size=0)
 
char get_address_size () const
 
function_type_sptr get_canonical_function_type (function_type_sptr ftype) const
 
const global_scope_sptr get_global_scope () const
 
location_managerget_loc_mgr ()
 
const location_managerget_loc_mgr () const
 
const std::string & get_path () const
 
bool is_empty () const
 
bool operator== (const translation_unit &) const
 
void set_address_size (char)
 
void set_path (const string &)
 
virtual bool traverse (node_visitor_base &v)
 
virtual bool traverse (ir_node_visitor &v)
 

Detailed Description

This is the abstraction of the set of relevant artefacts (types, variable declarations, functions, templates, etc) bundled together into a translation unit.

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

Member Typedef Documentation

typedef shared_ptr<global_scope> global_scope_sptr

Convenience typedef for a shared pointer on a global_scope.

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

Constructor & Destructor Documentation

translation_unit ( const std::string &  path,
char  address_size = 0 
)

Constructor of translation_unit.

Parameters
paththe location of the translation unit.
address_sizethe size of addresses in the translation unit, in bits.

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

Member Function Documentation

char get_address_size ( ) const

Getter of the address size in this translation unit.

Returns
the address size, in bits.

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

function_type_sptr get_canonical_function_type ( function_type_sptr  ftype) const

Return the canonical version of a given instance of function_type.

A given translation units keeps only one copy of each function type that is used in the unit. So each function type that is built somewhere needs to be passed to this function to canonicalize it and/or return the canonical version.

Note that it really is the translation unit that 'owns' the function types that are live in the translation unit. This is unlike the other kinds of types that are owned by the scope where they are defined.

Parameters
ftypethe function type to canonicalize.
Returns
the resulting canonical type.

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

const shared_ptr< global_scope > get_global_scope ( ) const

Getter of the the global scope of the translation unit.

Returns
the global scope of the current translation unit. If there is not global scope allocated yet, this function creates one and returns it.

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

location_manager & get_loc_mgr ( )

Getter of the location manager for the current translation unit.

Returns
a reference to the location manager for the current translation unit.

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

const location_manager & get_loc_mgr ( ) const

const Getter of the location manager.

Returns
a const reference to the location manager for the current translation unit.

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

const std::string & get_path ( ) const
Returns
the path of the compilation unit associated to the current instance of translation_unit.

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

bool is_empty ( ) const

Tests whether if the current translation unit contains ABI artifacts or not.

Returns
true iff the current translation unit is empty.

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

bool operator== ( const translation_unit other) const

Compare the current translation unit against another one.

Parameters
otherthe other tu to compare against.
Returns
true if the two translation units are equal, false otherwise.

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

void set_address_size ( char  a)

Setter of the address size in this translation unit.

Parameters
athe new address size in bits.

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

void set_path ( const string &  a_path)

Set the path associated to the current instance of translation_unit.

Parameters
a_paththe new path to set.

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

bool traverse ( node_visitor_base v)
virtualinherited

This virtual method is overloaded and implemented by any single type which instance is going to be visited during the traversal of translation unit nodes.

The method visits a given node and, for scopes, visits their member nodes. Visiting a node means calling the ir_node_visitor::visit method with the node passed as an argument.

Parameters
vthe visitor used during the traverse.
Returns
true if traversed until the end of the type tree, false otherwise.

Definition at line 29 of file abg-traverse.cc.

bool traverse ( ir_node_visitor v)
virtual

This implements the ir_traversable_base::traverse virtual function.

Parameters
vthe visitor used on the member nodes of the translation unit during the traversal.
Returns
true if the entire type IR tree got traversed, false otherwise.

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


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