15 #include <unordered_map>
17 #include "abg-internal.h"
20 ABG_BEGIN_EXPORT_DECLARATIONS
30 ABG_END_EXPORT_DECLARATIONS
42 using std::ostringstream;
43 using std::unordered_map;
75 corpus::exported_decls_builder
84 : priv_(new
priv(fns, vars,
86 vars_suppress_regexps,
89 sym_id_of_fns_to_keep,
90 sym_id_of_vars_to_keep))
101 {
return priv_->fns_;}
110 {
return priv_->fns_;}
123 std::unordered_set<function_decl*>*
126 std::unordered_set<function_decl*> *fns_for_id =
127 priv_->fn_id_is_in_id_fns_map(fn);
128 if (fns_for_id && fns_for_id->size() > 1)
141 {
return priv_->vars_;}
150 {
return priv_->vars_;}
163 const string& fn_id = priv_->get_id(*fn);
166 if (priv_->fn_is_in_id_fns_map(fn))
169 if (priv_->keep_wrt_id_of_fns_to_keep(fn)
170 && priv_->keep_wrt_regex_of_fns_to_suppress(fn)
171 && priv_->keep_wrt_regex_of_fns_to_keep(fn))
172 priv_->add_fn_to_exported(fn);
186 const string& var_id = priv_->get_id(*var);
189 if (priv_->var_id_is_in_id_var_map(var_id))
192 if (priv_->keep_wrt_id_of_vars_to_keep(var)
193 && priv_->keep_wrt_regex_of_vars_to_suppress(var)
194 && priv_->keep_wrt_regex_of_vars_to_keep(var))
195 priv_->add_var_to_exported(var);
212 typedef unordered_map<
const var_decl*,
238 string first_name, second_name;
240 if (first_name.empty())
245 if (second_name.empty())
249 return first_name < second_name;
272 string first_name, second_name;
274 if (first_name.empty())
282 if (second_name.empty())
285 if (second_name.empty())
293 return first_name < second_name;
300 struct comp_elf_symbols_functor
303 operator()(
const elf_symbol& l,
304 const elf_symbol& r)
const
305 {
return l.get_id_string() < r.get_id_string();}
310 {
return operator()(*l, *r);}
336 if (!sorted_fun_symbols)
340 auto filter = symtab_->make_filter();
341 filter.set_functions();
342 sorted_fun_symbols =
elf_symbols(symtab_->begin(filter),
348 return *sorted_fun_symbols;
365 (*fun_symbol_map)[symbol->get_name()].push_back(symbol);
367 return *fun_symbol_map;
378 if (!sorted_undefined_fun_symbols)
382 auto filter = symtab_->make_filter();
383 filter.set_functions();
384 filter.set_undefined_symbols();
385 filter.set_public_symbols(
false);
387 sorted_undefined_fun_symbols =
388 elf_symbols(symtab_->begin(filter), symtab_->end());
393 return *sorted_undefined_fun_symbols;
406 if (!undefined_fun_symbol_map)
410 (*undefined_fun_symbol_map)[symbol->get_name()].push_back(symbol);
412 return *undefined_fun_symbol_map;
428 if (!unrefed_fun_symbols)
433 unordered_map<string, bool> refed_funs;
435 for (
const auto&
function : fns)
438 refed_funs[sym->get_id_string()] =
true;
440 a && !a->is_main_symbol(); a = a->get_next_alias())
441 refed_funs[a->get_id_string()] =
true;
444 auto filter = symtab_->make_filter();
445 filter.set_functions();
446 for (
const auto& symbol :
449 const std::string sym_id = symbol->get_id_string();
450 if (refed_funs.find(sym_id) == refed_funs.end())
452 bool keep = sym_id_fns_to_keep.empty();
453 for (
const auto&
id : sym_id_fns_to_keep)
462 unrefed_fun_symbols->push_back(symbol);
467 return *unrefed_fun_symbols;
480 if (!sorted_var_symbols)
484 auto filter = symtab_->make_filter();
485 filter.set_variables();
487 sorted_var_symbols =
elf_symbols(symtab_->begin(filter),
493 return *sorted_var_symbols;
510 (*var_symbol_map)[symbol->get_name()].push_back(symbol);
512 return *var_symbol_map;
523 if (!sorted_undefined_var_symbols)
527 auto filter = symtab_->make_filter();
528 filter.set_variables();
529 filter.set_undefined_symbols();
530 filter.set_public_symbols(
false);
532 sorted_undefined_var_symbols =
533 elf_symbols(symtab_->begin(filter), symtab_->end());
538 return *sorted_undefined_var_symbols;
551 if (!undefined_var_symbol_map)
555 (*undefined_var_symbol_map)[symbol->get_name()].push_back(symbol);
557 return *undefined_var_symbol_map;
573 if (!unrefed_var_symbols)
578 unordered_map<string, bool> refed_vars;
579 for (
const auto& variable : vars)
582 refed_vars[sym->get_id_string()] =
true;
584 a && !a->is_main_symbol(); a = a->get_next_alias())
585 refed_vars[a->get_id_string()] =
true;
588 auto filter = symtab_->make_filter();
589 filter.set_variables();
590 for (
const auto& symbol :
593 const std::string sym_id = symbol->get_id_string();
594 if (refed_vars.find(sym_id) == refed_vars.end())
596 bool keep = sym_id_vars_to_keep.empty();
597 for (
const auto&
id : sym_id_vars_to_keep)
606 unrefed_var_symbols->push_back(symbol);
611 return *unrefed_var_symbols;
620 unordered_set<interned_string, hash_interned_string>*
624 return group->get_public_types_pretty_representations();
626 if (pub_type_pretty_reprs_ == 0)
627 pub_type_pretty_reprs_ =
628 new unordered_set<interned_string, hash_interned_string>;
629 return pub_type_pretty_reprs_;
635 delete pub_type_pretty_reprs_;
645 priv_.reset(
new priv(path, env));
646 init_format_version();
649 corpus::~corpus() =
default;
663 {
return priv_->do_log;}
684 if (!tu->get_absolute_path().empty())
687 string_tu_map_type::const_iterator i =
688 priv_->path_tu_map.find(tu->get_absolute_path());
690 priv_->path_tu_map[tu->get_absolute_path()] = tu;
693 tu->set_corpus(
this);
701 {
return priv_->members;}
712 string_tu_map_type::const_iterator i =
713 priv_->path_tu_map.find(path);
715 if (i == priv_->path_tu_map.end())
726 {priv_->members.clear();}
733 {
return priv_->types_;}
741 {
return priv_->types_;}
754 {
return priv_->type_per_loc_map_;}
765 return (priv_->get_public_types_pretty_representations()
766 && !priv_->get_public_types_pretty_representations()->empty());
778 priv_->get_public_types_pretty_representations()->insert(s);
797 return (priv_->get_public_types_pretty_representations()->find(s)
798 != priv_->get_public_types_pretty_representations()->end());
811 const vector<type_base_wptr>&
814 if (priv_->types_not_reachable_from_pub_ifaces_.empty())
817 for (vector<type_base_wptr>::const_iterator it =
822 type_base_sptr t(*it);
824 priv_->types_not_reachable_from_pub_ifaces_.push_back(t);
828 return priv_->types_not_reachable_from_pub_ifaces_;
842 {
return priv_->type_per_loc_map_;}
850 {
return priv_->group;}
858 {
return priv_->group;}
873 corpus::init_format_version()
876 (priv_->env.get_config().get_format_major_version_number());
878 (priv_->env.get_config().get_format_minor_version_number());
886 {
return priv_->origin_;}
893 {priv_->origin_ = o;}
901 {
return priv_->format_major_version_number_;}
909 {priv_->format_major_version_number_ = maj;}
918 {
return priv_->format_minor_version_number_;}
927 {priv_->format_minor_version_number_ = min;}
939 {
return priv_->path;}
951 {priv_->path = path;}
960 const vector<string>&
962 {
return priv_->needed;}
974 {priv_->needed = needed;}
985 {
return priv_->soname;}
996 {priv_->soname = soname;}
1007 {
return priv_->architecture_name;}
1018 {priv_->architecture_name = arch;}
1032 bool members_empty =
true;
1033 for (translation_units::const_iterator i = priv_->members.begin(),
1034 e = priv_->members.end();
1037 if (!(*i)->is_empty())
1039 members_empty =
false;
1043 return (members_empty
1045 && priv_->soname.empty()
1046 && priv_->needed.empty()
1047 && priv_->architecture_name.empty()
1059 translation_units::const_iterator i, j;
1077 {priv_->symtab_ = symtab;}
1084 {
return priv_->symtab_;}
1091 {
return priv_->get_fun_symbol_map();}
1101 {
return priv_->get_undefined_fun_symbol_map();}
1112 {
return priv_->get_sorted_fun_symbols();}
1121 {
return priv_->get_sorted_undefined_fun_symbols();}
1132 {
return priv_->get_sorted_var_symbols();}
1141 {
return priv_->get_sorted_undefined_var_symbols();}
1148 {
return priv_->get_var_symbol_map();}
1158 {
return priv_->get_undefined_var_symbol_map();}
1171 string_elf_symbols_map_type::const_iterator it =
1175 return it->second[0];
1191 const vector<elf_symbol_sptr>& symbols)
1193 if (version.is_empty())
1198 for (elf_symbols::const_iterator s = symbols.begin();
1201 if ((*s)->get_version().is_empty())
1205 for (elf_symbols::const_iterator s = symbols.begin();
1208 if ((*s)->get_version().is_default())
1213 for (elf_symbols::const_iterator s = symbols.begin();
1216 if ((*s)->get_version().str() == version.
str())
1238 string_elf_symbols_map_type::const_iterator it =
1243 return find_symbol_by_version(version, it->second);
1267 string_elf_symbols_map_type::const_iterator it =
1271 return it->second[0];
1289 string_elf_symbols_map_type::const_iterator it =
1294 return find_symbol_by_version(version, it->second);
1323 {
return priv_->fns;}
1339 const std::unordered_set<function_decl*>*
1343 auto i = b->priv_->id_fns_map_.find(
id);
1344 if (i == b->priv_->id_fns_map_.end())
1357 std::sort(priv_->fns.begin(), priv_->fns.end(), fc);
1377 {
return priv_->vars;}
1387 std::sort(priv_->vars.begin(), priv_->vars.end(), vc);
1401 {
return priv_->get_unreferenced_function_symbols();}
1414 {
return priv_->get_unreferenced_variable_symbols();}
1423 {
return priv_->regex_patterns_fns_to_suppress;}
1430 const vector<string>&
1432 {
return priv_->regex_patterns_fns_to_suppress;}
1441 {
return priv_->regex_patterns_vars_to_suppress;}
1448 const vector<string>&
1450 {
return priv_->regex_patterns_vars_to_suppress;}
1460 {
return priv_->regex_patterns_fns_to_keep;}
1468 const vector<string>&
1470 {
return priv_->regex_patterns_fns_to_keep;}
1480 {
return priv_->sym_id_fns_to_keep;}
1488 const vector<string>&
1490 {
return priv_->sym_id_fns_to_keep;}
1500 {
return priv_->regex_patterns_vars_to_keep;}
1508 const vector<string>&
1510 {
return priv_->regex_patterns_vars_to_keep;}
1520 {
return priv_->sym_id_vars_to_keep;}
1528 const vector<string>&
1530 {
return priv_->sym_id_vars_to_keep;}
1538 string sym_name, sym_version;
1540 vector<function_decl*> fns_to_keep;
1542 for (vector<function_decl*>::iterator f = priv_->fns.begin();
1543 f != priv_->fns.end();
1546 if (b->priv_->keep_wrt_id_of_fns_to_keep(*f)
1547 && b->priv_->keep_wrt_regex_of_fns_to_suppress(*f)
1548 && b->priv_->keep_wrt_regex_of_fns_to_keep(*f))
1549 fns_to_keep.push_back(*f);
1551 priv_->fns = fns_to_keep;
1553 vector<var_decl*> vars_to_keep;
1554 for (vector<var_decl*>::iterator v = priv_->vars.begin();
1555 v != priv_->vars.end();
1558 if (b->priv_->keep_wrt_id_of_vars_to_keep(*v)
1559 && b->priv_->keep_wrt_regex_of_vars_to_suppress(*v)
1560 && b->priv_->keep_wrt_regex_of_vars_to_keep(*v))
1561 vars_to_keep.push_back(*v);
1563 priv_->vars = vars_to_keep;
1579 if (!priv_->exported_decls_builder)
1581 priv_->exported_decls_builder.reset
1584 priv_->regex_patterns_fns_to_suppress,
1585 priv_->regex_patterns_vars_to_suppress,
1586 priv_->regex_patterns_fns_to_keep,
1587 priv_->regex_patterns_vars_to_keep,
1588 priv_->sym_id_fns_to_keep,
1589 priv_->sym_id_vars_to_keep));
1591 return priv_->exported_decls_builder;
1605 (
static_cast<uint32_t
>(l) |
static_cast<uint32_t
>(r));
1633 (
static_cast<uint32_t
>(l) &
static_cast<uint32_t
>(r));
1655 struct corpus_group::priv
1657 corpora_type corpora;
1658 istring_function_decl_ptr_map_type fns_map;
1659 vector<function_decl*> fns;
1660 istring_var_decl_ptr_map_type vars_map;
1661 vector<var_decl*> vars;
1666 unordered_map<string, elf_symbol_sptr> unrefed_fun_symbol_map;
1668 bool unrefed_fun_symbols_built;
1669 unordered_map<string, elf_symbol_sptr> unrefed_var_symbol_map;
1671 bool unrefed_var_symbols_built;
1672 unordered_set<interned_string, hash_interned_string> pub_type_pretty_reprs_;
1675 : unrefed_fun_symbols_built(),
1676 unrefed_var_symbols_built()
1686 for (elf_symbols::const_iterator e =
1687 syms.begin(); e != syms.end(); ++e)
1689 string sym_id = (*e)->get_id_string();
1690 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1691 unrefed_fun_symbol_map.find(sym_id);
1692 if (j != unrefed_fun_symbol_map.end())
1695 unrefed_fun_symbol_map[sym_id] = *e;
1696 unrefed_fun_symbols.push_back(*e);
1698 unrefed_fun_symbols_built =
true;
1708 for (elf_symbols::const_iterator e =
1709 syms.begin(); e != syms.end(); ++e)
1711 string sym_id = (*e)->get_id_string();
1712 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1713 unrefed_var_symbol_map.find(sym_id);
1714 if (j != unrefed_var_symbol_map.end())
1717 unrefed_var_symbol_map[sym_id] = *e;
1718 unrefed_var_symbols.push_back(*e);
1720 unrefed_var_symbols_built =
true;
1729 corpus_group::corpus_group(
const environment& env,
const string& path =
"")
1730 :
corpus(env, path), priv_(new priv)
1748 corp_arch = corp->get_architecture_name();
1749 if (cur_arch.empty())
1751 else if (cur_arch != corp_arch)
1753 std::cerr <<
"corpus '" << corp->get_path() <<
"'"
1754 <<
" has architecture '" << corp_arch <<
"'"
1755 <<
" but expected '" << cur_arch <<
"'\n";
1759 priv_->corpora.push_back(corp);
1760 corp->set_group(
this);
1772 const corpus_group::corpora_type&
1774 {
return priv_->corpora;}
1791 return corpus_sptr();
1813 if (priv_->fns.empty())
1814 for (corpora_type::const_iterator i =
get_corpora().begin();
1819 for (corpus::functions::const_iterator f = c->get_functions().begin();
1820 f != c->get_functions().end();
1824 istring_function_decl_ptr_map_type::const_iterator j =
1825 priv_->fns_map.find(fid);
1827 if (j != priv_->fns_map.end())
1831 priv_->fns_map[fid] = *f;
1833 priv_->fns.push_back(*f);
1851 if (priv_->vars.empty())
1852 for (corpora_type::const_iterator i =
get_corpora().begin();
1857 for (corpus::variables::const_iterator v = c->get_variables().begin();
1858 v != c->get_variables().end();
1862 istring_var_decl_ptr_map_type::const_iterator j =
1863 priv_->vars_map.find(vid);
1865 if (j != priv_->vars_map.end())
1869 priv_->vars_map[vid] = *v;
1871 priv_->vars.push_back(*v);
1885 if (priv_->var_symbol_map.empty())
1886 for (corpora_type::const_iterator i =
get_corpora().begin();
1889 priv_->var_symbol_map.insert((*i)->get_var_symbol_map().begin(),
1890 (*i)->get_var_symbol_map().end());
1892 return priv_->var_symbol_map;
1902 if (priv_->fun_symbol_map.empty())
1903 for (corpora_type::const_iterator i =
get_corpora().begin();
1906 priv_->fun_symbol_map.insert((*i)->get_fun_symbol_map().begin(),
1907 (*i)->get_fun_symbol_map().end());
1909 return priv_->fun_symbol_map;
1919 if (priv_->sorted_fun_symbols.empty()
1922 for (corpora_type::const_iterator i =
get_corpora().begin();
1927 for (string_elf_symbols_map_type::const_iterator j =
1928 c->get_fun_symbol_map().begin();
1929 j != c->get_fun_symbol_map().begin();
1931 priv_->sorted_fun_symbols.insert(priv_->sorted_fun_symbols.end(),
1935 comp_elf_symbols_functor comp;
1936 std::sort(priv_->sorted_fun_symbols.begin(),
1937 priv_->sorted_fun_symbols.end(),
1941 return priv_->sorted_fun_symbols;
1951 if (priv_->sorted_var_symbols.empty()
1954 for (corpora_type::const_iterator i =
get_corpora().begin();
1959 for (string_elf_symbols_map_type::const_iterator j =
1960 c->get_var_symbol_map().begin();
1961 j != c->get_var_symbol_map().begin();
1963 priv_->sorted_var_symbols.insert(priv_->sorted_var_symbols.end(),
1967 comp_elf_symbols_functor comp;
1968 std::sort(priv_->sorted_var_symbols.begin(),
1969 priv_->sorted_var_symbols.end(),
1973 return priv_->sorted_var_symbols;
1990 if (!priv_->unrefed_fun_symbols_built)
1991 if (priv_->unrefed_fun_symbols.empty())
1993 for (corpora_type::const_iterator i =
get_corpora().begin();
1998 for (elf_symbols::const_iterator e =
1999 c->get_unreferenced_function_symbols().begin();
2000 e != c->get_unreferenced_function_symbols().end();
2003 string sym_id = (*e)->get_id_string();
2004 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2005 priv_->unrefed_fun_symbol_map.find(sym_id);
2006 if (j != priv_->unrefed_fun_symbol_map.end())
2009 priv_->unrefed_fun_symbol_map[sym_id] = *e;
2010 priv_->unrefed_fun_symbols.push_back(*e);
2013 priv_->unrefed_fun_symbols_built =
true;
2016 return priv_->unrefed_fun_symbols;
2033 if (!priv_->unrefed_var_symbols_built)
2034 if (priv_->unrefed_var_symbols.empty())
2036 for (corpora_type::const_iterator i =
get_corpora().begin();
2041 for (elf_symbols::const_iterator e =
2042 c->get_unreferenced_variable_symbols().begin();
2043 e != c->get_unreferenced_variable_symbols().end();
2046 string sym_id = (*e)->get_id_string();
2047 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2048 priv_->unrefed_var_symbol_map.find(sym_id);
2049 if (j != priv_->unrefed_var_symbol_map.end())
2052 priv_->unrefed_var_symbol_map[sym_id] = *e;
2053 priv_->unrefed_var_symbols.push_back(*e);
2056 priv_->unrefed_var_symbols_built =
true;
2059 return priv_->unrefed_var_symbols;
2064 unordered_set<interned_string, hash_interned_string>*
2066 {
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.
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(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.
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.
const std::unordered_set< function_decl * > * lookup_functions(const string &id) const
Lookup the function which has a given function ID.
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.
vector< var_decl * > variables
Convenience typedef for std::vector<abigail::ir::var_decl*>
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< 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.
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.
~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.