15#include <unordered_map>
18#include "abg-internal.h"
21ABG_BEGIN_EXPORT_DECLARATIONS
31ABG_END_EXPORT_DECLARATIONS
43using std::ostringstream;
44using std::unordered_map;
76corpus::exported_decls_builder
85 : priv_(new
priv(fns, vars,
87 vars_suppress_regexps,
90 sym_id_of_fns_to_keep,
91 sym_id_of_vars_to_keep))
124std::unordered_set<function_decl*>*
127 std::unordered_set<function_decl*> *fns_for_id =
128 priv_->fn_id_is_in_id_fns_map(fn);
129 if (fns_for_id && fns_for_id->size() > 1)
142{
return priv_->vars_;}
151{
return priv_->vars_;}
164 const string& fn_id = priv_->get_id(*fn);
167 if (priv_->fn_is_in_id_fns_map(fn))
170 if (priv_->keep_wrt_id_of_fns_to_keep(fn)
171 && priv_->keep_wrt_regex_of_fns_to_suppress(fn)
172 && priv_->keep_wrt_regex_of_fns_to_keep(fn))
173 priv_->add_fn_to_exported(fn);
190 if (priv_->var_id_is_in_id_var_map(var_id))
193 if (priv_->keep_wrt_id_of_vars_to_keep(var)
194 && priv_->keep_wrt_regex_of_vars_to_suppress(var)
195 && priv_->keep_wrt_regex_of_vars_to_keep(var))
196 priv_->add_var_to_exported(var);
213typedef unordered_map<
const var_decl*,
239 string first_name, second_name;
241 if (first_name.empty())
246 if (second_name.empty())
250 return first_name < second_name;
273 string first_name, second_name;
275 if (first_name.empty())
283 if (second_name.empty())
286 if (second_name.empty())
294 return first_name < second_name;
301struct comp_elf_symbols_functor
304 operator()(
const elf_symbol& l,
305 const elf_symbol& r)
const
306 {
return l.get_id_string() < r.get_id_string();}
311 {
return operator()(*l, *r);}
337 if (!sorted_fun_symbols)
341 auto filter = symtab_->make_filter();
342 filter.set_functions();
343 sorted_fun_symbols =
elf_symbols(symtab_->begin(filter),
349 return *sorted_fun_symbols;
366 (*fun_symbol_map)[symbol->get_name()].push_back(symbol);
368 return *fun_symbol_map;
379 if (!sorted_undefined_fun_symbols)
383 auto filter = symtab_->make_filter();
384 filter.set_functions();
385 filter.set_undefined_symbols();
386 filter.set_public_symbols(
false);
388 sorted_undefined_fun_symbols =
389 elf_symbols(symtab_->begin(filter), symtab_->end());
394 return *sorted_undefined_fun_symbols;
407 if (!undefined_fun_symbol_map)
411 (*undefined_fun_symbol_map)[symbol->get_name()].push_back(symbol);
413 return *undefined_fun_symbol_map;
429 if (!unrefed_fun_symbols)
434 unordered_map<string, bool> refed_funs;
436 for (
const auto& function : fns)
439 refed_funs[sym->get_id_string()] =
true;
441 a && !a->is_main_symbol(); a = a->get_next_alias())
442 refed_funs[a->get_id_string()] =
true;
445 auto filter = symtab_->make_filter();
446 filter.set_functions();
447 for (
const auto& symbol :
450 const std::string sym_id = symbol->get_id_string();
451 if (refed_funs.find(sym_id) == refed_funs.end())
453 bool keep = sym_id_fns_to_keep.empty();
454 for (
const auto&
id : sym_id_fns_to_keep)
463 unrefed_fun_symbols->push_back(symbol);
468 return *unrefed_fun_symbols;
481 if (!sorted_var_symbols)
485 auto filter = symtab_->make_filter();
486 filter.set_variables();
488 sorted_var_symbols =
elf_symbols(symtab_->begin(filter),
494 return *sorted_var_symbols;
511 (*var_symbol_map)[symbol->get_name()].push_back(symbol);
513 return *var_symbol_map;
524 if (!sorted_undefined_var_symbols)
528 auto filter = symtab_->make_filter();
529 filter.set_variables();
530 filter.set_undefined_symbols();
531 filter.set_public_symbols(
false);
533 sorted_undefined_var_symbols =
534 elf_symbols(symtab_->begin(filter), symtab_->end());
539 return *sorted_undefined_var_symbols;
552 if (!undefined_var_symbol_map)
556 (*undefined_var_symbol_map)[symbol->get_name()].push_back(symbol);
558 return *undefined_var_symbol_map;
574 if (!unrefed_var_symbols)
579 unordered_map<string, bool> refed_vars;
580 for (
const auto& variable : vars)
583 refed_vars[sym->get_id_string()] =
true;
585 a && !a->is_main_symbol(); a = a->get_next_alias())
586 refed_vars[a->get_id_string()] =
true;
589 auto filter = symtab_->make_filter();
590 filter.set_variables();
591 for (
const auto& symbol :
594 const std::string sym_id = symbol->get_id_string();
595 if (refed_vars.find(sym_id) == refed_vars.end())
597 bool keep = sym_id_vars_to_keep.empty();
598 for (
const auto&
id : sym_id_vars_to_keep)
607 unrefed_var_symbols->push_back(symbol);
612 return *unrefed_var_symbols;
621unordered_set<interned_string, hash_interned_string>*
625 return group->get_public_types_pretty_representations();
627 if (pub_type_pretty_reprs_ == 0)
628 pub_type_pretty_reprs_ =
629 new unordered_set<interned_string, hash_interned_string>;
630 return pub_type_pretty_reprs_;
647std::unordered_set<function_decl*>*
653 auto i = b->priv_->id_fns_map_.find(
id);
654 if (i == b->priv_->id_fns_map_.end())
664 delete pub_type_pretty_reprs_;
674 priv_.reset(
new priv(path, env));
675 init_format_version();
678corpus::~corpus() =
default;
692{
return priv_->do_log;}
713 if (!tu->get_absolute_path().empty())
716 string_tu_map_type::const_iterator i =
717 priv_->path_tu_map.find(tu->get_absolute_path());
719 priv_->path_tu_map[tu->get_absolute_path()] = tu;
722 tu->set_corpus(
this);
730{
return priv_->members;}
741 string_tu_map_type::const_iterator i =
742 priv_->path_tu_map.find(path);
744 if (i == priv_->path_tu_map.end())
755{priv_->members.clear();}
762{
return priv_->types_;}
770{
return priv_->types_;}
783{
return priv_->type_per_loc_map_;}
794 return (priv_->get_public_types_pretty_representations()
795 && !priv_->get_public_types_pretty_representations()->empty());
807 priv_->get_public_types_pretty_representations()->insert(s);
826 return (priv_->get_public_types_pretty_representations()->find(s)
827 != priv_->get_public_types_pretty_representations()->end());
840const vector<type_base_wptr>&
843 if (priv_->types_not_reachable_from_pub_ifaces_.empty())
846 for (vector<type_base_wptr>::const_iterator it =
851 type_base_sptr t(*it);
853 priv_->types_not_reachable_from_pub_ifaces_.push_back(t);
857 return priv_->types_not_reachable_from_pub_ifaces_;
871{
return priv_->type_per_loc_map_;}
879{
return priv_->group;}
887{
return priv_->group;}
902corpus::init_format_version()
905 (priv_->env.get_config().get_format_major_version_number());
907 (priv_->env.get_config().get_format_minor_version_number());
915{
return priv_->origin_;}
930{
return priv_->format_major_version_number_;}
938{priv_->format_major_version_number_ = maj;}
947{
return priv_->format_minor_version_number_;}
956{priv_->format_minor_version_number_ = min;}
991{
return priv_->needed;}
1003{priv_->needed = needed;}
1014{
return priv_->soname;}
1025{priv_->soname = soname;}
1036{
return priv_->architecture_name;}
1047{priv_->architecture_name = arch;}
1061 bool members_empty =
true;
1062 for (translation_units::const_iterator i = priv_->members.begin(),
1063 e = priv_->members.end();
1066 if (!(*i)->is_empty())
1068 members_empty =
false;
1072 return (members_empty
1074 && priv_->soname.empty()
1075 && priv_->needed.empty()
1076 && priv_->architecture_name.empty()
1088 translation_units::const_iterator i, j;
1106{priv_->symtab_ = symtab;}
1113{
return priv_->symtab_;}
1120{
return priv_->get_fun_symbol_map();}
1130{
return priv_->get_undefined_fun_symbol_map();}
1141{
return priv_->get_sorted_fun_symbols();}
1150{
return priv_->get_sorted_undefined_fun_symbols();}
1161{
return priv_->get_sorted_var_symbols();}
1170{
return priv_->get_sorted_undefined_var_symbols();}
1177{
return priv_->get_var_symbol_map();}
1187{
return priv_->get_undefined_var_symbol_map();}
1200 string_elf_symbols_map_type::const_iterator it =
1204 return it->second[0];
1220 const vector<elf_symbol_sptr>& symbols)
1222 if (version.is_empty())
1227 for (elf_symbols::const_iterator s = symbols.begin();
1230 if ((*s)->get_version().is_empty())
1234 for (elf_symbols::const_iterator s = symbols.begin();
1237 if ((*s)->get_version().is_default())
1242 for (elf_symbols::const_iterator s = symbols.begin();
1245 if ((*s)->get_version().str() == version.
str())
1267 string_elf_symbols_map_type::const_iterator it =
1272 return find_symbol_by_version(version, it->second);
1296 string_elf_symbols_map_type::const_iterator it =
1300 return it->second[0];
1318 string_elf_symbols_map_type::const_iterator it =
1323 return find_symbol_by_version(version, it->second);
1368const std::unordered_set<function_decl*>*
1370{
return priv_->lookup_functions(
id);}
1372const std::unordered_set<function_decl*>*
1390 std::sort(priv_->fns.begin(), priv_->fns.end(), fc);
1410{
return priv_->vars;}
1420 std::sort(priv_->vars.begin(), priv_->vars.end(), vc);
1434{
return priv_->get_unreferenced_function_symbols();}
1447{
return priv_->get_unreferenced_variable_symbols();}
1456{
return priv_->regex_patterns_fns_to_suppress;}
1463const vector<string>&
1465{
return priv_->regex_patterns_fns_to_suppress;}
1474{
return priv_->regex_patterns_vars_to_suppress;}
1481const vector<string>&
1483{
return priv_->regex_patterns_vars_to_suppress;}
1493{
return priv_->regex_patterns_fns_to_keep;}
1501const vector<string>&
1503{
return priv_->regex_patterns_fns_to_keep;}
1513{
return priv_->sym_id_fns_to_keep;}
1521const vector<string>&
1523{
return priv_->sym_id_fns_to_keep;}
1533{
return priv_->regex_patterns_vars_to_keep;}
1541const vector<string>&
1543{
return priv_->regex_patterns_vars_to_keep;}
1553{
return priv_->sym_id_vars_to_keep;}
1561const vector<string>&
1563{
return priv_->sym_id_vars_to_keep;}
1571 string sym_name, sym_version;
1575 for (
auto f = priv_->fns.begin(); f != priv_->fns.end(); ++f)
1577 if (b->priv_->keep_wrt_id_of_fns_to_keep(*f)
1578 && b->priv_->keep_wrt_regex_of_fns_to_suppress(*f)
1579 && b->priv_->keep_wrt_regex_of_fns_to_keep(*f))
1580 fns_to_keep.push_back(*f);
1582 priv_->fns = fns_to_keep;
1585 for (
auto v = priv_->vars.begin(); v != priv_->vars.end(); ++v)
1587 if (b->priv_->keep_wrt_id_of_vars_to_keep(*v)
1588 && b->priv_->keep_wrt_regex_of_vars_to_suppress(*v)
1589 && b->priv_->keep_wrt_regex_of_vars_to_keep(*v))
1590 vars_to_keep.push_back(*v);
1592 priv_->vars = vars_to_keep;
1608 if (!priv_->exported_decls_builder)
1610 priv_->exported_decls_builder.reset
1613 priv_->regex_patterns_fns_to_suppress,
1614 priv_->regex_patterns_vars_to_suppress,
1615 priv_->regex_patterns_fns_to_keep,
1616 priv_->regex_patterns_vars_to_keep,
1617 priv_->sym_id_fns_to_keep,
1618 priv_->sym_id_vars_to_keep));
1620 return priv_->exported_decls_builder;
1684struct corpus_group::priv
1686 std::set<string> corpora_paths;
1687 corpora_type corpora;
1688 istring_function_decl_ptr_map_type fns_map;
1690 istring_var_decl_ptr_map_type vars_map;
1696 unordered_map<string, elf_symbol_sptr> unrefed_fun_symbol_map;
1698 bool unrefed_fun_symbols_built;
1699 unordered_map<string, elf_symbol_sptr> unrefed_var_symbol_map;
1701 bool unrefed_var_symbols_built;
1702 unordered_set<interned_string, hash_interned_string> pub_type_pretty_reprs_;
1705 : unrefed_fun_symbols_built(),
1706 unrefed_var_symbols_built()
1716 for (elf_symbols::const_iterator e =
1717 syms.begin(); e != syms.end(); ++e)
1719 string sym_id = (*e)->get_id_string();
1720 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1721 unrefed_fun_symbol_map.find(sym_id);
1722 if (j != unrefed_fun_symbol_map.end())
1725 unrefed_fun_symbol_map[sym_id] = *e;
1726 unrefed_fun_symbols.push_back(*e);
1728 unrefed_fun_symbols_built =
true;
1738 for (elf_symbols::const_iterator e =
1739 syms.begin(); e != syms.end(); ++e)
1741 string sym_id = (*e)->get_id_string();
1742 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1743 unrefed_var_symbol_map.find(sym_id);
1744 if (j != unrefed_var_symbol_map.end())
1747 unrefed_var_symbol_map[sym_id] = *e;
1748 unrefed_var_symbols.push_back(*e);
1750 unrefed_var_symbols_built =
true;
1759corpus_group::corpus_group(
const environment& env,
const string& path =
"")
1760 :
corpus(env, path), priv_(new priv)
1776 if (!corp->get_path().empty()
1782 corp_arch = corp->get_architecture_name();
1783 if (cur_arch.empty())
1785 else if (cur_arch != corp_arch)
1787 std::cerr <<
"corpus '" << corp->get_path() <<
"'"
1788 <<
" has architecture '" << corp_arch <<
"'"
1789 <<
" but expected '" << cur_arch <<
"'\n";
1793 priv_->corpora.push_back(corp);
1794 corp->set_group(
this);
1795 priv_->corpora_paths.insert(corp->get_path());
1812 if (priv_->corpora_paths.find(path) != priv_->corpora_paths.end())
1821const corpus_group::corpora_type&
1823{
return priv_->corpora;}
1840 return corpus_sptr();
1862 if (priv_->fns.empty())
1863 for (corpora_type::const_iterator i =
get_corpora().begin();
1868 for (corpus::functions::const_iterator f = c->get_functions().begin();
1869 f != c->get_functions().end();
1873 istring_function_decl_ptr_map_type::const_iterator j =
1874 priv_->fns_map.find(fid);
1876 if (j != priv_->fns_map.end())
1880 priv_->fns_map[fid] = *f;
1882 priv_->fns.push_back(*f);
1900 if (priv_->vars.empty())
1901 for (corpora_type::const_iterator i =
get_corpora().begin();
1906 for (corpus::variables::const_iterator v = c->get_variables().begin();
1907 v != c->get_variables().end();
1911 istring_var_decl_ptr_map_type::const_iterator j =
1912 priv_->vars_map.find(vid);
1914 if (j != priv_->vars_map.end())
1918 priv_->vars_map[vid] = *v;
1920 priv_->vars.push_back(*v);
1934 if (priv_->var_symbol_map.empty())
1935 for (corpora_type::const_iterator i =
get_corpora().begin();
1938 priv_->var_symbol_map.insert((*i)->get_var_symbol_map().begin(),
1939 (*i)->get_var_symbol_map().end());
1941 return priv_->var_symbol_map;
1951 if (priv_->fun_symbol_map.empty())
1952 for (corpora_type::const_iterator i =
get_corpora().begin();
1955 priv_->fun_symbol_map.insert((*i)->get_fun_symbol_map().begin(),
1956 (*i)->get_fun_symbol_map().end());
1958 return priv_->fun_symbol_map;
1968 if (priv_->sorted_fun_symbols.empty()
1971 for (corpora_type::const_iterator i =
get_corpora().begin();
1976 for (string_elf_symbols_map_type::const_iterator j =
1977 c->get_fun_symbol_map().begin();
1978 j != c->get_fun_symbol_map().begin();
1980 priv_->sorted_fun_symbols.insert(priv_->sorted_fun_symbols.end(),
1984 comp_elf_symbols_functor comp;
1985 std::sort(priv_->sorted_fun_symbols.begin(),
1986 priv_->sorted_fun_symbols.end(),
1990 return priv_->sorted_fun_symbols;
2000 if (priv_->sorted_var_symbols.empty()
2003 for (corpora_type::const_iterator i =
get_corpora().begin();
2008 for (string_elf_symbols_map_type::const_iterator j =
2009 c->get_var_symbol_map().begin();
2010 j != c->get_var_symbol_map().begin();
2012 priv_->sorted_var_symbols.insert(priv_->sorted_var_symbols.end(),
2016 comp_elf_symbols_functor comp;
2017 std::sort(priv_->sorted_var_symbols.begin(),
2018 priv_->sorted_var_symbols.end(),
2022 return priv_->sorted_var_symbols;
2039 if (!priv_->unrefed_fun_symbols_built)
2040 if (priv_->unrefed_fun_symbols.empty())
2042 for (corpora_type::const_iterator i =
get_corpora().begin();
2047 for (elf_symbols::const_iterator e =
2048 c->get_unreferenced_function_symbols().begin();
2049 e != c->get_unreferenced_function_symbols().end();
2052 string sym_id = (*e)->get_id_string();
2053 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2054 priv_->unrefed_fun_symbol_map.find(sym_id);
2055 if (j != priv_->unrefed_fun_symbol_map.end())
2058 priv_->unrefed_fun_symbol_map[sym_id] = *e;
2059 priv_->unrefed_fun_symbols.push_back(*e);
2062 priv_->unrefed_fun_symbols_built =
true;
2065 return priv_->unrefed_fun_symbols;
2082 if (!priv_->unrefed_var_symbols_built)
2083 if (priv_->unrefed_var_symbols.empty())
2085 for (corpora_type::const_iterator i =
get_corpora().begin();
2090 for (elf_symbols::const_iterator e =
2091 c->get_unreferenced_variable_symbols().begin();
2092 e != c->get_unreferenced_variable_symbols().end();
2095 string sym_id = (*e)->get_id_string();
2096 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2097 priv_->unrefed_var_symbol_map.find(sym_id);
2098 if (j != priv_->unrefed_var_symbol_map.end())
2101 priv_->unrefed_var_symbol_map[sym_id] = *e;
2102 priv_->unrefed_var_symbols.push_back(*e);
2105 priv_->unrefed_var_symbols_built =
true;
2108 return priv_->unrefed_var_symbols;
2113unordered_set<interned_string, hash_interned_string>*
2115{
return &priv_->pub_type_pretty_reprs_;}
The private data and functions of the abigail::ir::corpus type.
std::shared_ptr< symtab > symtab_sptr
Convenience typedef for a shared pointer to a symtab.
#define ABG_ASSERT(cond)
This is a wrapper around the 'assert' glibc call. It allows for its argument to have side effects,...
This contains the private implementation of the suppression engine of libabigail.
Types of the main internal representation of libabigail.
This file contains the declarations of the entry points to de-serialize an instance of abigail::trans...
Utilities to ease the wrapping of C types into std::shared_ptr.
This contains the declarations for the symtab reader.
This file contains the declarations of the entry points to de-serialize an instance of abigail::trans...
The abstraction of an interned string.
bool empty() const
Test if the current instance of interned_string is empty.
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...
void maybe_add_fn_to_exported_fns(function_decl *)
Consider at all the tunables that control wether a function should be added to the set of exported fu...
std::unordered_set< 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.
void maybe_add_var_to_exported_vars(const var_decl *)
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.
unordered_set< interned_string, hash_interned_string > * get_public_types_pretty_representations()
Getter of a pointer to the set of types reachable from public interfaces of a given 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 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 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 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.
vector< const var_decl * > variables
Convenience typedef for std::vector<abigail::ir::var_decl*>
const vector< type_base_wptr > & get_types_not_reachable_from_public_interfaces() const
Getter of a sorted vector of the types that are *NOT* reachable from public interfaces.
void record_type_as_reachable_from_public_interfaces(const type_base &)
Record a type as being reachable from public interfaces (global functions and variables).
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.
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 elf_symbol_sptr lookup_variable_symbol(const string &n) const
Look in the variable symbols map for a symbol with a given name.
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.
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.
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 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.
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>.
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.
const std::unordered_set< function_decl * > * lookup_functions(const interned_string &id) const
Lookup the function which has a given function ID.
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.
const interned_string & get_name() const
Getter for the name of the current decl.
const interned_string & get_linkage_name() const
Getter for the mangled name.
bool get_is_in_public_symbol_table() const
Test if the decl is defined in a ELF symbol table as a public symbol.
The abstraction of the version of an ELF symbol.
const string & str() const
Getter for the version name.
Abstraction of an elf symbol.
const string & get_name() const
Getter for the name of the elf_symbol.
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
interned_string intern(const string &) const
Do intern a string.
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.
const vector< type_base_wptr > & get_types_sorted_by_name() const
Getter of all types types sorted by their pretty representation.
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
Abstracts a variable declaration.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build and return the pretty representation of this variable.
Helper class to allow range-for loops on symtabs for C++11 and later code. It serves as a proxy for t...
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.
string get_pretty_representation(const type_or_decl_base *tod, bool internal)
Build and return a copy of the pretty representation of an ABI artifact that could be either a type o...
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
unordered_map< string, const function_decl * > str_fn_ptr_map_type
Convenience typedef for a hash map of string and pointer to function_decl.
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
unordered_map< const function_decl *, bool, function_decl::hash, function_decl::ptr_equal > fn_ptr_map_type
Convenience typedef for a hash map of pointer to function_decl and boolean.
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.
unordered_map< const var_decl *, bool, var_decl::hash, var_decl::ptr_equal > var_ptr_map_type
Convenience typedef for a hash map of pointer to var_decl and boolean.
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.
std::shared_ptr< regex_t > regex_t_sptr
A convenience typedef for a shared pointer of regex_t.
Toplevel namespace for libabigail.
A functor to compare instances of var_decl base on their qualified names.
The private data of the corpus type.
const elf_symbols & get_sorted_var_symbols() const
Getter for the sorted vector of variable symbols for this corpus.
const string_elf_symbols_map_type & get_undefined_var_symbol_map() const
Return a map from name to undefined variable symbol for this corpus.
unordered_set< interned_string, hash_interned_string > * get_public_types_pretty_representations()
Getter of the set of pretty representation of types that are reachable from public interfaces (global...
const string_elf_symbols_map_type & get_var_symbol_map() const
Return a map from name to variable symbol for this corpus.
const elf_symbols & get_sorted_fun_symbols() const
Return a sorted vector of function symbols for this corpus.
type_maps & get_types()
Get the maps that associate a name to a certain kind of type.
const elf_symbols & get_sorted_undefined_fun_symbols() const
Getter for a sorted vector of the function symbols undefined in this corpus.
const string_elf_symbols_map_type & get_undefined_fun_symbol_map() const
Return a map from name to undefined function symbol for this corpus.
const string_elf_symbols_map_type & get_fun_symbol_map() const
Return a map from name to function symbol for this corpus.
const elf_symbols & get_unreferenced_function_symbols() const
Return a list of symbols that are not referenced by any function of corpus::get_functions().
const elf_symbols & get_unreferenced_variable_symbols() const
Return a list of symbols that are not referenced by any variable of corpus::get_variables().
const elf_symbols & get_sorted_undefined_var_symbols() const
Getter for a sorted vector of the variable symbols undefined in this corpus.
std::unordered_set< function_decl * > * lookup_functions(const interned_string &id)
Lookup the function which has a given function ID.
~priv()
Destructor of the corpus::priv type.
A hashing functor fo instances and pointers of function_decl.
Equality functor for instances of function_decl.
A hashing functor for instances and pointers of var_decl.
A comparison functor for pointers to var_decl.