15 #include <unordered_map>
19 #include "abg-internal.h"
22 ABG_BEGIN_EXPORT_DECLARATIONS
44 using std::ostringstream;
45 using std::unordered_map;
77 corpus::exported_decls_builder
86 : priv_(new
priv(fns, vars,
88 vars_suppress_regexps,
91 sym_id_of_fns_to_keep,
92 sym_id_of_vars_to_keep))
103 {
return priv_->fns_;}
112 {
return priv_->fns_;}
125 std::unordered_set<function_decl*>*
128 std::unordered_set<function_decl*> *fns_for_id =
129 priv_->fn_id_is_in_id_fns_map(fn);
130 if (fns_for_id && fns_for_id->size() > 1)
143 {
return priv_->vars_;}
152 {
return priv_->vars_;}
168 const string& fn_id = priv_->get_id(*fn);
171 if (priv_->fn_is_in_id_fns_map(fn))
174 if (priv_->keep_wrt_id_of_fns_to_keep(fn)
175 && priv_->keep_wrt_regex_of_fns_to_suppress(fn)
176 && priv_->keep_wrt_regex_of_fns_to_keep(fn))
178 priv_->add_fn_to_exported(fn);
195 if (!var->get_is_in_public_symbol_table())
201 if (priv_->var_is_in_id_vars_map(var))
204 if (priv_->keep_wrt_id_of_vars_to_keep(var)
205 && priv_->keep_wrt_regex_of_vars_to_suppress(var)
206 && priv_->keep_wrt_regex_of_vars_to_keep(var))
208 priv_->add_var_to_exported(var);
228 typedef unordered_map<
const var_decl*,
249 operator()(
const function_decl* first,
250 const function_decl* second)
const
254 string first_name, second_name;
256 if (first_name.empty())
261 if (second_name.empty())
265 return first_name < second_name;
283 operator()(
const var_decl* first,
284 const var_decl* second)
const
288 string first_name, second_name;
290 if (first_name.empty())
298 if (second_name.empty())
301 if (second_name.empty())
309 return first_name < second_name;
315 {
return operator()(first.get(), second.get());}
320 struct comp_elf_symbols_functor
323 operator()(
const elf_symbol& l,
324 const elf_symbol& r)
const
325 {
return l.get_id_string() < r.get_id_string();}
330 {
return operator()(*l, *r);}
356 if (!sorted_fun_symbols)
360 auto filter = symtab_->make_filter();
361 filter.set_functions();
362 sorted_fun_symbols =
elf_symbols(symtab_->begin(filter),
368 return *sorted_fun_symbols;
385 (*fun_symbol_map)[symbol->get_name()].push_back(symbol);
387 return *fun_symbol_map;
398 if (!sorted_undefined_fun_symbols)
402 auto filter = symtab_->make_filter();
403 filter.set_functions();
404 filter.set_undefined_symbols();
405 filter.set_public_symbols(
false);
407 sorted_undefined_fun_symbols =
408 elf_symbols(symtab_->begin(filter), symtab_->end());
413 return *sorted_undefined_fun_symbols;
426 if (!undefined_fun_symbol_map)
430 (*undefined_fun_symbol_map)[symbol->get_name()].push_back(symbol);
432 return *undefined_fun_symbol_map;
448 if (!unrefed_fun_symbols)
453 unordered_map<string, bool> refed_funs;
455 for (
const auto&
function : fns)
458 refed_funs[sym->get_id_string()] =
true;
460 a && !a->is_main_symbol(); a = a->get_next_alias())
461 refed_funs[a->get_id_string()] =
true;
464 auto filter = symtab_->make_filter();
465 filter.set_functions();
466 for (
const auto& symbol :
469 const std::string sym_id = symbol->get_id_string();
470 if (refed_funs.find(sym_id) == refed_funs.end())
472 bool keep = sym_id_fns_to_keep.empty();
473 for (
const auto&
id : sym_id_fns_to_keep)
482 unrefed_fun_symbols->push_back(symbol);
487 return *unrefed_fun_symbols;
500 if (!sorted_var_symbols)
504 auto filter = symtab_->make_filter();
505 filter.set_variables();
507 sorted_var_symbols =
elf_symbols(symtab_->begin(filter),
513 return *sorted_var_symbols;
530 (*var_symbol_map)[symbol->get_name()].push_back(symbol);
532 return *var_symbol_map;
543 if (!sorted_undefined_var_symbols)
547 auto filter = symtab_->make_filter();
548 filter.set_variables();
549 filter.set_undefined_symbols();
550 filter.set_public_symbols(
false);
552 sorted_undefined_var_symbols =
553 elf_symbols(symtab_->begin(filter), symtab_->end());
558 return *sorted_undefined_var_symbols;
571 if (!undefined_var_symbol_map)
575 (*undefined_var_symbol_map)[symbol->get_name()].push_back(symbol);
577 return *undefined_var_symbol_map;
593 if (!unrefed_var_symbols)
598 unordered_map<string, bool> refed_vars;
599 for (
const auto& variable : vars)
602 refed_vars[sym->get_id_string()] =
true;
604 a && !a->is_main_symbol(); a = a->get_next_alias())
605 refed_vars[a->get_id_string()] =
true;
608 auto filter = symtab_->make_filter();
609 filter.set_variables();
610 for (
const auto& symbol :
613 const std::string sym_id = symbol->get_id_string();
614 if (refed_vars.find(sym_id) == refed_vars.end())
616 bool keep = sym_id_vars_to_keep.empty();
617 for (
const auto&
id : sym_id_vars_to_keep)
626 unrefed_var_symbols->push_back(symbol);
631 return *unrefed_var_symbols;
640 unordered_set<interned_string, hash_interned_string>*
644 return group->get_public_types_pretty_representations();
646 if (pub_type_pretty_reprs_ == 0)
647 pub_type_pretty_reprs_ =
648 new unordered_set<interned_string, hash_interned_string>;
649 return pub_type_pretty_reprs_;
666 std::unordered_set<function_decl*>*
672 auto i = b->priv_->id_fns_map_.find(
id);
673 if (i == b->priv_->id_fns_map_.end())
683 delete pub_type_pretty_reprs_;
693 priv_.reset(
new priv(path, env));
694 init_format_version();
697 corpus::~corpus() =
default;
711 {
return priv_->do_log;}
733 string_tu_map_type::const_iterator i =
734 priv_->path_tu_map.find(tu->get_absolute_path());
736 priv_->path_tu_map[tu->get_absolute_path()] = tu;
738 tu->set_corpus(
this);
746 {
return priv_->members;}
757 string_tu_map_type::const_iterator i =
758 priv_->path_tu_map.find(path);
760 if (i == priv_->path_tu_map.end())
771 {priv_->members.clear();}
778 {
return priv_->types_;}
786 {
return priv_->types_;}
799 {
return priv_->type_per_loc_map_;}
810 return (priv_->get_public_types_pretty_representations()
811 && !priv_->get_public_types_pretty_representations()->empty());
823 priv_->get_public_types_pretty_representations()->insert(s);
842 return (priv_->get_public_types_pretty_representations()->find(s)
843 != priv_->get_public_types_pretty_representations()->end());
856 const vector<type_base_wptr>&
859 if (priv_->types_not_reachable_from_pub_ifaces_.empty())
862 for (vector<type_base_wptr>::const_iterator it =
867 type_base_sptr t(*it);
869 priv_->types_not_reachable_from_pub_ifaces_.push_back(t);
873 return priv_->types_not_reachable_from_pub_ifaces_;
887 {
return priv_->type_per_loc_map_;}
895 {
return priv_->group;}
903 {
return priv_->group;}
918 corpus::init_format_version()
921 (priv_->env.get_config().get_format_major_version_number());
923 (priv_->env.get_config().get_format_minor_version_number());
931 {
return priv_->origin_;}
938 {priv_->origin_ = o;}
946 {
return priv_->format_major_version_number_;}
954 {priv_->format_major_version_number_ = maj;}
963 {
return priv_->format_minor_version_number_;}
972 {priv_->format_minor_version_number_ = min;}
984 {
return priv_->path;}
996 {priv_->path = path;}
1005 const vector<string>&
1007 {
return priv_->needed;}
1019 {priv_->needed = needed;}
1030 {
return priv_->soname;}
1041 {priv_->soname = soname;}
1052 {
return priv_->architecture_name;}
1063 {priv_->architecture_name = arch;}
1077 bool members_empty =
true;
1078 for (translation_units::const_iterator i = priv_->members.begin(),
1079 e = priv_->members.end();
1082 if (!(*i)->is_empty())
1084 members_empty =
false;
1088 return (members_empty
1090 && priv_->soname.empty()
1091 && priv_->needed.empty()
1092 && priv_->architecture_name.empty()
1104 translation_units::const_iterator i, j;
1122 {priv_->symtab_ = symtab;}
1127 const symtab_reader::symtab_sptr&
1129 {
return priv_->symtab_;}
1136 {
return priv_->get_fun_symbol_map();}
1146 {
return priv_->get_undefined_fun_symbol_map();}
1157 {
return priv_->get_sorted_fun_symbols();}
1166 {
return priv_->get_sorted_undefined_fun_symbols();}
1177 {
return priv_->get_sorted_var_symbols();}
1186 {
return priv_->get_sorted_undefined_var_symbols();}
1193 {
return priv_->get_var_symbol_map();}
1203 {
return priv_->get_undefined_var_symbol_map();}
1223 return it->second[0];
1239 const vector<elf_symbol_sptr>& symbols)
1241 if (version.is_empty())
1246 for (elf_symbols::const_iterator s = symbols.begin();
1249 if ((*s)->get_version().is_empty())
1253 for (elf_symbols::const_iterator s = symbols.begin();
1256 if ((*s)->get_version().is_default())
1261 for (elf_symbols::const_iterator s = symbols.begin();
1264 if ((*s)->get_version().str() == version.
str())
1286 string_elf_symbols_map_type::const_iterator it =
1295 return find_symbol_by_version(version, it->second);
1326 return it->second[0];
1344 string_elf_symbols_map_type::const_iterator it =
1353 return find_symbol_by_version(version, it->second);
1382 {
return priv_->fns;}
1398 const std::unordered_set<function_decl*>*
1400 {
return priv_->lookup_functions(
id);}
1402 const std::unordered_set<function_decl*>*
1418 const std::unordered_set<var_decl_sptr>*
1422 auto i = b->priv_->id_vars_map_.find(
id);
1423 if (i == b->priv_->id_vars_map_.end())
1434 const std::unordered_set<var_decl_sptr>*
1452 std::sort(priv_->fns.begin(), priv_->fns.end(), fc);
1454 priv_->sorted_undefined_fns.clear();
1456 for (
auto& f : priv_->undefined_fns)
1457 priv_->sorted_undefined_fns.push_back(f);
1459 std::sort(priv_->sorted_undefined_fns.begin(),
1460 priv_->sorted_undefined_fns.end(), fc);
1480 {
return priv_->vars;}
1490 std::sort(priv_->vars.begin(), priv_->vars.end(), vc);
1492 priv_->sorted_undefined_vars.clear();
1493 for (
auto& f : priv_->undefined_vars)
1494 priv_->sorted_undefined_vars.push_back(f);
1496 std::sort(priv_->sorted_undefined_vars.begin(),
1497 priv_->sorted_undefined_vars.end(), vc);
1508 {
return priv_->undefined_fns;}
1516 {
return priv_->undefined_fns;}
1525 if (priv_->sorted_undefined_fns.empty()
1526 && !priv_->undefined_fns.empty())
1529 const_cast<corpus*>(
this)->sort_functions();
1531 return priv_->sorted_undefined_fns;
1540 {
return priv_->undefined_vars;}
1548 {
return priv_->undefined_vars;}
1557 if (priv_->sorted_undefined_vars.empty()
1558 && !priv_->undefined_vars.empty())
1561 const_cast<corpus*>(
this)->sort_variables();
1563 return priv_->sorted_undefined_vars;
1577 {
return priv_->get_unreferenced_function_symbols();}
1590 {
return priv_->get_unreferenced_variable_symbols();}
1599 {
return priv_->regex_patterns_fns_to_suppress;}
1606 const vector<string>&
1608 {
return priv_->regex_patterns_fns_to_suppress;}
1617 {
return priv_->regex_patterns_vars_to_suppress;}
1624 const vector<string>&
1626 {
return priv_->regex_patterns_vars_to_suppress;}
1636 {
return priv_->regex_patterns_fns_to_keep;}
1644 const vector<string>&
1646 {
return priv_->regex_patterns_fns_to_keep;}
1656 {
return priv_->sym_id_fns_to_keep;}
1664 const vector<string>&
1666 {
return priv_->sym_id_fns_to_keep;}
1676 {
return priv_->regex_patterns_vars_to_keep;}
1684 const vector<string>&
1686 {
return priv_->regex_patterns_vars_to_keep;}
1696 {
return priv_->sym_id_vars_to_keep;}
1704 const vector<string>&
1706 {
return priv_->sym_id_vars_to_keep;}
1714 string sym_name, sym_version;
1718 for (
auto f = priv_->fns.begin(); f != priv_->fns.end(); ++f)
1720 if (b->priv_->keep_wrt_id_of_fns_to_keep(*f)
1721 && b->priv_->keep_wrt_regex_of_fns_to_suppress(*f)
1722 && b->priv_->keep_wrt_regex_of_fns_to_keep(*f))
1723 fns_to_keep.push_back(*f);
1725 priv_->fns = fns_to_keep;
1728 for (
auto v = priv_->vars.begin(); v != priv_->vars.end(); ++v)
1730 if (b->priv_->keep_wrt_id_of_vars_to_keep(*v)
1731 && b->priv_->keep_wrt_regex_of_vars_to_suppress(*v)
1732 && b->priv_->keep_wrt_regex_of_vars_to_keep(*v))
1733 vars_to_keep.push_back(*v);
1735 priv_->vars = vars_to_keep;
1751 if (!priv_->exported_decls_builder)
1753 priv_->exported_decls_builder.reset
1756 priv_->regex_patterns_fns_to_suppress,
1757 priv_->regex_patterns_vars_to_suppress,
1758 priv_->regex_patterns_fns_to_keep,
1759 priv_->regex_patterns_vars_to_keep,
1760 priv_->sym_id_fns_to_keep,
1761 priv_->sym_id_vars_to_keep));
1763 return priv_->exported_decls_builder;
1777 (
static_cast<uint32_t
>(l) | static_cast<uint32_t>(r));
1805 (
static_cast<uint32_t
>(l) & static_cast<uint32_t>(r));
1827 struct corpus_group::priv
1829 std::set<string> corpora_paths;
1830 corpora_type corpora;
1831 istring_function_decl_ptr_map_type fns_map;
1833 istring_var_decl_ptr_map_type vars_map;
1839 unordered_map<string, elf_symbol_sptr> unrefed_fun_symbol_map;
1841 bool unrefed_fun_symbols_built;
1842 unordered_map<string, elf_symbol_sptr> unrefed_var_symbol_map;
1844 bool unrefed_var_symbols_built;
1845 unordered_set<interned_string, hash_interned_string> pub_type_pretty_reprs_;
1848 : unrefed_fun_symbols_built(),
1849 unrefed_var_symbols_built()
1859 for (elf_symbols::const_iterator e =
1860 syms.begin(); e != syms.end(); ++e)
1862 string sym_id = (*e)->get_id_string();
1863 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1864 unrefed_fun_symbol_map.find(sym_id);
1865 if (j != unrefed_fun_symbol_map.end())
1868 unrefed_fun_symbol_map[sym_id] = *e;
1869 unrefed_fun_symbols.push_back(*e);
1871 unrefed_fun_symbols_built =
true;
1881 for (elf_symbols::const_iterator e =
1882 syms.begin(); e != syms.end(); ++e)
1884 string sym_id = (*e)->get_id_string();
1885 unordered_map<string, elf_symbol_sptr>::const_iterator j =
1886 unrefed_var_symbol_map.find(sym_id);
1887 if (j != unrefed_var_symbol_map.end())
1890 unrefed_var_symbol_map[sym_id] = *e;
1891 unrefed_var_symbols.push_back(*e);
1893 unrefed_var_symbols_built =
true;
1902 corpus_group::corpus_group(
const environment& env,
const string& path =
"")
1903 :
corpus(env, path), priv_(new priv)
1919 if (!corp->get_path().empty()
1925 corp_arch = corp->get_architecture_name();
1926 if (cur_arch.empty())
1928 else if (cur_arch != corp_arch)
1930 std::cerr <<
"corpus '" << corp->get_path() <<
"'"
1931 <<
" has architecture '" << corp_arch <<
"'"
1932 <<
" but expected '" << cur_arch <<
"'\n";
1936 priv_->corpora.push_back(corp);
1937 corp->set_group(
this);
1938 priv_->corpora_paths.insert(corp->get_path());
1955 if (priv_->corpora_paths.find(path) != priv_->corpora_paths.end())
1964 const corpus_group::corpora_type&
1966 {
return priv_->corpora;}
1983 return corpus_sptr();
2005 if (priv_->fns.empty())
2006 for (corpora_type::const_iterator i =
get_corpora().begin();
2011 for (corpus::functions::const_iterator f = c->get_functions().begin();
2012 f != c->get_functions().end();
2016 istring_function_decl_ptr_map_type::const_iterator j =
2017 priv_->fns_map.find(fid);
2019 if (j != priv_->fns_map.end())
2023 priv_->fns_map[fid] = *f;
2025 priv_->fns.push_back(*f);
2043 if (priv_->vars.empty())
2044 for (corpora_type::const_iterator i =
get_corpora().begin();
2049 for (corpus::variables::const_iterator v = c->get_variables().begin();
2050 v != c->get_variables().end();
2054 istring_var_decl_ptr_map_type::const_iterator j =
2055 priv_->vars_map.find(vid);
2057 if (j != priv_->vars_map.end())
2061 priv_->vars_map[vid] = *v;
2063 priv_->vars.push_back(*v);
2077 if (priv_->var_symbol_map.empty())
2078 for (corpora_type::const_iterator i =
get_corpora().begin();
2081 priv_->var_symbol_map.insert((*i)->get_var_symbol_map().begin(),
2082 (*i)->get_var_symbol_map().end());
2084 return priv_->var_symbol_map;
2094 if (priv_->fun_symbol_map.empty())
2095 for (corpora_type::const_iterator i =
get_corpora().begin();
2098 priv_->fun_symbol_map.insert((*i)->get_fun_symbol_map().begin(),
2099 (*i)->get_fun_symbol_map().end());
2101 return priv_->fun_symbol_map;
2111 if (priv_->sorted_fun_symbols.empty()
2114 for (corpora_type::const_iterator i =
get_corpora().begin();
2119 for (string_elf_symbols_map_type::const_iterator j =
2120 c->get_fun_symbol_map().begin();
2121 j != c->get_fun_symbol_map().begin();
2123 priv_->sorted_fun_symbols.insert(priv_->sorted_fun_symbols.end(),
2127 comp_elf_symbols_functor comp;
2128 std::sort(priv_->sorted_fun_symbols.begin(),
2129 priv_->sorted_fun_symbols.end(),
2133 return priv_->sorted_fun_symbols;
2143 if (priv_->sorted_var_symbols.empty()
2146 for (corpora_type::const_iterator i =
get_corpora().begin();
2151 for (string_elf_symbols_map_type::const_iterator j =
2152 c->get_var_symbol_map().begin();
2153 j != c->get_var_symbol_map().begin();
2155 priv_->sorted_var_symbols.insert(priv_->sorted_var_symbols.end(),
2159 comp_elf_symbols_functor comp;
2160 std::sort(priv_->sorted_var_symbols.begin(),
2161 priv_->sorted_var_symbols.end(),
2165 return priv_->sorted_var_symbols;
2182 if (!priv_->unrefed_fun_symbols_built)
2183 if (priv_->unrefed_fun_symbols.empty())
2185 for (corpora_type::const_iterator i =
get_corpora().begin();
2190 for (elf_symbols::const_iterator e =
2191 c->get_unreferenced_function_symbols().begin();
2192 e != c->get_unreferenced_function_symbols().end();
2195 string sym_id = (*e)->get_id_string();
2196 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2197 priv_->unrefed_fun_symbol_map.find(sym_id);
2198 if (j != priv_->unrefed_fun_symbol_map.end())
2201 priv_->unrefed_fun_symbol_map[sym_id] = *e;
2202 priv_->unrefed_fun_symbols.push_back(*e);
2205 priv_->unrefed_fun_symbols_built =
true;
2208 return priv_->unrefed_fun_symbols;
2225 if (!priv_->unrefed_var_symbols_built)
2226 if (priv_->unrefed_var_symbols.empty())
2228 for (corpora_type::const_iterator i =
get_corpora().begin();
2233 for (elf_symbols::const_iterator e =
2234 c->get_unreferenced_variable_symbols().begin();
2235 e != c->get_unreferenced_variable_symbols().end();
2238 string sym_id = (*e)->get_id_string();
2239 unordered_map<string, elf_symbol_sptr>::const_iterator j =
2240 priv_->unrefed_var_symbol_map.find(sym_id);
2241 if (j != priv_->unrefed_var_symbol_map.end())
2244 priv_->unrefed_var_symbol_map[sym_id] = *e;
2245 priv_->unrefed_var_symbols.push_back(*e);
2248 priv_->unrefed_var_symbols_built =
true;
2251 return priv_->unrefed_var_symbols;
2256 unordered_set<interned_string, hash_interned_string>*
2258 {
return &priv_->pub_type_pretty_reprs_;}
2288 const std::unordered_set<function_decl*>*
2292 if (
auto fns = corp->lookup_functions(
id))
2316 const std::unordered_set<function_decl*>*
2320 if (
const auto& fns = corp->lookup_functions(
id))
2336 const std::unordered_set<var_decl_sptr>*
2340 if (
const auto& vars = corp->lookup_variables(
id))
2356 const std::unordered_set<var_decl_sptr>*
2360 if (
const auto& vars = corp->lookup_variables(
id))
2374 {
return std::dynamic_pointer_cast<
corpus_group>(corpus);}
const variables & get_sorted_undefined_variables() const
Getter of the sorted vector of undefined variables 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.
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 string_elf_symbols_map_type & get_var_symbol_map() const
Getter for the variable symbols map.
void sort_functions()
Sort the set of functions exported by this 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...
const variables_set & get_undefined_variables() const
Getter of the undefined variables of the corpus.
virtual const elf_symbols & get_sorted_var_symbols() const
Getter for the sorted vector of variable symbols for this corpus.
type_maps & get_types()
Get the maps that associate a name to a certain kind of type.
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 & str() const
Getter for the version name.
void set_path(const string &)
Set the file path associated to the corpus file.
corpus_group_sptr is_corpus_group(const corpus_sptr &corpus)
Test if a corpus is a corpus_group.
const elf_symbols & get_sorted_undefined_fun_symbols() const
Getter for a sorted vector of the function symbols undefined in this corpus.
string & get_format_minor_version_number() const
Getter of the minor version number of the abixml serialization format.
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.
void set_needed(const vector< string > &)
Setter of the needed property of the corpus.
bool operator==(const corpus &) const
Compare the current corpus against another one.
const vector< type_base_wptr > & get_types_sorted_by_name() const
Getter of all types types sorted by their pretty representation.
const elf_symbols & get_unreferenced_function_symbols() const
Return a list of symbols that are not referenced by any function of corpus::get_functions().
An abstraction helper for type declarations.
virtual const elf_symbols & get_unreferenced_variable_symbols() const
Get the set of variable symbols not referenced by any debug info, from all the corpora of the current...
virtual const 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...
void set_architecture_name(const string &)
Setter for the architecture name of the corpus.
A comparison functor for pointers to var_decl.
type_maps & get_types()
Get the maps that associate a name to a certain kind of type.
Helper class to allow range-for loops on symtabs for C++11 and later code. It serves as a proxy for t...
This is the abstraction of a set of translation units (themselves seen as bundles of unitary abi arte...
virtual const std::unordered_set< function_decl * > * lookup_functions(const interned_string &id) const
Lookup the function which has a given function ID.
const translation_units & get_translation_units() const
Return the list of translation units of the current corpus.
virtual const variables & get_variables() const
Return the public decl table of the global variables of the current corpus.
void set_format_minor_version_number(const string &)
Setter of the minor version number of the abixml serialization format.
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...
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.
virtual const functions & get_functions() const
Return the functions public decl table of the current corpus.
const functions & exported_functions() const
Getter for the reference to the vector of exported functions. This vector is shared with with the cor...
std::set< translation_unit_sptr, shared_translation_unit_comp > translation_units
Convenience typedef for an ordered set of translation_unit_sptr.
vector< string > & get_regex_patterns_of_vars_to_keep()
Accessor for the regex patterns describing the variables to keep into the public decl table...
virtual const corpus::functions & get_functions() const
Get the functions exported by the corpora of the current corpus group.
bool empty() const
Test if the current instance of interned_string is empty.
const elf_symbols & get_sorted_var_symbols() const
Getter for the sorted vector of variable symbols for this corpus.
void sort_variables()
Sort the set of variables exported by this corpus.
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
virtual const corpus::variables & get_variables() const
Get the global variables exported by the corpora of the current corpus group.
const translation_unit_sptr find_translation_unit(const string &path) const
Find the translation unit that has a given path.
const string_elf_symbols_map_type & get_undefined_var_symbol_map() const
Return a map from name to undefined variable symbol for this corpus.
shared_ptr< translation_unit > translation_unit_sptr
Convenience typedef for a shared pointer on a translation_unit type.
virtual const interned_string & get_name() const
Getter for the name of the current decl.
const string & get_name() const
Getter for the name of the elf_symbol.
vector< string > & get_sym_ids_of_vars_to_keep()
Getter for the vector of variable symbol IDs to keep.
void set_soname(const string &)
Setter for the soname property of the corpus.
string & get_format_major_version_number() const
Getter of the major version number of the abixml serialization format.
This contains the declarations for the symtab reader.
const corpora_type & get_corpora() const
Getter of the vector of corpora held by the current corpus_group.
Abstracts a variable declaration.
A functor to compare instances of var_decl base on their qualified names.
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.
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
const vector< string > & get_needed() const
Getter of the needed property of the corpus.
virtual const elf_symbols & get_sorted_fun_symbols() const
Return a sorted vector of function symbols for this 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.
corpus::origin operator&=(corpus::origin &l, corpus::origin r)
Bitwise &= operator for the corpus::origin type.
type_maps & get_type_per_loc_map()
Get the maps that associate a location string to a certain kind of type.
vector< var_decl_sptr > variables
Convenience typedef for std::vector
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
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...
void maybe_drop_some_exported_decls()
After the set of exported functions and variables have been built, consider all the tunables that con...
Toplevel namespace for libabigail.
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.
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...
origin
This abstracts where the corpus comes from. That is, either it has been read from the native xml form...
This contains the private implementation of the suppression engine of libabigail. ...
~priv()
Destructor of the corpus::priv type.
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...
Abstraction for a function declaration.
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:...
void add_corpus(const corpus_sptr &)
Add a new corpus to the current instance of corpus_group.
Types of the main internal representation of libabigail.
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.
vector< string > strings_type
A convenience typedef for std::vector.
const elf_symbols & get_sorted_undefined_fun_symbols() const
Getter for a sorted vector of the function symbols undefined in this corpus.
void add(const translation_unit_sptr &)
Add a translation unit to the current ABI Corpus.
unordered_map< string, const function_decl * > str_fn_ptr_map_type
Convenience typedef for a hash map of string and pointer to function_decl.
The type of the private data of corpus::exported_decls_builder type.
const functions_set & get_undefined_functions() const
Getter of the undefined functions of the corpus.
This is a type that aggregates maps of all the kinds of types that are supported by libabigail...
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.
Abstraction of an elf symbol.
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
This file contains the declarations of the entry points to de-serialize an instance of abigail::trans...
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 elf_symbol_sptr lookup_function_symbol(const string &n) const
Look in the function symbols map for a symbol with a given name.
virtual bool is_empty() const
Test if the current corpus group is empty.
void drop_translation_units()
Erase the translation units contained in this in-memory object.
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
const elf_symbols & get_sorted_fun_symbols() const
Return a sorted vector of function symbols for this corpus.
std::shared_ptr< regex_t > regex_t_sptr
A convenience typedef for a shared pointer of regex_t.
#define ABG_ASSERT(cond)
This is a wrapper around the 'assert' glibc call. It allows for its argument to have side effects...
interned_string intern(const string &) const
Do intern a string.
const string_elf_symbols_map_type & get_fun_symbol_map() const
Return a map from name to function symbol for 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.
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 record_type_as_reachable_from_public_interfaces(const type_base &)
Record a type as being reachable from public interfaces (global functions and variables).
Abstracts the building of the set of exported variables and functions.
const symtab_reader::symtab_sptr & get_symtab() const
Getter for the symtab object.
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.
string & get_path() const
Get the file path associated to the corpus file.
const corpus_sptr get_main_corpus() const
Getter of the first corpus added to this Group.
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 string_elf_symbols_map_type & get_var_symbol_map() const
Return a map from name to variable symbol for this corpus.
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build and return the pretty representation of this variable.
Equality functor for instances of function_decl.
vector< string > & get_sym_ids_of_fns_to_keep()
Getter for the vector of function symbol IDs to keep.
bool maybe_add_var_to_exported_vars(const var_decl_sptr &)
Consider at all the tunables that control wether a variable should be added to the set of exported va...
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
const environment & get_environment() const
Getter of the enviroment of the corpus.
corpus::origin operator|=(corpus::origin &l, corpus::origin r)
Bitwise |= operator for the corpus::origin type.
vector< string > & get_regex_patterns_of_fns_to_suppress()
Accessor for the regex patterns describing the functions to drop from the public decl table...
void set_origin(origin)
Setter for the origin of the corpus.
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...
The abstraction of an interned string.
vector< string > & get_regex_patterns_of_vars_to_suppress()
Accessor for the regex patterns describing the variables to drop from the public decl table...
std::unordered_set< function_decl * > * lookup_functions(const interned_string &id)
Lookup the function which has a given function ID.
const functions & get_sorted_undefined_functions() const
Getter of the sorted vector of undefined functions of the corpus.
void set_format_major_version_number(const string &)
Setter of the major version number of the abixml serialization format.
bool type_is_reachable_from_public_interfaces(const type_base &) const
Test if a type is reachable from public interfaces (global functions and variables).
The abstraction of the version of an ELF symbol.
std::unordered_set< var_decl_sptr > variables_set
Convenience typedef for std::unordered_set.
const corpus_group * get_group() const
Getter of the group this corpus is a member of.
The private data of the corpus type.
Abstraction of a group of corpora.
const elf_symbols & get_sorted_undefined_var_symbols() const
Getter for a sorted vector of the variable symbols undefined in this corpus.
origin get_origin() const
Getter for the origin of the corpus.
The private data and functions of the abigail::ir::corpus type.
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...
const variables & exported_variables() const
Getter for the reference to the vector of exported variables. This vector is shared with with the cor...
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...
const string & get_soname()
Getter for the soname property of the corpus.
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
const elf_symbols & get_sorted_undefined_var_symbols() const
Getter for a sorted vector of the variable symbols undefined in this corpus.
void set_symtab(symtab_reader::symtab_sptr)
Setter for the symtab object.
virtual ~corpus_group()
Desctructor of the corpus_group type.
const string & get_architecture_name() const
Getter for the architecture name of the corpus.
virtual const std::unordered_set< function_decl * > * lookup_functions(const interned_string &id) const
Lookup the function which has a given function ID.
virtual const string_elf_symbols_map_type & get_fun_symbol_map() const
Getter for the function symbols map.
bool has_corpus(const string &)
Test if a corpus of a given path has been added to the 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...
bool do_log() const
Test if logging was requested.
std::unordered_set< const function_decl * > functions_set
Convenience typedef for std::unordered_set
virtual const std::unordered_set< var_decl_sptr > * lookup_variables(const interned_string &id) const
Lookup the exported variables which all have a given variable ID.
virtual const std::unordered_set< var_decl_sptr > * lookup_variables(const interned_string &id) const
Lookup the exported variables which all have a given variable ID.
hash_t hash(uint64_t v, uint64_t seed)
Hash an integer value and combine it with a hash previously computed.
vector< const function_decl * > functions
Convenience typedef for std::vector
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.
shared_ptr< exported_decls_builder > exported_decls_builder_sptr
Convenience typedef for shared_ptr.
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)...