libabigail
|
This is an abstraction of the set of resources necessary to manage several aspects of the internal representations of the Abigail library. More...
#include <abg-ir.h>
Classes | |
struct | priv |
The private data of the environment type. More... | |
Public Types | |
typedef std::unordered_map< string, std::vector< type_base_sptr > > | canonical_types_map_type |
A convenience typedef for a map of canonical types. The key is the pretty representation string of a particular type and the value is the vector of canonical types that have the same pretty representation string. More... | |
Public Member Functions | |
environment () | |
Default constructor of the environment type. More... | |
virtual | ~environment () |
Destructor for the environment type. More... | |
bool | analyze_exported_interfaces_only () const |
Getter for the property that controls if we are to restrict the analysis to the types that are only reachable from the exported interfaces only, or if the set of types should be more broad than that. Typically, we'd restrict the analysis to types reachable from exported interfaces only (stricto sensu, that would really be only the types that are part of the ABI of well designed libraries) for performance reasons. More... | |
void | analyze_exported_interfaces_only (bool f) |
Setter for the property that controls if we are to restrict the analysis to the types that are only reachable from the exported interfaces only, or if the set of types should be more broad than that. Typically, we'd restrict the analysis to types reachable from exported interfaces only (stricto sensu, that would really be only the types that are part of the ABI of well designed libraries) for performance reasons. More... | |
bool | canonicalization_is_done () const |
Test if the canonicalization of types created out of the current environment is done. More... | |
void | canonicalization_is_done (bool) |
Set a flag saying if the canonicalization of types created out of the current environment is done or not. More... | |
bool | decl_only_class_equals_definition () const |
Getter of the "decl-only-class-equals-definition" flag. More... | |
void | decl_only_class_equals_definition (bool f) const |
Setter of the "decl-only-class-equals-definition" flag. More... | |
bool | do_on_the_fly_canonicalization () const |
Getter for the "on-the-fly-canonicalization" flag. More... | |
void | do_on_the_fly_canonicalization (bool f) |
Setter for the "on-the-fly-canonicalization" flag. More... | |
type_base * | get_canonical_type (const char *name, unsigned index) |
Get a given canonical type which has a given "string
representation". More... | |
vector< type_base_sptr > * | get_canonical_types (const char *name) |
Get the vector of canonical types which have a given "string
representation". More... | |
canonical_types_map_type & | get_canonical_types_map () |
Getter the map of canonical types. More... | |
const canonical_types_map_type & | get_canonical_types_map () const |
Getter the map of canonical types. More... | |
const config & | get_config () const |
Getter of the general configuration object. More... | |
const type_base_sptr & | get_variadic_parameter_type () const |
Get a type_decl instance that represents a the type of a variadic function parameter. This node must be the only one representing a variadic parameter type in the system. More... | |
const type_base_sptr & | get_void_pointer_type () const |
Getter of the "pointer-to-void" IR node that is shared across the ABI corpus. This node must be the only one representing a void pointer type in the system. More... | |
const type_base_sptr & | get_void_type () const |
Get the unique type_decl that represents a "void" type for the current environment. This node must be the only one representing a void type in the system. More... | |
interned_string | intern (const string &) const |
Do intern a string. More... | |
bool | is_variadic_parameter_type (const type_base *) const |
Test if a type is a variadic parameter type as defined in the current environment. More... | |
bool | is_variadic_parameter_type (const type_base_sptr &) const |
Test if a type is a variadic parameter type as defined in the current environment. More... | |
bool | is_void_pointer_type (const type_base *) const |
Test if a given type is the same as the void pointer type of the environment. More... | |
bool | is_void_pointer_type (const type_base_sptr &) const |
Test if a given type is the same as the void pointer type of the environment. More... | |
bool | is_void_type (const type_base *) const |
Test if a given type is a void type as defined in the current environment. More... | |
bool | is_void_type (const type_base_sptr &) const |
Test if a given type is a void type as defined in the current environment. More... | |
bool | user_set_analyze_exported_interfaces_only () const |
Getter for a property that says if the user actually did set the analyze_exported_interfaces_only() property. If not, it means the default behaviour prevails. More... | |
Static Public Member Functions | |
static string & | get_variadic_parameter_type_name () |
Getter of the name of the variadic parameter type. More... | |
Public Attributes | |
std::unique_ptr< priv > | priv_ |
Friends | |
class | class_decl |
class | class_or_union |
class | function_type |
void | keep_type_alive (type_base_sptr) |
Make sure that the life time of a given (smart pointer to a) type is the same as the life time of the libabigail library. More... | |
This is an abstraction of the set of resources necessary to manage several aspects of the internal representations of the Abigail library.
An environment can be seen as the boundaries in which all related Abigail artifacts live. So before doing anything using this library, the first thing to create is, well, you know it now, an environment.
Note that the lifetime of environment objects must be longer than the lifetime of any other type in the Abigail system. So a given instance of environment must stay around as long as you are using libabigail. It's only when you are done using the library that you can de-allocate the environment instance.
typedef std::unordered_map<string, std::vector<type_base_sptr> > canonical_types_map_type |
environment | ( | ) |
Default constructor of the environment type.
|
virtual |
Destructor for the environment type.
bool analyze_exported_interfaces_only | ( | ) | const |
Getter for the property that controls if we are to restrict the analysis to the types that are only reachable from the exported interfaces only, or if the set of types should be more broad than that. Typically, we'd restrict the analysis to types reachable from exported interfaces only (stricto sensu, that would really be only the types that are part of the ABI of well designed libraries) for performance reasons.
f | the value of the flag. |
void analyze_exported_interfaces_only | ( | bool | f | ) |
Setter for the property that controls if we are to restrict the analysis to the types that are only reachable from the exported interfaces only, or if the set of types should be more broad than that. Typically, we'd restrict the analysis to types reachable from exported interfaces only (stricto sensu, that would really be only the types that are part of the ABI of well designed libraries) for performance reasons.
f | the value of the flag. |
bool canonicalization_is_done | ( | ) | const |
void canonicalization_is_done | ( | bool | f | ) |
Set a flag saying if the canonicalization of types created out of the current environment is done or not.
Note that this function must only be called by internal code of the library that creates ABI artifacts (e.g, read an abi corpus from elf or from our own xml format and creates representations of types out of it) and thus needs to canonicalize types to speed-up further type comparison.
f | the new value of the flag. |
bool decl_only_class_equals_definition | ( | ) | const |
Getter of the "decl-only-class-equals-definition" flag.
Usually, a declaration-only class named 'struct foo' compares equal to any class definition named "struct foo'. This is at least true for C++.
In C, though, because there can be multiple definitions of 'struct foo' in the binary, a declaration-only "struct foo" might be considered to *NOT* resolve to any of the struct foo defined. In that case, the declaration-only "struct foo" is considered different from the definitions.
This flag controls the behaviour of the comparison of an unresolved decl-only class against a definition of the same name.
If set to false, the the declaration equals the definition. If set to false, then the decalration is considered different from the declaration.
void decl_only_class_equals_definition | ( | bool | f | ) | const |
Setter of the "decl-only-class-equals-definition" flag.
Usually, a declaration-only class named 'struct foo' compares equal to any class definition named "struct foo'. This is at least true for C++.
In C, though, because there can be multiple definitions of 'struct foo' in the binary, a declaration-only "struct foo" might be considered to *NOT* resolve to any of the struct foo defined. In that case, the declaration-only "struct foo" is considered different from the definitions.
This flag controls the behaviour of the comparison of an unresolved decl-only class against a definition of the same name.
If set to false, the the declaration equals the definition. If set to false, then the decalration is considered different from the declaration.
the | new value of the "decl-only-class-equals-definition" flag. |
bool do_on_the_fly_canonicalization | ( | ) | const |
Getter for the "on-the-fly-canonicalization" flag.
void do_on_the_fly_canonicalization | ( | bool | f | ) |
Setter for the "on-the-fly-canonicalization" flag.
f | If this is true then on-the-fly-canonicalization is to be performed during comparison. |
type_base * get_canonical_type | ( | const char * | name, |
unsigned | index | ||
) |
Get a given canonical type which has a given "string representation".
'name',the | textual representation of the type as returned by type_or_decl_base::get_pretty_representation(/*internal=*/true, /*qualified=*/true). |
index,the | index of the type in the vector of types that all have the same textual representation 'name' . That vector is returned by the function environment::get_canonical_types(). |
name
, and which is at index index
in the vector of canonical types having that same textual representation. vector< type_base_sptr > * get_canonical_types | ( | const char * | name | ) |
Get the vector of canonical types which have a given "string representation".
'name',the | textual representation of the type as returned by type_or_decl_base::get_pretty_representation(/*internal=*/true, /*qualified=*/true) |
This is useful to for debugging purposes as it's handy to use from inside a debugger like GDB.
name
, or nullptr if no type with that representation exists. environment::canonical_types_map_type & get_canonical_types_map | ( | ) |
const environment::canonical_types_map_type & get_canonical_types_map | ( | ) | const |
const config & get_config | ( | ) | const |
const type_base_sptr & get_variadic_parameter_type | ( | ) | const |
Get a type_decl instance that represents a the type of a variadic function parameter. This node must be the only one representing a variadic parameter type in the system.
Note that upon first use of this IR node (by the relevant front-end, for instance) it must be added to a scope using e.g, the add_decl_to_scope() function.
|
static |
const type_base_sptr & get_void_pointer_type | ( | ) | const |
Getter of the "pointer-to-void" IR node that is shared across the ABI corpus. This node must be the only one representing a void pointer type in the system.
Note that upon first use of this IR node (by the relevant front-end, for instance) it must be added to a scope using e.g, the add_decl_to_scope() function.
const type_base_sptr & get_void_type | ( | ) | const |
Get the unique type_decl that represents a "void" type for the current environment. This node must be the only one representing a void type in the system.
Note that upon first use of this IR node (by the relevant front-end, for instance) it must be added to a scope using e.g, the add_decl_to_scope() function.
interned_string intern | ( | const string & | s | ) | const |
Do intern a string.
If a value of this string already exists in the interned string pool of the current environment, then this function returns a new interned_string pointing to that already existing string. Otherwise, a new string is created, stored in the interned string pool and a new interned_string instance is created to point to that new intrerned string, and it's return.
s | the value of the string to intern. |
bool is_variadic_parameter_type | ( | const type_base * | t | ) | const |
bool is_variadic_parameter_type | ( | const type_base_sptr & | t | ) | const |
bool is_void_pointer_type | ( | const type_base * | t | ) | const |
Test if a given type is the same as the void pointer type of the environment.
t | the IR type to test. |
t
is the void pointer returned by environment::get_void_pointer_type(). bool is_void_pointer_type | ( | const type_base_sptr & | t | ) | const |
Test if a given type is the same as the void pointer type of the environment.
t | the IR type to test. |
t
is the void pointer returned by environment::get_void_pointer_type(). bool is_void_type | ( | const type_base * | t | ) | const |
bool is_void_type | ( | const type_base_sptr & | t | ) | const |
bool user_set_analyze_exported_interfaces_only | ( | ) | const |
Getter for a property that says if the user actually did set the analyze_exported_interfaces_only() property. If not, it means the default behaviour prevails.
|
friend |