8#ifndef __ABG_CORPUS_H__
9#define __ABG_CORPUS_H__
21template<
typename DeclType>
37 if (!f || !f->get_type())
45template<
typename DeclType>
74typedef unordered_set<
const var_decl*,
122 ARTIFICIAL_ORIGIN = 0,
123 NATIVE_XML_ORIGIN = 1,
125 DWARF_ORIGIN = 1 << 2,
128 LINUX_KERNEL_BINARY_ORIGIN = 1 << 5
135 void init_format_version();
139 std::unique_ptr<priv> priv_;
178 void mark_non_reachable_types();
187 remove_type_from_reachable_types(
const type_base&);
196 get_sorted_types_not_reachable_from_public_interfaces()
const;
228 const vector<string>&
308 virtual const std::unordered_set<const function_decl*>*
311 virtual const std::unordered_set<const function_decl*>*
314 virtual const std::unordered_set<const function_decl*>*
317 virtual const std::unordered_set<var_decl_sptr>*
320 virtual const std::unordered_set<var_decl_sptr>*
365 const vector<string>&
371 const vector<string>&
377 const vector<string>&
383 const vector<string>&
389 const vector<string>&
395 const vector<string>&
433 std::unique_ptr<priv> priv_;
450 std::unordered_set<const function_decl*>*
472 std::unique_ptr<priv> priv_;
478 typedef vector<corpus_sptr> corpora_type;
527 virtual const std::unordered_set<const function_decl*>*
530 virtual const std::unordered_set<const function_decl*>*
533 virtual const std::unordered_set<var_decl_sptr>*
536 virtual const std::unordered_set<var_decl_sptr>*
547dumptypes(
const vector<type_base_wptr>& types,
548 const char* output_file,
const corpus&,
549 bool emit_location =
false);
std::shared_ptr< symtab > symtab_sptr
Convenience typedef for a shared pointer to a symtab.
Types of the main internal representation of libabigail.
The abstraction of an interned string.
The type of the private data of corpus::exported_decls_builder type.
Abstracts the building of the set of exported variables and functions.
const functions & exported_functions() const
Getter for the reference to the vector of exported functions. This vector is shared with with the cor...
std::unordered_set< const function_decl * > * fn_id_maps_to_several_fns(const function_decl *)
Test if a given function ID maps to several functions in the same corpus.
bool maybe_add_fn_to_exported_fns(function_decl *, bool do_update=false)
Consider at all the tunables that control wether a function should be added to the set of exported fu...
bool maybe_add_var_to_exported_vars(const var_decl_sptr &)
Consider at all the tunables that control wether a variable should be added to the set of exported va...
const variables & exported_variables() const
Getter for the reference to the vector of exported variables. This vector is shared with with the cor...
Abstraction of a group of corpora.
virtual const elf_symbols & get_sorted_var_symbols() const
Get a sorted vector of the symbols of the variables exported by the corpora of the current group.
bool has_corpus(const string &)
Test if a corpus of a given path has been added to the group.
const corpora_type & get_corpora() const
Getter of the vector of corpora held by the current corpus_group.
virtual const string_elf_symbols_map_type & get_var_symbol_map() const
Get the symbols of the global variables exported by the corpora of the current corpus_group.
virtual const elf_symbols & get_sorted_fun_symbols() const
Get a sorted vector of the symbols of the functions exported by the corpora of the current group.
virtual const std::unordered_set< const function_decl * > * lookup_functions(const interned_string &id) const
Lookup the function which has a given function ID.
virtual bool is_empty() const
Test if the current corpus group is empty.
virtual const string_elf_symbols_map_type & get_fun_symbol_map() const
Get the symbols of the global functions exported by the corpora of the current corpus_group.
const corpus_sptr get_main_corpus() const
Getter of the first corpus added to this Group.
virtual const elf_symbols & get_unreferenced_function_symbols() const
Get the set of function symbols not referenced by any debug info, from all the corpora of the current...
virtual const elf_symbols & get_unreferenced_variable_symbols() const
Get the set of variable symbols not referenced by any debug info, from all the corpora of the current...
virtual const std::unordered_set< var_decl_sptr > * lookup_variables(const interned_string &id) const
Lookup the exported variables which all have a given variable ID.
virtual const corpus::variables & get_variables() const
Get the global variables exported by the corpora of the current corpus group.
virtual ~corpus_group()
Desctructor of the corpus_group type.
void add_corpus(const corpus_sptr &)
Add a new corpus to the current instance of corpus_group.
virtual const corpus::functions & get_functions() const
Get the functions exported by the corpora of the current corpus group.
This is the abstraction of a set of translation units (themselves seen as bundles of unitary abi arte...
virtual const elf_symbols & get_sorted_var_symbols() const
Getter for the sorted vector of variable symbols for this corpus.
const elf_symbol_sptr lookup_function_symbol(const string &n) const
Look in the function symbols map for a symbol with a given name.
origin
This abstracts where the corpus comes from. That is, either it has been read from the native xml form...
void sort_functions()
Sort the set of functions exported by this corpus.
void set_soname(const string &)
Setter for the soname property of the corpus.
const functions_set & get_undefined_functions() const
Getter of the undefined functions of the corpus.
const vector< string > & get_needed() const
Getter of the needed property of the corpus.
exported_decls_builder_sptr get_exported_decls_builder() const
Getter for the object that is responsible for determining what decls ought to be in the set of export...
void maybe_drop_some_exported_decls()
After the set of exported functions and variables have been built, consider all the tunables that con...
const string_elf_symbols_map_type & get_undefined_var_symbol_map() const
Getter for the map of variable symbols that are undefined in this corpus.
void add(const translation_unit_sptr &)
Add a translation unit to the current ABI Corpus.
std::unordered_set< const function_decl * > functions_set
Convenience typedef for std::unordered_set<const function_decl*>
virtual const string_elf_symbols_map_type & get_var_symbol_map() const
Getter for the variable symbols map.
shared_ptr< exported_decls_builder > exported_decls_builder_sptr
Convenience typedef for shared_ptr<exported_decls_builder>.
const variables & get_sorted_undefined_variables() const
Getter of the sorted vector of undefined variables of the corpus.
const elf_symbol_sptr lookup_variable_symbol(const string &n) const
Look in the variable symbols map for a symbol with a given name.
vector< var_decl_sptr > variables
Convenience typedef for std::vector<abigail::ir::var_decl*>
virtual const elf_symbols & get_sorted_fun_symbols() const
Return a sorted vector of function symbols for this corpus.
const string & get_soname()
Getter for the soname property of the corpus.
const translation_units & get_translation_units() const
Return the list of translation units of the current corpus.
const symtab_reader::symtab_sptr & get_symtab() const
Getter for the symtab object.
virtual const std::unordered_set< const function_decl * > * lookup_functions(const interned_string &id) const
Lookup the function which has a given function ID.
const variables_set & get_undefined_variables() const
Getter of the undefined variables of the corpus.
origin get_origin() const
Getter for the origin of the corpus.
virtual bool is_empty() const
Tests if the corpus is empty from an ABI surface perspective. I.e. if all of these criteria are true:
type_maps & get_types()
Get the maps that associate a name to a certain kind of type.
vector< string > & get_sym_ids_of_vars_to_keep()
Getter for the vector of variable symbol IDs to keep.
bool do_log() const
Test if logging was requested.
const translation_unit_sptr find_translation_unit(const string &path) const
Find the translation unit that has a given path.
const elf_symbols & get_sorted_undefined_fun_symbols() const
Getter for a sorted vector of the function symbols undefined in this corpus.
string & get_path() const
Get the file path associated to the corpus file.
const string_elf_symbols_map_type & get_undefined_fun_symbol_map() const
Getter for the map of function symbols that are undefined in this corpus.
void set_origin(origin)
Setter for the origin of the corpus.
virtual const string_elf_symbols_map_type & get_fun_symbol_map() const
Getter for the function symbols map.
bool operator==(const corpus &) const
Compare the current corpus against another one.
type_maps & get_type_per_loc_map()
Get the maps that associate a location string to a certain kind of type.
void drop_translation_units()
Erase the translation units contained in this in-memory object.
void sort_variables()
Sort the set of variables exported by this corpus.
vector< string > & get_regex_patterns_of_vars_to_keep()
Accessor for the regex patterns describing the variables to keep into the public decl table....
vector< string > & get_regex_patterns_of_vars_to_suppress()
Accessor for the regex patterns describing the variables to drop from the public decl table.
const corpus_group * get_group() const
Getter of the group this corpus is a member of.
vector< string > & get_regex_patterns_of_fns_to_suppress()
Accessor for the regex patterns describing the functions to drop from the public decl table.
const functions & get_sorted_undefined_functions() const
Getter of the sorted vector of undefined functions of the corpus.
const canonical_type_ptr_set_type & get_types_not_reachable_from_public_interfaces() const
Getter of a sorted vector of the types that are *NOT* reachable from public interfaces.
virtual const elf_symbols & get_unreferenced_function_symbols() const
Getter of the set of function symbols that are not referenced by any function exported by the current...
void set_path(const string &)
Set the file path associated to the corpus file.
virtual const elf_symbols & get_unreferenced_variable_symbols() const
Getter of the set of variable symbols that are not referenced by any variable exported by the current...
bool type_is_reachable_from_public_interfaces(const type_base &) const
Test if a type is reachable from public interfaces (global functions and variables).
virtual bool recording_types_reachable_from_public_interface_supported()
Test if the recording of reachable types (and thus, indirectly, the recording of non-reachable types)...
virtual const std::unordered_set< var_decl_sptr > * lookup_variables(const interned_string &id) const
Lookup the exported variables which all have a given variable ID.
virtual const variables & get_variables() const
Return the public decl table of the global variables of the current corpus.
const elf_symbols & get_sorted_undefined_var_symbols() const
Getter for a sorted vector of the variable symbols undefined in this corpus.
void set_needed(const vector< string > &)
Setter of the needed property of the corpus.
vector< string > & get_sym_ids_of_fns_to_keep()
Getter for the vector of function symbol IDs to keep.
vector< const function_decl * > functions
Convenience typedef for std::vector<abigail::ir::function_decl*>
void set_architecture_name(const string &)
Setter for the architecture name of the corpus.
bool record_type_as_reachable_from_public_interfaces(const type_base &)
Record a type as being reachable from public interfaces (global functions and variables).
void set_symtab(symtab_reader::symtab_sptr)
Setter for the symtab object.
void set_format_major_version_number(const string &)
Setter of the major version number of the abixml serialization format.
const string & get_architecture_name() const
Getter for the architecture name of the corpus.
vector< string > strings_type
A convenience typedef for std::vector<string>.
std::unordered_set< var_decl_sptr > variables_set
Convenience typedef for std::unordered_set<const var_decl*>.
const environment & get_environment() const
Getter of the enviroment of the corpus.
vector< string > & get_regex_patterns_of_fns_to_keep()
Accessor for the regex patterns describing the functions to keep into the public decl table....
void set_format_minor_version_number(const string &)
Setter of the minor version number of the abixml serialization format.
string & get_format_minor_version_number() const
Getter of the minor version number of the abixml serialization format.
virtual const functions & get_functions() const
Return the functions public decl table of the current corpus.
string & get_format_major_version_number() const
Getter of the major version number of the abixml serialization format.
The abstraction of the version of an ELF symbol.
Abstraction of an elf symbol.
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
Abstraction for a function declaration.
An abstraction helper for type declarations.
This is a type that aggregates maps of all the kinds of types that are supported by libabigail.
Abstracts a variable declaration.
unordered_set< const var_decl *, c11d_decl_hasher< var_decl >, c11d_decl_eq< var_decl > > vars_set_type
A set of hashed var decls. The hash value is the canonical type of the var. Note that the var types m...
corpus::origin operator|=(corpus::origin &l, corpus::origin r)
Bitwise |= operator for the corpus::origin type.
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
type_base_sptr get_exemplar_type(type_base_sptr type)
For a given type, return its exemplar type.
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
corpus_group_sptr is_corpus_group(const corpus_sptr &corpus)
Test if a corpus is a corpus_group.
bool type_is_reachable_from_public_interfaces(const type_base &t)
Test if a given type is reachable from public interfaces of either the ABI corpus it belongs to,...
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
std::map< interned_string, functions_set_type > istring_functions_set_omap_type
An ordered map that associates an interned string with a set of hashed function decls.
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
shared_ptr< translation_unit > translation_unit_sptr
Convenience typedef for a shared pointer on a translation_unit type.
vector< type_base * > type_base_ptrs_type
Helper typedef for a vector of pointer to type_base.
unordered_map< interned_string, functions_set_type, hash_interned_string > istring_functions_set_map_type
A map that associates an interned string with a set of hashed function decls.
std::set< translation_unit_sptr, shared_translation_unit_comp > translation_units
Convenience typedef for an ordered set of translation_unit_sptr.
corpus::origin operator&=(corpus::origin &l, corpus::origin r)
Bitwise &= operator for the corpus::origin type.
std::unordered_map< string, elf_symbols > string_elf_symbols_map_type
Convenience typedef for a map which key is a string and which value is a vector of elf_symbol.
unordered_set< const function_decl *, c11d_decl_hasher< function_decl >, c11d_decl_eq< function_decl > > functions_set_type
A set of hashed function decls. The hash value is the canonical type of the function....
unordered_set< type_base *, canonical_type_hash > canonical_type_ptr_set_type
Helper typedef for an unordered set of type_base* which uses pointer value to tell its members appart...
Toplevel namespace for libabigail.
A functor to hash instances of interned_string.
Functor to compare decls in hash maps or sets of decls with canonicalized types.
bool operator()(const DeclType *f, const DeclType *s) const
Comparison operator for decls with canonicalized types.
Hashing functor for canonicalized decl types.
size_t operator()(const DeclType *f) const
Hashing operator for decls that have canonicalized decl types.