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_;}
167 const string& fn_id = priv_->get_id(*fn);
170 if (priv_->fn_is_in_id_fns_map(fn))
173 if (priv_->keep_wrt_id_of_fns_to_keep(fn)
174 && priv_->keep_wrt_regex_of_fns_to_suppress(fn)
175 && priv_->keep_wrt_regex_of_fns_to_keep(fn))
177 priv_->add_fn_to_exported(fn);
200 if (priv_->var_id_is_in_id_var_map(var_id))
203 if (priv_->keep_wrt_id_of_vars_to_keep(var)
204 && priv_->keep_wrt_regex_of_vars_to_suppress(var)
205 && priv_->keep_wrt_regex_of_vars_to_keep(var))
207 priv_->add_var_to_exported(var);
227typedef unordered_map<
const var_decl*,
253 string first_name, second_name;
255 if (first_name.empty())
260 if (second_name.empty())
264 return first_name < second_name;
287 string first_name, second_name;
289 if (first_name.empty())
297 if (second_name.empty())
300 if (second_name.empty())
308 return first_name < second_name;
315struct comp_elf_symbols_functor
318 operator()(
const elf_symbol& l,
319 const elf_symbol& r)
const
320 {
return l.get_id_string() < r.get_id_string();}
325 {
return operator()(*l, *r);}
351 if (!sorted_fun_symbols)
355 auto filter = symtab_->make_filter();
356 filter.set_functions();
357 sorted_fun_symbols =
elf_symbols(symtab_->begin(filter),
363 return *sorted_fun_symbols;
380 (*fun_symbol_map)[symbol->get_name()].push_back(symbol);
382 return *fun_symbol_map;
393 if (!sorted_undefined_fun_symbols)
397 auto filter = symtab_->make_filter();
398 filter.set_functions();
399 filter.set_undefined_symbols();
400 filter.set_public_symbols(
false);
402 sorted_undefined_fun_symbols =
403 elf_symbols(symtab_->begin(filter), symtab_->end());
408 return *sorted_undefined_fun_symbols;
421 if (!undefined_fun_symbol_map)
425 (*undefined_fun_symbol_map)[symbol->get_name()].push_back(symbol);
427 return *undefined_fun_symbol_map;
443 if (!unrefed_fun_symbols)
448 unordered_map<string, bool> refed_funs;
450 for (
const auto& function : fns)
453 refed_funs[sym->get_id_string()] =
true;
455 a && !a->is_main_symbol(); a = a->get_next_alias())
456 refed_funs[a->get_id_string()] =
true;
459 auto filter = symtab_->make_filter();
460 filter.set_functions();
461 for (
const auto& symbol :
464 const std::string sym_id = symbol->get_id_string();
465 if (refed_funs.find(sym_id) == refed_funs.end())
467 bool keep = sym_id_fns_to_keep.empty();
468 for (
const auto&
id : sym_id_fns_to_keep)
477 unrefed_fun_symbols->push_back(symbol);
482 return *unrefed_fun_symbols;
495 if (!sorted_var_symbols)
499 auto filter = symtab_->make_filter();
500 filter.set_variables();
502 sorted_var_symbols =
elf_symbols(symtab_->begin(filter),
508 return *sorted_var_symbols;
525 (*var_symbol_map)[symbol->get_name()].push_back(symbol);
527 return *var_symbol_map;
538 if (!sorted_undefined_var_symbols)
542 auto filter = symtab_->make_filter();
543 filter.set_variables();
544 filter.set_undefined_symbols();
545 filter.set_public_symbols(
false);
547 sorted_undefined_var_symbols =
548 elf_symbols(symtab_->begin(filter), symtab_->end());
553 return *sorted_undefined_var_symbols;
566 if (!undefined_var_symbol_map)
570 (*undefined_var_symbol_map)[symbol->get_name()].push_back(symbol);
572 return *undefined_var_symbol_map;
588 if (!unrefed_var_symbols)
593 unordered_map<string, bool> refed_vars;
594 for (
const auto& variable : vars)
597 refed_vars[sym->get_id_string()] =
true;
599 a && !a->is_main_symbol(); a = a->get_next_alias())
600 refed_vars[a->get_id_string()] =
true;
603 auto filter = symtab_->make_filter();
604 filter.set_variables();
605 for (
const auto& symbol :
608 const std::string sym_id = symbol->get_id_string();
609 if (refed_vars.find(sym_id) == refed_vars.end())
611 bool keep = sym_id_vars_to_keep.empty();
612 for (
const auto&
id : sym_id_vars_to_keep)
621 unrefed_var_symbols->push_back(symbol);
626 return *unrefed_var_symbols;
635unordered_set<interned_string, hash_interned_string>*
639 return group->get_public_types_pretty_representations();
641 if (pub_type_pretty_reprs_ == 0)
642 pub_type_pretty_reprs_ =
643 new unordered_set<interned_string, hash_interned_string>;
644 return pub_type_pretty_reprs_;
661std::unordered_set<function_decl*>*
667 auto i = b->priv_->id_fns_map_.find(
id);
668 if (i == b->priv_->id_fns_map_.end())
678 delete pub_type_pretty_reprs_;
688 priv_.reset(
new priv(path, env));
689 init_format_version();
692corpus::~corpus() =
default;
706{
return priv_->do_log;}
727 if (!tu->get_absolute_path().empty())
730 string_tu_map_type::const_iterator i =
731 priv_->path_tu_map.find(tu->get_absolute_path());
733 priv_->path_tu_map[tu->get_absolute_path()] = tu;
736 tu->set_corpus(
this);
744{
return priv_->members;}
755 string_tu_map_type::const_iterator i =
756 priv_->path_tu_map.find(path);
758 if (i == priv_->path_tu_map.end())
769{priv_->members.clear();}
776{
return priv_->types_;}
784{
return priv_->types_;}
797{
return priv_->type_per_loc_map_;}
808 return (priv_->get_public_types_pretty_representations()
809 && !priv_->get_public_types_pretty_representations()->empty());
821 priv_->get_public_types_pretty_representations()->insert(s);
840 return (priv_->get_public_types_pretty_representations()->find(s)
841 != priv_->get_public_types_pretty_representations()->end());
854const vector<type_base_wptr>&
857 if (priv_->types_not_reachable_from_pub_ifaces_.empty())
860 for (vector<type_base_wptr>::const_iterator it =
865 type_base_sptr t(*it);
867 priv_->types_not_reachable_from_pub_ifaces_.push_back(t);
871 return priv_->types_not_reachable_from_pub_ifaces_;
885{
return priv_->type_per_loc_map_;}
893{
return priv_->group;}
901{
return priv_->group;}
916corpus::init_format_version()
919 (priv_->env.get_config().get_format_major_version_number());
921 (priv_->env.get_config().get_format_minor_version_number());
929{
return priv_->origin_;}
944{
return priv_->format_major_version_number_;}
952{priv_->format_major_version_number_ = maj;}
961{
return priv_->format_minor_version_number_;}
970{priv_->format_minor_version_number_ = min;}
1003const vector<string>&
1005{
return priv_->needed;}
1017{priv_->needed = needed;}
1028{
return priv_->soname;}
1039{priv_->soname = soname;}
1050{
return priv_->architecture_name;}
1061{priv_->architecture_name = arch;}
1075 bool members_empty =
true;
1076 for (translation_units::const_iterator i = priv_->members.begin(),
1077 e = priv_->members.end();
1080 if (!(*i)->is_empty())
1082 members_empty =
false;
1086 return (members_empty
1088 && priv_->soname.empty()
1089 && priv_->needed.empty()
1090 && priv_->architecture_name.empty()
1102 translation_units::const_iterator i, j;
1120{priv_->symtab_ = symtab;}
1127{
return priv_->symtab_;}
1134{
return priv_->get_fun_symbol_map();}
1144{
return priv_->get_undefined_fun_symbol_map();}
1155{
return priv_->get_sorted_fun_symbols();}
1164{
return priv_->get_sorted_undefined_fun_symbols();}
1175{
return priv_->get_sorted_var_symbols();}
1184{
return priv_->get_sorted_undefined_var_symbols();}
1191{
return priv_->get_var_symbol_map();}
1201{
return priv_->get_undefined_var_symbol_map();}
1221 return it->second[0];
1237 const vector<elf_symbol_sptr>& symbols)
1239 if (version.is_empty())
1244 for (elf_symbols::const_iterator s = symbols.begin();
1247 if ((*s)->get_version().is_empty())
1251 for (elf_symbols::const_iterator s = symbols.begin();
1254 if ((*s)->get_version().is_default())
1259 for (elf_symbols::const_iterator s = symbols.begin();
1262 if ((*s)->get_version().str() == version.
str())
1284 string_elf_symbols_map_type::const_iterator it =
1293 return find_symbol_by_version(version, it->second);
1324 return it->second[0];
1342 string_elf_symbols_map_type::const_iterator it =
1351 return find_symbol_by_version(version, it->second);
1396const std::unordered_set<function_decl*>*
1398{
return priv_->lookup_functions(
id);}
1400const std::unordered_set<function_decl*>*
1420 auto i = b->priv_->id_var_map_.find(
id);
1421 if (i == b->priv_->id_var_map_.end())
1434 std::sort(priv_->fns.begin(), priv_->fns.end(), fc);
1436 priv_->sorted_undefined_fns.clear();
1438 for (
auto& f : priv_->undefined_fns)
1439 priv_->sorted_undefined_fns.push_back(f);
1441 std::sort(priv_->sorted_undefined_fns.begin(),
1442 priv_->sorted_undefined_fns.end(), fc);
1462{
return priv_->vars;}
1472 std::sort(priv_->vars.begin(), priv_->vars.end(), vc);
1474 priv_->sorted_undefined_vars.clear();
1475 for (
auto& f : priv_->undefined_vars)
1476 priv_->sorted_undefined_vars.push_back(f);
1478 std::sort(priv_->sorted_undefined_vars.begin(),
1479 priv_->sorted_undefined_vars.end(), vc);
1490{
return priv_->undefined_fns;}
1498{
return priv_->undefined_fns;}
1507 if (priv_->sorted_undefined_fns.empty()
1508 && !priv_->undefined_fns.empty())
1513 return priv_->sorted_undefined_fns;
1522{
return priv_->undefined_vars;}
1530{
return priv_->undefined_vars;}
1539 if (priv_->sorted_undefined_vars.empty()
1540 && !priv_->undefined_vars.empty())
1545 return priv_->sorted_undefined_vars;
1559{
return priv_->get_unreferenced_function_symbols();}
1572{
return priv_->get_unreferenced_variable_symbols();}
1581{
return priv_->regex_patterns_fns_to_suppress;}
1588const vector<string>&
1590{
return priv_->regex_patterns_fns_to_suppress;}
1599{
return priv_->regex_patterns_vars_to_suppress;}
1606const vector<string>&
1608{
return priv_->regex_patterns_vars_to_suppress;}
1618{
return priv_->regex_patterns_fns_to_keep;}
1626const vector<string>&
1628{
return priv_->regex_patterns_fns_to_keep;}
1638{
return priv_->sym_id_fns_to_keep;}
1646const vector<string>&
1648{
return priv_->sym_id_fns_to_keep;}
1658{
return priv_->regex_patterns_vars_to_keep;}
1666const vector<string>&
1668{
return priv_->regex_patterns_vars_to_keep;}
1678{
return priv_->sym_id_vars_to_keep;}
1686const vector<string>&
1688{
return priv_->sym_id_vars_to_keep;}
1696 string sym_name, sym_version;
1700 for (
auto f = priv_->fns.begin(); f != priv_->fns.end(); ++f)
1702 if (b->priv_->keep_wrt_id_of_fns_to_keep(*f)
1703 && b->priv_->keep_wrt_regex_of_fns_to_suppress(*f)
1704 && b->priv_->keep_wrt_regex_of_fns_to_keep(*f))
1705 fns_to_keep.push_back(*f);
1707 priv_->fns = fns_to_keep;
1710 for (
auto v = priv_->vars.begin(); v != priv_->vars.end(); ++v)
1712 if (b->priv_->keep_wrt_id_of_vars_to_keep(*v)
1713 && b->priv_->keep_wrt_regex_of_vars_to_suppress(*v)
1714 && b->priv_->keep_wrt_regex_of_vars_to_keep(*v))
1715 vars_to_keep.push_back(*v);
1717 priv_->vars = vars_to_keep;
1733 if (!priv_->exported_decls_builder)
1735 priv_->exported_decls_builder.reset
1738 priv_->regex_patterns_fns_to_suppress,
1739 priv_->regex_patterns_vars_to_suppress,
1740 priv_->regex_patterns_fns_to_keep,
1741 priv_->regex_patterns_vars_to_keep,
1742 priv_->sym_id_fns_to_keep,
1743 priv_->sym_id_vars_to_keep));
1745 return priv_->exported_decls_builder;
1809struct corpus_group::priv
1811 std::set<string> corpora_paths;
1812 corpora_type corpora;
1813 istring_function_decl_ptr_map_type fns_map;
1815 istring_var_decl_ptr_map_type vars_map;
1821 unordered_map<string, elf_symbol_sptr> unrefed_fun_symbol_map;
1823 bool unrefed_fun_symbols_built;
1824 unordered_map<string, elf_symbol_sptr> unrefed_var_symbol_map;
1826 bool unrefed_var_symbols_built;
1827 unordered_set<interned_string, hash_interned_string> pub_type_pretty_reprs_;
1830 : unrefed_fun_symbols_built(),
1831 unrefed_var_symbols_built()
1841 for (elf_symbols::const_iterator e =
1842 syms.begin(); e != syms.end(); ++e)
1844 string sym_id = (*e)->get_id_string();
1845 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1846 unrefed_fun_symbol_map.find(sym_id);
1847 if (j != unrefed_fun_symbol_map.end())
1850 unrefed_fun_symbol_map[sym_id] = *e;
1851 unrefed_fun_symbols.push_back(*e);
1853 unrefed_fun_symbols_built =
true;
1863 for (elf_symbols::const_iterator e =
1864 syms.begin(); e != syms.end(); ++e)
1866 string sym_id = (*e)->get_id_string();
1867 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1868 unrefed_var_symbol_map.find(sym_id);
1869 if (j != unrefed_var_symbol_map.end())
1872 unrefed_var_symbol_map[sym_id] = *e;
1873 unrefed_var_symbols.push_back(*e);
1875 unrefed_var_symbols_built =
true;
1884corpus_group::corpus_group(
const environment& env,
const string& path =
"")
1885 :
corpus(env, path), priv_(new priv)
1901 if (!corp->get_path().empty()
1907 corp_arch = corp->get_architecture_name();
1908 if (cur_arch.empty())
1910 else if (cur_arch != corp_arch)
1912 std::cerr <<
"corpus '" << corp->get_path() <<
"'"
1913 <<
" has architecture '" << corp_arch <<
"'"
1914 <<
" but expected '" << cur_arch <<
"'\n";
1918 priv_->corpora.push_back(corp);
1919 corp->set_group(
this);
1920 priv_->corpora_paths.insert(corp->get_path());
1937 if (priv_->corpora_paths.find(path) != priv_->corpora_paths.end())
1946const corpus_group::corpora_type&
1948{
return priv_->corpora;}
1965 return corpus_sptr();
1987 if (priv_->fns.empty())
1988 for (corpora_type::const_iterator i =
get_corpora().begin();
1993 for (corpus::functions::const_iterator f = c->get_functions().begin();
1994 f != c->get_functions().end();
1998 istring_function_decl_ptr_map_type::const_iterator j =
1999 priv_->fns_map.find(fid);
2001 if (j != priv_->fns_map.end())
2005 priv_->fns_map[fid] = *f;
2007 priv_->fns.push_back(*f);
2025 if (priv_->vars.empty())
2026 for (corpora_type::const_iterator i =
get_corpora().begin();
2031 for (corpus::variables::const_iterator v = c->get_variables().begin();
2032 v != c->get_variables().end();
2036 istring_var_decl_ptr_map_type::const_iterator j =
2037 priv_->vars_map.find(vid);
2039 if (j != priv_->vars_map.end())
2043 priv_->vars_map[vid] = *v;
2045 priv_->vars.push_back(*v);
2059 if (priv_->var_symbol_map.empty())
2060 for (corpora_type::const_iterator i =
get_corpora().begin();
2063 priv_->var_symbol_map.insert((*i)->get_var_symbol_map().begin(),
2064 (*i)->get_var_symbol_map().end());
2066 return priv_->var_symbol_map;
2076 if (priv_->fun_symbol_map.empty())
2077 for (corpora_type::const_iterator i =
get_corpora().begin();
2080 priv_->fun_symbol_map.insert((*i)->get_fun_symbol_map().begin(),
2081 (*i)->get_fun_symbol_map().end());
2083 return priv_->fun_symbol_map;
2093 if (priv_->sorted_fun_symbols.empty()
2096 for (corpora_type::const_iterator i =
get_corpora().begin();
2101 for (string_elf_symbols_map_type::const_iterator j =
2102 c->get_fun_symbol_map().begin();
2103 j != c->get_fun_symbol_map().begin();
2105 priv_->sorted_fun_symbols.insert(priv_->sorted_fun_symbols.end(),
2109 comp_elf_symbols_functor comp;
2110 std::sort(priv_->sorted_fun_symbols.begin(),
2111 priv_->sorted_fun_symbols.end(),
2115 return priv_->sorted_fun_symbols;
2125 if (priv_->sorted_var_symbols.empty()
2128 for (corpora_type::const_iterator i =
get_corpora().begin();
2133 for (string_elf_symbols_map_type::const_iterator j =
2134 c->get_var_symbol_map().begin();
2135 j != c->get_var_symbol_map().begin();
2137 priv_->sorted_var_symbols.insert(priv_->sorted_var_symbols.end(),
2141 comp_elf_symbols_functor comp;
2142 std::sort(priv_->sorted_var_symbols.begin(),
2143 priv_->sorted_var_symbols.end(),
2147 return priv_->sorted_var_symbols;
2164 if (!priv_->unrefed_fun_symbols_built)
2165 if (priv_->unrefed_fun_symbols.empty())
2167 for (corpora_type::const_iterator i =
get_corpora().begin();
2172 for (elf_symbols::const_iterator e =
2173 c->get_unreferenced_function_symbols().begin();
2174 e != c->get_unreferenced_function_symbols().end();
2177 string sym_id = (*e)->get_id_string();
2178 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2179 priv_->unrefed_fun_symbol_map.find(sym_id);
2180 if (j != priv_->unrefed_fun_symbol_map.end())
2183 priv_->unrefed_fun_symbol_map[sym_id] = *e;
2184 priv_->unrefed_fun_symbols.push_back(*e);
2187 priv_->unrefed_fun_symbols_built =
true;
2190 return priv_->unrefed_fun_symbols;
2207 if (!priv_->unrefed_var_symbols_built)
2208 if (priv_->unrefed_var_symbols.empty())
2210 for (corpora_type::const_iterator i =
get_corpora().begin();
2215 for (elf_symbols::const_iterator e =
2216 c->get_unreferenced_variable_symbols().begin();
2217 e != c->get_unreferenced_variable_symbols().end();
2220 string sym_id = (*e)->get_id_string();
2221 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2222 priv_->unrefed_var_symbol_map.find(sym_id);
2223 if (j != priv_->unrefed_var_symbol_map.end())
2226 priv_->unrefed_var_symbol_map[sym_id] = *e;
2227 priv_->unrefed_var_symbols.push_back(*e);
2230 priv_->unrefed_var_symbols_built =
true;
2233 return priv_->unrefed_var_symbols;
2238unordered_set<interned_string, hash_interned_string>*
2240{
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...
bool 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...
bool 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...
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.
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 functions_set & get_undefined_functions() const
Getter of the undefined functions of the corpus.
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.
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.
std::unordered_set< const var_decl * > variables_set
Convenience typedef for std::unordered_set<const 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.
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.
const var_decl * lookup_variable(const interned_string &id) const
Lookup the exported variable which has a given variable ID.
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.
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.