15 #include <unordered_map>
18 #include "abg-internal.h"
21 ABG_BEGIN_EXPORT_DECLARATIONS
31 ABG_END_EXPORT_DECLARATIONS
43 using std::ostringstream;
44 using std::unordered_map;
76 corpus::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))
102 {
return priv_->fns_;}
111 {
return priv_->fns_;}
124 std::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);
187 const string& var_id = priv_->get_id(*var);
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);
213 typedef 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;
301 struct 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;
621 unordered_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_;
636 delete pub_type_pretty_reprs_;
646 priv_.reset(
new priv(path, env));
647 init_format_version();
650 corpus::~corpus() =
default;
664 {
return priv_->do_log;}
685 if (!tu->get_absolute_path().empty())
688 string_tu_map_type::const_iterator i =
689 priv_->path_tu_map.find(tu->get_absolute_path());
691 priv_->path_tu_map[tu->get_absolute_path()] = tu;
694 tu->set_corpus(
this);
702 {
return priv_->members;}
713 string_tu_map_type::const_iterator i =
714 priv_->path_tu_map.find(path);
716 if (i == priv_->path_tu_map.end())
727 {priv_->members.clear();}
734 {
return priv_->types_;}
742 {
return priv_->types_;}
755 {
return priv_->type_per_loc_map_;}
766 return (priv_->get_public_types_pretty_representations()
767 && !priv_->get_public_types_pretty_representations()->empty());
779 priv_->get_public_types_pretty_representations()->insert(s);
798 return (priv_->get_public_types_pretty_representations()->find(s)
799 != priv_->get_public_types_pretty_representations()->end());
812 const vector<type_base_wptr>&
815 if (priv_->types_not_reachable_from_pub_ifaces_.empty())
818 for (vector<type_base_wptr>::const_iterator it =
823 type_base_sptr t(*it);
825 priv_->types_not_reachable_from_pub_ifaces_.push_back(t);
829 return priv_->types_not_reachable_from_pub_ifaces_;
843 {
return priv_->type_per_loc_map_;}
851 {
return priv_->group;}
859 {
return priv_->group;}
874 corpus::init_format_version()
877 (priv_->env.get_config().get_format_major_version_number());
879 (priv_->env.get_config().get_format_minor_version_number());
887 {
return priv_->origin_;}
894 {priv_->origin_ = o;}
902 {
return priv_->format_major_version_number_;}
910 {priv_->format_major_version_number_ = maj;}
919 {
return priv_->format_minor_version_number_;}
928 {priv_->format_minor_version_number_ = min;}
940 {
return priv_->path;}
952 {priv_->path = path;}
961 const vector<string>&
963 {
return priv_->needed;}
975 {priv_->needed = needed;}
986 {
return priv_->soname;}
997 {priv_->soname = soname;}
1008 {
return priv_->architecture_name;}
1019 {priv_->architecture_name = arch;}
1033 bool members_empty =
true;
1034 for (translation_units::const_iterator i = priv_->members.begin(),
1035 e = priv_->members.end();
1038 if (!(*i)->is_empty())
1040 members_empty =
false;
1044 return (members_empty
1046 && priv_->soname.empty()
1047 && priv_->needed.empty()
1048 && priv_->architecture_name.empty()
1060 translation_units::const_iterator i, j;
1078 {priv_->symtab_ = symtab;}
1085 {
return priv_->symtab_;}
1092 {
return priv_->get_fun_symbol_map();}
1102 {
return priv_->get_undefined_fun_symbol_map();}
1113 {
return priv_->get_sorted_fun_symbols();}
1122 {
return priv_->get_sorted_undefined_fun_symbols();}
1133 {
return priv_->get_sorted_var_symbols();}
1142 {
return priv_->get_sorted_undefined_var_symbols();}
1149 {
return priv_->get_var_symbol_map();}
1159 {
return priv_->get_undefined_var_symbol_map();}
1172 string_elf_symbols_map_type::const_iterator it =
1176 return it->second[0];
1192 const vector<elf_symbol_sptr>& symbols)
1194 if (version.is_empty())
1199 for (elf_symbols::const_iterator s = symbols.begin();
1202 if ((*s)->get_version().is_empty())
1206 for (elf_symbols::const_iterator s = symbols.begin();
1209 if ((*s)->get_version().is_default())
1214 for (elf_symbols::const_iterator s = symbols.begin();
1217 if ((*s)->get_version().str() == version.
str())
1239 string_elf_symbols_map_type::const_iterator it =
1244 return find_symbol_by_version(version, it->second);
1268 string_elf_symbols_map_type::const_iterator it =
1272 return it->second[0];
1290 string_elf_symbols_map_type::const_iterator it =
1295 return find_symbol_by_version(version, it->second);
1324 {
return priv_->fns;}
1340 const std::unordered_set<function_decl*>*
1344 auto i = b->priv_->id_fns_map_.find(
id);
1345 if (i == b->priv_->id_fns_map_.end())
1358 std::sort(priv_->fns.begin(), priv_->fns.end(), fc);
1378 {
return priv_->vars;}
1388 std::sort(priv_->vars.begin(), priv_->vars.end(), vc);
1402 {
return priv_->get_unreferenced_function_symbols();}
1415 {
return priv_->get_unreferenced_variable_symbols();}
1424 {
return priv_->regex_patterns_fns_to_suppress;}
1431 const vector<string>&
1433 {
return priv_->regex_patterns_fns_to_suppress;}
1442 {
return priv_->regex_patterns_vars_to_suppress;}
1449 const vector<string>&
1451 {
return priv_->regex_patterns_vars_to_suppress;}
1461 {
return priv_->regex_patterns_fns_to_keep;}
1469 const vector<string>&
1471 {
return priv_->regex_patterns_fns_to_keep;}
1481 {
return priv_->sym_id_fns_to_keep;}
1489 const vector<string>&
1491 {
return priv_->sym_id_fns_to_keep;}
1501 {
return priv_->regex_patterns_vars_to_keep;}
1509 const vector<string>&
1511 {
return priv_->regex_patterns_vars_to_keep;}
1521 {
return priv_->sym_id_vars_to_keep;}
1529 const vector<string>&
1531 {
return priv_->sym_id_vars_to_keep;}
1539 string sym_name, sym_version;
1541 vector<function_decl*> fns_to_keep;
1543 for (vector<function_decl*>::iterator f = priv_->fns.begin();
1544 f != priv_->fns.end();
1547 if (b->priv_->keep_wrt_id_of_fns_to_keep(*f)
1548 && b->priv_->keep_wrt_regex_of_fns_to_suppress(*f)
1549 && b->priv_->keep_wrt_regex_of_fns_to_keep(*f))
1550 fns_to_keep.push_back(*f);
1552 priv_->fns = fns_to_keep;
1554 vector<var_decl*> vars_to_keep;
1555 for (vector<var_decl*>::iterator v = priv_->vars.begin();
1556 v != priv_->vars.end();
1559 if (b->priv_->keep_wrt_id_of_vars_to_keep(*v)
1560 && b->priv_->keep_wrt_regex_of_vars_to_suppress(*v)
1561 && b->priv_->keep_wrt_regex_of_vars_to_keep(*v))
1562 vars_to_keep.push_back(*v);
1564 priv_->vars = vars_to_keep;
1580 if (!priv_->exported_decls_builder)
1582 priv_->exported_decls_builder.reset
1585 priv_->regex_patterns_fns_to_suppress,
1586 priv_->regex_patterns_vars_to_suppress,
1587 priv_->regex_patterns_fns_to_keep,
1588 priv_->regex_patterns_vars_to_keep,
1589 priv_->sym_id_fns_to_keep,
1590 priv_->sym_id_vars_to_keep));
1592 return priv_->exported_decls_builder;
1606 (
static_cast<uint32_t
>(l) |
static_cast<uint32_t
>(r));
1634 (
static_cast<uint32_t
>(l) &
static_cast<uint32_t
>(r));
1656 struct corpus_group::priv
1658 std::set<string> corpora_paths;
1659 corpora_type corpora;
1660 istring_function_decl_ptr_map_type fns_map;
1661 vector<function_decl*> fns;
1662 istring_var_decl_ptr_map_type vars_map;
1663 vector<var_decl*> vars;
1668 unordered_map<string, elf_symbol_sptr> unrefed_fun_symbol_map;
1670 bool unrefed_fun_symbols_built;
1671 unordered_map<string, elf_symbol_sptr> unrefed_var_symbol_map;
1673 bool unrefed_var_symbols_built;
1674 unordered_set<interned_string, hash_interned_string> pub_type_pretty_reprs_;
1677 : unrefed_fun_symbols_built(),
1678 unrefed_var_symbols_built()
1688 for (elf_symbols::const_iterator e =
1689 syms.begin(); e != syms.end(); ++e)
1691 string sym_id = (*e)->get_id_string();
1692 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1693 unrefed_fun_symbol_map.find(sym_id);
1694 if (j != unrefed_fun_symbol_map.end())
1697 unrefed_fun_symbol_map[sym_id] = *e;
1698 unrefed_fun_symbols.push_back(*e);
1700 unrefed_fun_symbols_built =
true;
1710 for (elf_symbols::const_iterator e =
1711 syms.begin(); e != syms.end(); ++e)
1713 string sym_id = (*e)->get_id_string();
1714 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1715 unrefed_var_symbol_map.find(sym_id);
1716 if (j != unrefed_var_symbol_map.end())
1719 unrefed_var_symbol_map[sym_id] = *e;
1720 unrefed_var_symbols.push_back(*e);
1722 unrefed_var_symbols_built =
true;
1731 corpus_group::corpus_group(
const environment& env,
const string& path =
"")
1732 :
corpus(env, path), priv_(new priv)
1748 if (!corp->get_path().empty()
1754 corp_arch = corp->get_architecture_name();
1755 if (cur_arch.empty())
1757 else if (cur_arch != corp_arch)
1759 std::cerr <<
"corpus '" << corp->get_path() <<
"'"
1760 <<
" has architecture '" << corp_arch <<
"'"
1761 <<
" but expected '" << cur_arch <<
"'\n";
1765 priv_->corpora.push_back(corp);
1766 corp->set_group(
this);
1767 priv_->corpora_paths.insert(corp->get_path());
1784 if (priv_->corpora_paths.find(path) != priv_->corpora_paths.end())
1793 const corpus_group::corpora_type&
1795 {
return priv_->corpora;}
1812 return corpus_sptr();
1834 if (priv_->fns.empty())
1835 for (corpora_type::const_iterator i =
get_corpora().begin();
1840 for (corpus::functions::const_iterator f = c->get_functions().begin();
1841 f != c->get_functions().end();
1845 istring_function_decl_ptr_map_type::const_iterator j =
1846 priv_->fns_map.find(fid);
1848 if (j != priv_->fns_map.end())
1852 priv_->fns_map[fid] = *f;
1854 priv_->fns.push_back(*f);
1872 if (priv_->vars.empty())
1873 for (corpora_type::const_iterator i =
get_corpora().begin();
1878 for (corpus::variables::const_iterator v = c->get_variables().begin();
1879 v != c->get_variables().end();
1883 istring_var_decl_ptr_map_type::const_iterator j =
1884 priv_->vars_map.find(vid);
1886 if (j != priv_->vars_map.end())
1890 priv_->vars_map[vid] = *v;
1892 priv_->vars.push_back(*v);
1906 if (priv_->var_symbol_map.empty())
1907 for (corpora_type::const_iterator i =
get_corpora().begin();
1910 priv_->var_symbol_map.insert((*i)->get_var_symbol_map().begin(),
1911 (*i)->get_var_symbol_map().end());
1913 return priv_->var_symbol_map;
1923 if (priv_->fun_symbol_map.empty())
1924 for (corpora_type::const_iterator i =
get_corpora().begin();
1927 priv_->fun_symbol_map.insert((*i)->get_fun_symbol_map().begin(),
1928 (*i)->get_fun_symbol_map().end());
1930 return priv_->fun_symbol_map;
1940 if (priv_->sorted_fun_symbols.empty()
1943 for (corpora_type::const_iterator i =
get_corpora().begin();
1948 for (string_elf_symbols_map_type::const_iterator j =
1949 c->get_fun_symbol_map().begin();
1950 j != c->get_fun_symbol_map().begin();
1952 priv_->sorted_fun_symbols.insert(priv_->sorted_fun_symbols.end(),
1956 comp_elf_symbols_functor comp;
1957 std::sort(priv_->sorted_fun_symbols.begin(),
1958 priv_->sorted_fun_symbols.end(),
1962 return priv_->sorted_fun_symbols;
1972 if (priv_->sorted_var_symbols.empty()
1975 for (corpora_type::const_iterator i =
get_corpora().begin();
1980 for (string_elf_symbols_map_type::const_iterator j =
1981 c->get_var_symbol_map().begin();
1982 j != c->get_var_symbol_map().begin();
1984 priv_->sorted_var_symbols.insert(priv_->sorted_var_symbols.end(),
1988 comp_elf_symbols_functor comp;
1989 std::sort(priv_->sorted_var_symbols.begin(),
1990 priv_->sorted_var_symbols.end(),
1994 return priv_->sorted_var_symbols;
2011 if (!priv_->unrefed_fun_symbols_built)
2012 if (priv_->unrefed_fun_symbols.empty())
2014 for (corpora_type::const_iterator i =
get_corpora().begin();
2019 for (elf_symbols::const_iterator e =
2020 c->get_unreferenced_function_symbols().begin();
2021 e != c->get_unreferenced_function_symbols().end();
2024 string sym_id = (*e)->get_id_string();
2025 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2026 priv_->unrefed_fun_symbol_map.find(sym_id);
2027 if (j != priv_->unrefed_fun_symbol_map.end())
2030 priv_->unrefed_fun_symbol_map[sym_id] = *e;
2031 priv_->unrefed_fun_symbols.push_back(*e);
2034 priv_->unrefed_fun_symbols_built =
true;
2037 return priv_->unrefed_fun_symbols;
2054 if (!priv_->unrefed_var_symbols_built)
2055 if (priv_->unrefed_var_symbols.empty())
2057 for (corpora_type::const_iterator i =
get_corpora().begin();
2062 for (elf_symbols::const_iterator e =
2063 c->get_unreferenced_variable_symbols().begin();
2064 e != c->get_unreferenced_variable_symbols().end();
2067 string sym_id = (*e)->get_id_string();
2068 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2069 priv_->unrefed_var_symbol_map.find(sym_id);
2070 if (j != priv_->unrefed_var_symbol_map.end())
2073 priv_->unrefed_var_symbol_map[sym_id] = *e;
2074 priv_->unrefed_var_symbols.push_back(*e);
2077 priv_->unrefed_var_symbols_built =
true;
2080 return priv_->unrefed_var_symbols;
2085 unordered_set<interned_string, hash_interned_string>*
2087 {
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.
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.
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.