• Home
  • Raw
  • Download

Lines Matching +full:vc +full:- +full:vars

1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- mode: C++ -*-
4 // Copyright (C) 2013-2021 Red Hat, Inc.
17 #include "abg-internal.h"
22 #include "abg-corpus.h"
23 #include "abg-ir.h"
24 #include "abg-reader.h"
25 #include "abg-sptr-utils.h"
26 #include "abg-symtab-reader.h"
27 #include "abg-tools-utils.h"
28 #include "abg-writer.h"
33 #include "abg-corpus-priv.h"
34 #include "abg-ir-priv.h"
53 /// @param vars a reference to the vector of exported variables.
77 variables& vars, in exported_decls_builder() argument
84 : priv_(new priv(fns, vars, in exported_decls_builder()
101 {return priv_->fns_;} in exported_functions()
110 {return priv_->fns_;} in exported_functions()
119 {return priv_->vars_;} in exported_variables()
128 {return priv_->vars_;} in exported_variables()
138 if (!fn->get_is_in_public_symbol_table()) in maybe_add_fn_to_exported_fns()
141 const string& fn_id = priv_->get_id(*fn); in maybe_add_fn_to_exported_fns()
144 if (priv_->fn_is_in_id_fns_map(fn)) in maybe_add_fn_to_exported_fns()
147 if (priv_->keep_wrt_id_of_fns_to_keep(fn) in maybe_add_fn_to_exported_fns()
148 && priv_->keep_wrt_regex_of_fns_to_suppress(fn) in maybe_add_fn_to_exported_fns()
149 && priv_->keep_wrt_regex_of_fns_to_keep(fn)) in maybe_add_fn_to_exported_fns()
150 priv_->add_fn_to_exported(fn); in maybe_add_fn_to_exported_fns()
161 if (!var->get_is_in_public_symbol_table()) in maybe_add_var_to_exported_vars()
164 const string& var_id = priv_->get_id(*var); in maybe_add_var_to_exported_vars()
167 if (priv_->var_id_is_in_id_var_map(var_id)) in maybe_add_var_to_exported_vars()
170 if (priv_->keep_wrt_id_of_vars_to_keep(var) in maybe_add_var_to_exported_vars()
171 && priv_->keep_wrt_regex_of_vars_to_suppress(var) in maybe_add_var_to_exported_vars()
172 && priv_->keep_wrt_regex_of_vars_to_keep(var)) in maybe_add_var_to_exported_vars()
173 priv_->add_var_to_exported(var); in maybe_add_var_to_exported_vars()
217 first_name = first->get_linkage_name(); in operator ()()
219 first_name = first->get_name(); in operator ()()
222 second_name = second->get_linkage_name(); in operator ()()
224 second_name = second->get_name(); in operator ()()
251 first_name = first->get_linkage_name(); in operator ()()
254 first_name = first->get_pretty_representation(); in operator ()()
255 second_name = second->get_pretty_representation(); in operator ()()
261 second_name = second->get_linkage_name(); in operator ()()
265 second_name = second->get_pretty_representation(); in operator ()()
266 first_name = first->get_pretty_representation(); in operator ()()
316 auto filter = symtab_->make_filter(); in get_sorted_fun_symbols()
318 sorted_fun_symbols = elf_symbols(symtab_->begin(filter), symtab_->end()); in get_sorted_fun_symbols()
337 (*fun_symbol_map)[symbol->get_name()].push_back(symbol); in get_fun_symbol_map()
352 auto filter = symtab_->make_filter(); in get_sorted_undefined_fun_symbols()
358 elf_symbols(symtab_->begin(filter), symtab_->end()); in get_sorted_undefined_fun_symbols()
377 (*undefined_fun_symbol_map)[symbol->get_name()].push_back(symbol); in get_undefined_fun_symbol_map()
403 if (elf_symbol_sptr sym = function->get_symbol()) in get_unreferenced_function_symbols()
405 refed_funs[sym->get_id_string()] = true; in get_unreferenced_function_symbols()
406 for (elf_symbol_sptr a = sym->get_next_alias(); in get_unreferenced_function_symbols()
407 a && !a->is_main_symbol(); a = a->get_next_alias()) in get_unreferenced_function_symbols()
408 refed_funs[a->get_id_string()] = true; in get_unreferenced_function_symbols()
411 auto filter = symtab_->make_filter(); in get_unreferenced_function_symbols()
416 const std::string sym_id = symbol->get_id_string(); in get_unreferenced_function_symbols()
429 unrefed_fun_symbols->push_back(symbol); in get_unreferenced_function_symbols()
449 auto filter = symtab_->make_filter(); in get_sorted_var_symbols()
452 sorted_var_symbols = elf_symbols(symtab_->begin(filter), symtab_->end()); in get_sorted_var_symbols()
471 (*var_symbol_map)[symbol->get_name()].push_back(symbol); in get_var_symbol_map()
486 auto filter = symtab_->make_filter(); in get_sorted_undefined_var_symbols()
492 elf_symbols(symtab_->begin(filter), symtab_->end()); in get_sorted_undefined_var_symbols()
511 (*undefined_var_symbol_map)[symbol->get_name()].push_back(symbol); in get_undefined_var_symbol_map()
535 for (const auto& variable : vars) in get_unreferenced_variable_symbols()
536 if (elf_symbol_sptr sym = variable->get_symbol()) in get_unreferenced_variable_symbols()
538 refed_vars[sym->get_id_string()] = true; in get_unreferenced_variable_symbols()
539 for (elf_symbol_sptr a = sym->get_next_alias(); in get_unreferenced_variable_symbols()
540 a && !a->is_main_symbol(); a = a->get_next_alias()) in get_unreferenced_variable_symbols()
541 refed_vars[a->get_id_string()] = true; in get_unreferenced_variable_symbols()
544 auto filter = symtab_->make_filter(); in get_unreferenced_variable_symbols()
549 const std::string sym_id = symbol->get_id_string(); in get_unreferenced_variable_symbols()
562 unrefed_var_symbols->push_back(symbol); in get_unreferenced_variable_symbols()
580 return group->get_public_types_pretty_representations(); in get_public_types_pretty_representations()
612 {return priv_->env;} in get_environment()
619 {return priv_->env;} in get_environment()
627 priv_->env = e; in set_environment()
644 if (!tu->get_environment()) in add()
645 tu->set_environment(get_environment()); in add()
647 ABG_ASSERT(tu->get_environment() == get_environment()); in add()
649 ABG_ASSERT(priv_->members.insert(tu).second); in add()
651 if (!tu->get_absolute_path().empty()) in add()
653 // Update the path -> translation_unit map. in add()
655 priv_->path_tu_map.find(tu->get_absolute_path()); in add()
656 ABG_ASSERT(i == priv_->path_tu_map.end()); in add()
657 priv_->path_tu_map[tu->get_absolute_path()] = tu; in add()
660 tu->set_corpus(this); in add()
668 {return priv_->members;} in get_translation_units()
680 priv_->path_tu_map.find(path); in find_translation_unit()
682 if (i == priv_->path_tu_map.end()) in find_translation_unit()
684 return i->second; in find_translation_unit()
687 /// Erase the translation units contained in this in-memory object.
689 /// Note that the on-disk archive file that contains the serialized
693 {priv_->members.clear();} in drop_translation_units()
700 {return priv_->types_;} in get_types()
708 {return priv_->types_;} in get_types()
721 {return priv_->type_per_loc_map_;} in get_type_per_loc_map()
724 /// the recording of non-reachable types) is activated for the
732 return (priv_->get_public_types_pretty_representations() in recording_types_reachable_from_public_interface_supported()
733 && !priv_->get_public_types_pretty_representations()->empty()); in recording_types_reachable_from_public_interface_supported()
744 interned_string s = t.get_environment()->intern(repr); in record_type_as_reachable_from_public_interfaces()
745 priv_->get_public_types_pretty_representations()->insert(s); in record_type_as_reachable_from_public_interfaces()
762 interned_string s = t.get_environment()->intern(repr); in type_is_reachable_from_public_interfaces()
764 return (priv_->get_public_types_pretty_representations()->find(s) in type_is_reachable_from_public_interfaces()
765 != priv_->get_public_types_pretty_representations()->end()); in type_is_reachable_from_public_interfaces()
771 /// Note that for this to be non-empty, the libabigail reader that
781 if (priv_->types_not_reachable_from_pub_ifaces_.empty()) in get_types_not_reachable_from_public_interfaces()
791 priv_->types_not_reachable_from_pub_ifaces_.push_back(t); in get_types_not_reachable_from_public_interfaces()
795 return priv_->types_not_reachable_from_pub_ifaces_; in get_types_not_reachable_from_public_interfaces()
809 {return priv_->type_per_loc_map_;} in get_type_per_loc_map()
817 {return priv_->group;} in get_group()
825 {return priv_->group;} in get_group()
832 {priv_->group = g;} in set_group()
842 if (priv_->env) in init_format_version()
845 (priv_->env->get_config().get_format_major_version_number()); in init_format_version()
847 (priv_->env->get_config().get_format_minor_version_number()); in init_format_version()
856 {return priv_->origin_;} in get_origin()
863 {priv_->origin_ = o;} in set_origin()
871 {return priv_->format_major_version_number_;} in get_format_major_version_number()
879 {priv_->format_major_version_number_ = maj;} in set_format_major_version_number()
888 {return priv_->format_minor_version_number_;} in get_format_minor_version_number()
897 {priv_->format_minor_version_number_ = min;} in set_format_minor_version_number()
904 /// the corpus object into the on-disk file at this path.
909 {return priv_->path;} in get_path()
916 /// the corpus object into the on-disk file at this path.
921 {priv_->path = path;} in set_path()
932 {return priv_->needed;} in get_needed()
944 {priv_->needed = needed;} in set_needed()
955 {return priv_->soname;} in get_soname()
966 {priv_->soname = soname;} in set_soname()
977 {return priv_->architecture_name;} in get_architecture_name()
988 {priv_->architecture_name = arch;} in set_architecture_name()
992 /// - all translation units (members) are empty
993 /// - the maps function and variable symbols are not having entries
994 /// - for shared libraries:
995 /// - the soname is empty
996 /// - there are no DT_NEEDED entries
1003 for (translation_units::const_iterator i = priv_->members.begin(), in is_empty()
1004 e = priv_->members.end(); in is_empty()
1007 if (!(*i)->is_empty()) in is_empty()
1014 && (!get_symtab() || !get_symtab()->has_symbols()) in is_empty()
1015 && priv_->soname.empty() in is_empty()
1016 && priv_->needed.empty()); in is_empty()
1045 {priv_->symtab_ = symtab;} in set_symtab()
1052 {return priv_->symtab_;} in get_symtab()
1059 {return priv_->get_fun_symbol_map();} in get_fun_symbol_map()
1069 {return priv_->get_undefined_fun_symbol_map();} in get_undefined_fun_symbol_map()
1080 {return priv_->get_sorted_fun_symbols();} in get_sorted_fun_symbols()
1089 {return priv_->get_sorted_undefined_fun_symbols();} in get_sorted_undefined_fun_symbols()
1100 {return priv_->get_sorted_var_symbols();} in get_sorted_var_symbols()
1109 {return priv_->get_sorted_undefined_var_symbols();} in get_sorted_undefined_var_symbols()
1116 {return priv_->get_var_symbol_map();} in get_var_symbol_map()
1126 {return priv_->get_undefined_var_symbol_map();} in get_undefined_var_symbol_map()
1143 return it->second[0]; in lookup_function_symbol()
1149 /// This is a sub-routine for corpus::lookup_function_symbol() and
1169 if ((*s)->get_version().is_empty()) in find_symbol_by_version()
1176 if ((*s)->get_version().is_default()) in find_symbol_by_version()
1184 if ((*s)->get_version().str() == version.str()) in find_symbol_by_version()
1211 return find_symbol_by_version(version, it->second); in lookup_function_symbol()
1239 return it->second[0]; in lookup_variable_symbol()
1262 return find_symbol_by_version(version, it->second); in lookup_variable_symbol()
1291 {return priv_->fns;} in get_functions()
1312 b->priv_->id_fns_map_.find(id); in lookup_functions()
1313 if (i == b->priv_->id_fns_map_.end()) in lookup_functions()
1315 return &i->second; in lookup_functions()
1326 std::sort(priv_->fns.begin(), priv_->fns.end(), fc); in sort_functions()
1346 {return priv_->vars;} in get_variables()
1355 var_comp vc; in sort_variables() local
1356 std::sort(priv_->vars.begin(), priv_->vars.end(), vc); in sort_variables()
1370 {return priv_->get_unreferenced_function_symbols();} in get_unreferenced_function_symbols()
1383 {return priv_->get_unreferenced_variable_symbols();} in get_unreferenced_variable_symbols()
1392 {return priv_->regex_patterns_fns_to_suppress;} in get_regex_patterns_of_fns_to_suppress()
1401 {return priv_->regex_patterns_fns_to_suppress;} in get_regex_patterns_of_fns_to_suppress()
1410 {return priv_->regex_patterns_vars_to_suppress;} in get_regex_patterns_of_vars_to_suppress()
1419 {return priv_->regex_patterns_vars_to_suppress;} in get_regex_patterns_of_vars_to_suppress()
1429 {return priv_->regex_patterns_fns_to_keep;} in get_regex_patterns_of_fns_to_keep()
1439 {return priv_->regex_patterns_fns_to_keep;} in get_regex_patterns_of_fns_to_keep()
1449 {return priv_->sym_id_fns_to_keep;} in get_sym_ids_of_fns_to_keep()
1459 {return priv_->sym_id_fns_to_keep;} in get_sym_ids_of_fns_to_keep()
1469 {return priv_->regex_patterns_vars_to_keep;} in get_regex_patterns_of_vars_to_keep()
1479 {return priv_->regex_patterns_vars_to_keep;} in get_regex_patterns_of_vars_to_keep()
1489 {return priv_->sym_id_vars_to_keep;} in get_sym_ids_of_vars_to_keep()
1499 {return priv_->sym_id_vars_to_keep;} in get_sym_ids_of_vars_to_keep()
1511 for (vector<function_decl*>::iterator f = priv_->fns.begin(); in maybe_drop_some_exported_decls()
1512 f != priv_->fns.end(); in maybe_drop_some_exported_decls()
1515 if (b->priv_->keep_wrt_id_of_fns_to_keep(*f) in maybe_drop_some_exported_decls()
1516 && b->priv_->keep_wrt_regex_of_fns_to_suppress(*f) in maybe_drop_some_exported_decls()
1517 && b->priv_->keep_wrt_regex_of_fns_to_keep(*f)) in maybe_drop_some_exported_decls()
1520 priv_->fns = fns_to_keep; in maybe_drop_some_exported_decls()
1523 for (vector<var_decl*>::iterator v = priv_->vars.begin(); in maybe_drop_some_exported_decls()
1524 v != priv_->vars.end(); in maybe_drop_some_exported_decls()
1527 if (b->priv_->keep_wrt_id_of_vars_to_keep(*v) in maybe_drop_some_exported_decls()
1528 && b->priv_->keep_wrt_regex_of_vars_to_suppress(*v) in maybe_drop_some_exported_decls()
1529 && b->priv_->keep_wrt_regex_of_vars_to_keep(*v)) in maybe_drop_some_exported_decls()
1532 priv_->vars = vars_to_keep; in maybe_drop_some_exported_decls()
1548 if (!priv_->exported_decls_builder) in get_exported_decls_builder()
1550 priv_->exported_decls_builder.reset in get_exported_decls_builder()
1551 (new exported_decls_builder(priv_->fns, in get_exported_decls_builder()
1552 priv_->vars, in get_exported_decls_builder()
1553 priv_->regex_patterns_fns_to_suppress, in get_exported_decls_builder()
1554 priv_->regex_patterns_vars_to_suppress, in get_exported_decls_builder()
1555 priv_->regex_patterns_fns_to_keep, in get_exported_decls_builder()
1556 priv_->regex_patterns_vars_to_keep, in get_exported_decls_builder()
1557 priv_->sym_id_fns_to_keep, in get_exported_decls_builder()
1558 priv_->sym_id_vars_to_keep)); in get_exported_decls_builder()
1560 return priv_->exported_decls_builder; in get_exported_decls_builder()
1565 /// @param l the left-hand side operand of the | operation.
1567 /// @param r the right-hand side operand of the | operation.
1579 /// @param l the left-hand side operand for the |= operation.
1581 /// @param r the right-hand side operand for the |= operation.
1593 /// @param l the left-hand side operand of the & operation.
1595 /// @param r the right-hand side operand of the & operation.
1607 /// @param l the left-hand side operand of the &= operation.
1609 /// @param r the right-hand side operand of the &= operation.
1630 vector<var_decl*> vars; member
1658 string sym_id = (*e)->get_id_string(); in add_unref_fun_symbols()
1680 string sym_id = (*e)->get_id_string(); in add_unref_var_symbols()
1714 if (environment* corp_env = corp->get_environment()) in add_corpus()
1718 set_environment(corp->get_environment()); in add_corpus()
1722 corp_arch = corp->get_architecture_name(); in add_corpus()
1727 std::cerr << "corpus '" << corp->get_path() << "'" in add_corpus()
1733 priv_->corpora.push_back(corp); in add_corpus()
1734 corp->set_group(this); in add_corpus()
1738 priv_->add_unref_fun_symbols(get_unreferenced_function_symbols()); in add_corpus()
1739 priv_->add_unref_var_symbols(get_unreferenced_variable_symbols()); in add_corpus()
1748 {return priv_->corpora;} in get_corpora()
1755 {return const_cast<corpus_group*>(this)->get_main_corpus();} in get_main_corpus()
1787 if (priv_->fns.empty()) in get_functions()
1793 for (corpus::functions::const_iterator f = c->get_functions().begin(); in get_functions()
1794 f != c->get_functions().end(); in get_functions()
1797 interned_string fid = (*f)->get_id(); in get_functions()
1799 priv_->fns_map.find(fid); in get_functions()
1801 if (j != priv_->fns_map.end()) in get_functions()
1805 priv_->fns_map[fid] = *f; in get_functions()
1807 priv_->fns.push_back(*f); in get_functions()
1811 return priv_->fns; in get_functions()
1825 if (priv_->vars.empty()) in get_variables()
1831 for (corpus::variables::const_iterator v = c->get_variables().begin(); in get_variables()
1832 v != c->get_variables().end(); in get_variables()
1835 interned_string vid = (*v)->get_id(); in get_variables()
1837 priv_->vars_map.find(vid); in get_variables()
1839 if (j != priv_->vars_map.end()) in get_variables()
1843 priv_->vars_map[vid] = *v; in get_variables()
1845 priv_->vars.push_back(*v); in get_variables()
1849 return priv_->vars; in get_variables()
1859 if (priv_->var_symbol_map.empty()) in get_var_symbol_map()
1863 priv_->var_symbol_map.insert((*i)->get_var_symbol_map().begin(), in get_var_symbol_map()
1864 (*i)->get_var_symbol_map().end()); in get_var_symbol_map()
1866 return priv_->var_symbol_map; in get_var_symbol_map()
1876 if (priv_->fun_symbol_map.empty()) in get_fun_symbol_map()
1880 priv_->fun_symbol_map.insert((*i)->get_fun_symbol_map().begin(), in get_fun_symbol_map()
1881 (*i)->get_fun_symbol_map().end()); in get_fun_symbol_map()
1883 return priv_->fun_symbol_map; in get_fun_symbol_map()
1893 if (priv_->sorted_fun_symbols.empty() in get_sorted_fun_symbols()
1902 c->get_fun_symbol_map().begin(); in get_sorted_fun_symbols()
1903 j != c->get_fun_symbol_map().begin(); in get_sorted_fun_symbols()
1905 priv_->sorted_fun_symbols.insert(priv_->sorted_fun_symbols.end(), in get_sorted_fun_symbols()
1906 j->second.begin(), in get_sorted_fun_symbols()
1907 j->second.end()); in get_sorted_fun_symbols()
1910 std::sort(priv_->sorted_fun_symbols.begin(), in get_sorted_fun_symbols()
1911 priv_->sorted_fun_symbols.end(), in get_sorted_fun_symbols()
1915 return priv_->sorted_fun_symbols; in get_sorted_fun_symbols()
1925 if (priv_->sorted_var_symbols.empty() in get_sorted_var_symbols()
1934 c->get_var_symbol_map().begin(); in get_sorted_var_symbols()
1935 j != c->get_var_symbol_map().begin(); in get_sorted_var_symbols()
1937 priv_->sorted_var_symbols.insert(priv_->sorted_var_symbols.end(), in get_sorted_var_symbols()
1938 j->second.begin(), in get_sorted_var_symbols()
1939 j->second.end()); in get_sorted_var_symbols()
1942 std::sort(priv_->sorted_var_symbols.begin(), in get_sorted_var_symbols()
1943 priv_->sorted_var_symbols.end(), in get_sorted_var_symbols()
1947 return priv_->sorted_var_symbols; in get_sorted_var_symbols()
1964 if (!priv_->unrefed_fun_symbols_built) in get_unreferenced_function_symbols()
1965 if (priv_->unrefed_fun_symbols.empty()) in get_unreferenced_function_symbols()
1973 c->get_unreferenced_function_symbols().begin(); in get_unreferenced_function_symbols()
1974 e != c->get_unreferenced_function_symbols().end(); in get_unreferenced_function_symbols()
1977 string sym_id = (*e)->get_id_string(); in get_unreferenced_function_symbols()
1979 priv_->unrefed_fun_symbol_map.find(sym_id); in get_unreferenced_function_symbols()
1980 if (j != priv_->unrefed_fun_symbol_map.end()) in get_unreferenced_function_symbols()
1983 priv_->unrefed_fun_symbol_map[sym_id] = *e; in get_unreferenced_function_symbols()
1984 priv_->unrefed_fun_symbols.push_back(*e); in get_unreferenced_function_symbols()
1987 priv_->unrefed_fun_symbols_built = true; in get_unreferenced_function_symbols()
1990 return priv_->unrefed_fun_symbols; in get_unreferenced_function_symbols()
2007 if (!priv_->unrefed_var_symbols_built) in get_unreferenced_variable_symbols()
2008 if (priv_->unrefed_var_symbols.empty()) in get_unreferenced_variable_symbols()
2016 c->get_unreferenced_variable_symbols().begin(); in get_unreferenced_variable_symbols()
2017 e != c->get_unreferenced_variable_symbols().end(); in get_unreferenced_variable_symbols()
2020 string sym_id = (*e)->get_id_string(); in get_unreferenced_variable_symbols()
2022 priv_->unrefed_var_symbol_map.find(sym_id); in get_unreferenced_variable_symbols()
2023 if (j != priv_->unrefed_var_symbol_map.end()) in get_unreferenced_variable_symbols()
2026 priv_->unrefed_var_symbol_map[sym_id] = *e; in get_unreferenced_variable_symbols()
2027 priv_->unrefed_var_symbols.push_back(*e); in get_unreferenced_variable_symbols()
2030 priv_->unrefed_var_symbols_built = true; in get_unreferenced_variable_symbols()
2033 return priv_->unrefed_var_symbols; in get_unreferenced_variable_symbols()
2040 {return &priv_->pub_type_pretty_reprs_;} in get_public_types_pretty_representations()
2043 /// the recording of non-reachable types) is activated for the
2050 {return !get_public_types_pretty_representations()->empty();} in recording_types_reachable_from_public_interface_supported()