mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-23 10:12:25 +00:00
610d87c29b
In the text below, the term interface means the "declaration of either a function or a global variable". To analyze the compatibility between an application and a dependent library, one has essentially to analyze the interfaces of the application that have undefined symbols (aka undefined interfaces from the application) and see how they relate to the same interfaces coming from the library but with symbols that are defined and exported from the library (aka defined/exported interfaces from the library). An interface that is undefined in the application and defined in the library is an interface that the application consumes from the library. In other words an undefined interface from an application is an interface that the application expects and an interface that is exported by a library is an interface that the library provides. If comparing the expected interface against the provided interface yields a meaningful difference, then that might mean there is an incompatibility between the application and the library on that interface. This patch uses this scheme to re-implement the weak mode of ABI compatibility between an application and a library. The patch adds the concept of undefined functions and variables to the ABI corpus. Then it teaches the DWARF reader how to construct the IR for these undefined interfaces. Then it revisits the weak mode of operation of abicompat to make it compare the interfaces expected from the application against the corresponding interfaces provided by library. The patch also teaches the weak mode abicompat how to detect incompatibilities between the interfaces that plugin expects and the interfaces provided by the application. This patch makes the CTF front-end construct undefined interfaces. A subsequent patch is needed to construct undefined interfaces from the BTF front-end however. * include/abg-corpus.h (corpus::{lookup_variable, get_undefined_functions, get_undefined_variables}): Declare new member functions. (corpus::exported_decls_builder::maybe_add_{fn,var}_to_exported_fns): Make this return a boolean. * include/abg-fe-iface.h (fe_iface::options_type): Add a new load_undefined_interfaces enumerator. (fe_iface::add_fn_to_exported_or_undefined_decls): Rename maybe_add_fn_to_exported_decls into this. (fe_iface::add_var_to_exported_or_undefined_decls): Rename maybe_add_var_to_exported_decls into this. * src/abg-btf-reader.cc (reader::build_ir_node_from_btf_type): Adjust call to maybe_add_fn_to_exported_decls as add_fn_to_exported_or_undefined_decls. Similarly, adjust call to maybe_add_var_to_exported_decls as add_var_to_exported_or_undefined_decls. * src/abg-corpus-priv.h (corpus::priv::undefined_{fns,vars}): Add new member variables. * src/abg-corpus.cc (corpus::exported_decls_builder::maybe_add_{fn,var}_to_exported_fns): Return a bool iff the decl was added to the set of exported decls. (corpus::{lookup_variable, get_undefined_functions, get_undefined_variables}): Define new member functions. (corpus::sort_{functions,variables}): Sort the undefined decls too. * (corpus::lookup_{function,variable}_symbol): Lookup the symbol also among undefined symbols, not just among defined symbols. * src/abg-ctf-reader.cc (reader::process_ctf_archive): Adjust call to maybe_add_fn_to_exported_decls as add_fn_to_exported_or_undefined_decls. Similarly, adjust call to maybe_add_var_to_exported_decls as add_var_to_exported_or_undefined_decls. Also, sort functions & variables in the corpus. * src/abg-dwarf-reader.cc (die_name_and_linkage_name): Define new static function. (reader::fixup_functions_with_no_symbols): Adjust call to maybe_add_fn_to_exported_decls as add_fn_to_exported_or_undefined_decls. (reader::{is_decl_die_with_undefined_symbol, load_undefined_interfaces}): Define new member functions. (build_translation_unit_and_add_to_ir): Analyze DIEs of interfaces that have undefined symbols if we were asked to load undefined interfaces. (variable_is_suppressed): Add a boolean parameter to tell if the var is decl-only. Use that decl-only flag to determine if the variable is suppressed. A non-member decl-only variable won't be suppressed if we were asked to load undefined interfaces. (build_or_get_var_decl_if_not_suppressed): Add a boolean parameter to tell if the var is decl-only. (potential_member_fn_should_be_dropped): A potential non-virtual member function with no symbol is now dropped on the floor regardless of it has a mangled name or not. (build_var_decl): If the var has an undefined symbol, then set that symbol. (build_function_decl): If the function has an undefined symbol, then set that symbol. (build_ir_node_from_die): Add a var or function with undefined symbol to the set of undefined vars or functions of the current corpus. * src/abg-fe-iface.cc (fe_iface::add_fn_to_exported_or_undefined_decls): Renamed fe_iface::maybe_add_fn_to_exported_decls into this. If the function has an undefined symbol then add the function to the set of undefined functions. (fe_iface::add_var_to_exported_or_undefined_decls): Renamed fe_iface::maybe_add_var_to_exported_decls into this. If the variable has an undefined symbol then add the variable to the set of undefined variables. * src/abg-ir.cc (elf_symbol::is_variable): Undefined symbol with type STT_NOTYPE are actually for undefined variables. (maybe_adjust_canonical_type): It's here, after type canonicalization that a member function is added to either the set of defined & exported functions, or to the set of functions with undefined symbols. * src/abg-reader.cc (build_function_decl, build_class_decl) (build_union_decl, handle_var_decl): Adjust. * src/abg-symtab-reader.cc (symtab::{lookup_undefined_function_symbol, lookup_undefined_variable_symbol, function_symbol_is_undefined, variable_symbol_is_undefined, collect_undefined_fns_and_vars_linkage_names}): Define new member functions. (symtab::symtab): Initialize the new cached_undefined_symbol_names_ data member. * src/abg-symtab-reader.h (symtab::{lookup_undefined_function_symbol, lookup_undefined_variable_symbol, function_symbol_is_undefined, variable_symbol_is_undefined, collect_undefined_fns_and_vars_linkage_names}): Declare new member functions. (symtab::{undefined_variable_linkage_names_, cached_undefined_symbol_names_}): Define new data members. (symtab::load_): Consider undefined symbol of type STT_NOTYPE as being undefined global variables. It's what I am seeing in ELF binaries. * src/abg-symtab-reader.h (symtab::{lookup_undefined_function_symbol, lookup_undefined_variable_symbol, function_symbol_is_undefined, variable_symbol_is_undefined}): Declare new member functions. (symtab::{undefined_function_linkage_names_, undefined_variable_linkage_names_}): Define new member variables. * src/abg-writer.cc (write_var_decl, write_function_decl): Emit a reference to a symbol only when the symbol is defined. * tools/abicompat.cc (report_function_changes) (report_variable_changes) (compare_expected_against_provided_functions) (compare_expected_against_provided_variables): Define new static functions. (perform_compat_check_in_weak_mode): Use the new static functions above. Compare interfaces expected by the application corpus against interfaces provided by the library. Report the changes. Do that in the reverse direction as well. (read_corpus): Instruct the corpus reader to load the set of undefined interfaces too. * tests/data/test-abicompat/test6-var-changed-app: Remove file. * tests/data/test-abicompat/test6-var-changed-app.cc: Likewise. * tests/data/test-abicompat/libtest6-undefined-var.so: Add new binary input file. * tests/data/test-abicompat/test6-undefined-var.cc: Add sourcefile for the binary input file above. * tests/data/test-abicompat/test6-var-changed-report-2.txt: New reference output file. * tests/data/Makefile.am: Update the list of distributed files accordingly. * tests/data/test-abicompat/libtest5-fn-changed-libapp-v0.so: Adjust. * tests/data/test-abicompat/libtest5-fn-changed-libapp-v1.so: Likewise. * tests/data/test-abicompat/libtest6-var-changed-libapp-v0.so: Likewise. * tests/data/test-abicompat/libtest6-var-changed-libapp-v1.so: Likewise. * tests/data/test-abicompat/libtest7-fn-changed-libapp-v0.so: Likewise. * tests/data/test-abicompat/libtest7-fn-changed-libapp-v1.so: Likewise. * tests/data/test-abicompat/libtest8-fn-changed-libapp-v0.so: Likewise. * tests/data/test-abicompat/libtest8-fn-changed-libapp-v1.so: Likewise. * tests/data/test-abicompat/libtest9-fn-changed-v0.so: Likewise. * tests/data/test-abicompat/libtest9-fn-changed-v1.so: Likewise. * tests/data/test-abicompat/test5-fn-changed-app: Likewise. * tests/data/test-abicompat/test6-var-changed-libapp-v0.cc: Likewise. * tests/data/test-abicompat/test6-var-changed-libapp-v1.cc: Likewise. * tests/data/test-abicompat/test6-var-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test6-var-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test7-fn-changed-app: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-2.txt: Likewise. * tests/data/test-abicompat/test8-fn-changed-app: Likewise. * tests/data/test-abicompat/test8-fn-changed-libapp-v1.c: Likewise. * tests/data/test-abicompat/test9-fn-changed-app: Likewise. * tests/data/test-abicompat/test9-fn-changed-app.cc: Likewise. * tests/data/test-annotate/libtest23.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.ab: Likewise.i * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64--dbus-glib-0.104-3.fc23.armv7hl-report-0.txt: Likewise. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test-libaaudio.so.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/data/test-read-dwarf/test1.abi: Likewise. * tests/data/test-read-dwarf/test1.hash.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test2.so.abi: Likewise. * tests/data/test-read-dwarf/test2.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/test-abicompat.cc (in_out_specs): Adjust. * tests/test-read-ctf.cc (test_task_ctf::perform): Do not load undefined interfaces, by default. * tests/test-symtab.cc (Symtab::SimpleSymtabs) (Symtab::SymtabWithWhitelist, Symtab::AliasedFunctionSymbols): Adjust the expected undefined variable symbols counts. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
450 lines
9.5 KiB
C++
450 lines
9.5 KiB
C++
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
// -*- mode: C++ -*-
|
|
//
|
|
// Copyright (C) 2013-2023 Red Hat, Inc.
|
|
|
|
/// @file
|
|
|
|
#ifndef __ABG_CORPUS_H__
|
|
#define __ABG_CORPUS_H__
|
|
|
|
#include <abg-ir.h>
|
|
|
|
namespace abigail
|
|
{
|
|
|
|
namespace ir
|
|
{
|
|
|
|
/// This is the abstraction of a set of translation units (themselves
|
|
/// seen as bundles of unitary abi artefacts like types and decls)
|
|
/// bundled together as a corpus. A corpus is thus the Application
|
|
/// binary interface of a program, a library or just a set of modules
|
|
/// put together.
|
|
class corpus
|
|
{
|
|
public:
|
|
/// A convenience typedef for std::vector<string>.
|
|
typedef vector<string> strings_type;
|
|
|
|
/// Convenience typedef for std::vector<abigail::ir::function_decl*>
|
|
typedef vector<const function_decl*> functions;
|
|
|
|
/// Convenience typedef for std::unordered_set<const function_decl*>
|
|
typedef std::unordered_set<const function_decl*> functions_set;
|
|
|
|
///Convenience typedef for std::vector<abigail::ir::var_decl*>
|
|
typedef vector<const var_decl*> variables;
|
|
|
|
/// Convenience typedef for std::unordered_set<const var_decl*>.
|
|
typedef std::unordered_set<const var_decl*> variables_set;
|
|
|
|
class exported_decls_builder;
|
|
|
|
/// Convenience typedef for shared_ptr<exported_decls_builder>.
|
|
typedef shared_ptr<exported_decls_builder> exported_decls_builder_sptr;
|
|
|
|
/// This abstracts where the corpus comes from. That is, either it
|
|
/// has been read from the native xml format, from DWARF or built
|
|
/// artificially using the library's API.
|
|
enum origin
|
|
{
|
|
ARTIFICIAL_ORIGIN = 0,
|
|
NATIVE_XML_ORIGIN = 1,
|
|
ELF_ORIGIN = 1 << 1,
|
|
DWARF_ORIGIN = 1 << 2,
|
|
CTF_ORIGIN = 1 << 3,
|
|
BTF_ORIGIN = 1 << 4,
|
|
LINUX_KERNEL_BINARY_ORIGIN = 1 << 5
|
|
};
|
|
|
|
private:
|
|
corpus();
|
|
|
|
void set_group(corpus_group*);
|
|
void init_format_version();
|
|
|
|
public:
|
|
struct priv;
|
|
std::unique_ptr<priv> priv_;
|
|
|
|
corpus(const ir::environment&, const string& path= "");
|
|
|
|
virtual ~corpus();
|
|
|
|
const environment&
|
|
get_environment() const;
|
|
|
|
bool
|
|
do_log() const;
|
|
|
|
void
|
|
do_log(bool);
|
|
|
|
void
|
|
add(const translation_unit_sptr&);
|
|
|
|
const translation_units&
|
|
get_translation_units() const;
|
|
|
|
const translation_unit_sptr
|
|
find_translation_unit(const string &path) const;
|
|
|
|
void
|
|
drop_translation_units();
|
|
|
|
type_maps&
|
|
get_types();
|
|
|
|
const type_maps&
|
|
get_types() const;
|
|
|
|
type_maps&
|
|
get_type_per_loc_map();
|
|
|
|
const type_maps&
|
|
get_type_per_loc_map() const;
|
|
|
|
virtual bool
|
|
recording_types_reachable_from_public_interface_supported();
|
|
|
|
void
|
|
record_type_as_reachable_from_public_interfaces(const type_base&);
|
|
|
|
bool
|
|
type_is_reachable_from_public_interfaces(const type_base&) const;
|
|
|
|
const vector<type_base_wptr>&
|
|
get_types_not_reachable_from_public_interfaces() const;
|
|
|
|
const corpus_group*
|
|
get_group() const;
|
|
|
|
corpus_group*
|
|
get_group();
|
|
|
|
origin
|
|
get_origin() const;
|
|
|
|
void
|
|
set_origin(origin);
|
|
|
|
string&
|
|
get_format_major_version_number() const;
|
|
|
|
void
|
|
set_format_major_version_number(const string&);
|
|
|
|
string&
|
|
get_format_minor_version_number() const;
|
|
|
|
void
|
|
set_format_minor_version_number(const string&);
|
|
|
|
string&
|
|
get_path() const;
|
|
|
|
void
|
|
set_path(const string&);
|
|
|
|
const vector<string>&
|
|
get_needed() const;
|
|
|
|
void
|
|
set_needed(const vector<string>&);
|
|
|
|
const string&
|
|
get_soname();
|
|
|
|
void
|
|
set_soname(const string&);
|
|
|
|
const string&
|
|
get_architecture_name() const;
|
|
|
|
void
|
|
set_architecture_name(const string&);
|
|
|
|
virtual bool
|
|
is_empty() const;
|
|
|
|
bool
|
|
operator==(const corpus&) const;
|
|
|
|
void
|
|
set_symtab(symtab_reader::symtab_sptr);
|
|
|
|
const symtab_reader::symtab_sptr&
|
|
get_symtab() const;
|
|
|
|
virtual const string_elf_symbols_map_type&
|
|
get_fun_symbol_map() const;
|
|
|
|
const string_elf_symbols_map_type&
|
|
get_undefined_fun_symbol_map() const;
|
|
|
|
virtual const elf_symbols&
|
|
get_sorted_fun_symbols() const;
|
|
|
|
const elf_symbols&
|
|
get_sorted_undefined_fun_symbols() const;
|
|
|
|
virtual const string_elf_symbols_map_type&
|
|
get_var_symbol_map() const;
|
|
|
|
const string_elf_symbols_map_type&
|
|
get_undefined_var_symbol_map() const;
|
|
|
|
virtual const elf_symbols&
|
|
get_sorted_var_symbols() const;
|
|
|
|
const elf_symbols&
|
|
get_sorted_undefined_var_symbols() const;
|
|
|
|
const elf_symbol_sptr
|
|
lookup_function_symbol(const string& n) const;
|
|
|
|
const elf_symbol_sptr
|
|
lookup_function_symbol(const string& symbol_name,
|
|
const elf_symbol::version& version) const;
|
|
|
|
const elf_symbol_sptr
|
|
lookup_function_symbol(const elf_symbol& symbol) const;
|
|
|
|
const elf_symbol_sptr
|
|
lookup_variable_symbol(const string& n) const;
|
|
|
|
const elf_symbol_sptr
|
|
lookup_variable_symbol(const string& symbol_name,
|
|
const elf_symbol::version& version) const;
|
|
|
|
const elf_symbol_sptr
|
|
lookup_variable_symbol(const elf_symbol& symbol) const;
|
|
|
|
virtual const functions&
|
|
get_functions() const;
|
|
|
|
const std::unordered_set<function_decl*>*
|
|
lookup_functions(const interned_string& id) const;
|
|
|
|
const std::unordered_set<function_decl*>*
|
|
lookup_functions(const char* id) const;
|
|
|
|
const var_decl*
|
|
lookup_variable(const interned_string& id) const;
|
|
|
|
void
|
|
sort_functions();
|
|
|
|
virtual const variables&
|
|
get_variables() const;
|
|
|
|
const functions_set&
|
|
get_undefined_functions() const;
|
|
|
|
functions_set&
|
|
get_undefined_functions();
|
|
|
|
const functions&
|
|
get_sorted_undefined_functions() const;
|
|
|
|
const variables_set&
|
|
get_undefined_variables() const;
|
|
|
|
variables_set&
|
|
get_undefined_variables();
|
|
|
|
const variables&
|
|
get_sorted_undefined_variables() const;
|
|
|
|
void
|
|
sort_variables();
|
|
|
|
virtual const elf_symbols&
|
|
get_unreferenced_function_symbols() const;
|
|
|
|
virtual const elf_symbols&
|
|
get_unreferenced_variable_symbols() const;
|
|
|
|
vector<string>&
|
|
get_regex_patterns_of_fns_to_suppress();
|
|
|
|
const vector<string>&
|
|
get_regex_patterns_of_fns_to_suppress() const;
|
|
|
|
vector<string>&
|
|
get_regex_patterns_of_vars_to_suppress();
|
|
|
|
const vector<string>&
|
|
get_regex_patterns_of_vars_to_suppress() const;
|
|
|
|
vector<string>&
|
|
get_regex_patterns_of_fns_to_keep();
|
|
|
|
const vector<string>&
|
|
get_regex_patterns_of_fns_to_keep() const;
|
|
|
|
vector<string>&
|
|
get_sym_ids_of_fns_to_keep();
|
|
|
|
const vector<string>&
|
|
get_sym_ids_of_fns_to_keep() const;
|
|
|
|
vector<string>&
|
|
get_regex_patterns_of_vars_to_keep();
|
|
|
|
const vector<string>&
|
|
get_regex_patterns_of_vars_to_keep() const;
|
|
|
|
vector<string>&
|
|
get_sym_ids_of_vars_to_keep();
|
|
|
|
const vector<string>&
|
|
get_sym_ids_of_vars_to_keep() const;
|
|
|
|
void
|
|
maybe_drop_some_exported_decls();
|
|
|
|
exported_decls_builder_sptr
|
|
get_exported_decls_builder() const;
|
|
|
|
friend class type_base;
|
|
friend class corpus_group;
|
|
};// end class corpus.
|
|
|
|
corpus::origin
|
|
operator|(corpus::origin l, corpus::origin r);
|
|
|
|
corpus::origin
|
|
operator|=(corpus::origin &l, corpus::origin r);
|
|
|
|
corpus::origin
|
|
operator&(corpus::origin l, corpus::origin r);
|
|
|
|
corpus::origin
|
|
operator&=(corpus::origin &l, corpus::origin r);
|
|
|
|
/// Abstracts the building of the set of exported variables and
|
|
/// functions.
|
|
///
|
|
/// Given a function or variable, this type can decide if it belongs
|
|
/// to the list of exported functions and variables based on all the
|
|
/// parameters needed.
|
|
class corpus::exported_decls_builder
|
|
{
|
|
// Forbid default construction.
|
|
exported_decls_builder();
|
|
|
|
public:
|
|
class priv;
|
|
std::unique_ptr<priv> priv_;
|
|
|
|
friend class corpus;
|
|
|
|
exported_decls_builder(functions& fns,
|
|
variables& vars,
|
|
strings_type& fns_suppress_regexps,
|
|
strings_type& vars_suppress_regexps,
|
|
strings_type& fns_keep_regexps,
|
|
strings_type& vars_keep_regexps,
|
|
strings_type& sym_id_of_fns_to_keep,
|
|
strings_type& sym_id_of_vars_to_keep);
|
|
|
|
|
|
const functions&
|
|
exported_functions() const;
|
|
|
|
functions&
|
|
exported_functions();
|
|
|
|
std::unordered_set<function_decl*>*
|
|
fn_id_maps_to_several_fns(const function_decl*);
|
|
|
|
const variables&
|
|
exported_variables() const;
|
|
|
|
variables&
|
|
exported_variables();
|
|
|
|
bool
|
|
maybe_add_fn_to_exported_fns(function_decl*);
|
|
|
|
bool
|
|
maybe_add_var_to_exported_vars(const var_decl*);
|
|
}; //corpus::exported_decls_builder
|
|
|
|
/// Abstraction of a group of corpora.
|
|
///
|
|
/// A corpus group is a union of corpora. It provides a unified view
|
|
/// of a set of corpora. It lets you get the set of functions,
|
|
/// variables and symbols that are defined and exported by a set of
|
|
/// corpora.
|
|
class corpus_group : public corpus
|
|
{
|
|
struct priv;
|
|
std::unique_ptr<priv> priv_;
|
|
|
|
// Forbid copy
|
|
corpus_group(const corpus_group&);
|
|
|
|
public:
|
|
typedef vector<corpus_sptr> corpora_type;
|
|
|
|
corpus_group(const ir::environment&, const string&);
|
|
|
|
virtual ~corpus_group();
|
|
|
|
void add_corpus(const corpus_sptr&);
|
|
|
|
bool has_corpus(const string&);
|
|
|
|
const corpora_type&
|
|
get_corpora() const;
|
|
|
|
const corpus_sptr
|
|
get_main_corpus() const;
|
|
|
|
corpus_sptr
|
|
get_main_corpus();
|
|
|
|
virtual bool
|
|
is_empty() const;
|
|
|
|
virtual const corpus::functions&
|
|
get_functions() const;
|
|
|
|
virtual const corpus::variables&
|
|
get_variables() const;
|
|
|
|
virtual const string_elf_symbols_map_type&
|
|
get_var_symbol_map() const;
|
|
|
|
virtual const string_elf_symbols_map_type&
|
|
get_fun_symbol_map() const;
|
|
|
|
virtual const elf_symbols&
|
|
get_sorted_fun_symbols() const;
|
|
|
|
virtual const elf_symbols&
|
|
get_sorted_var_symbols() const;
|
|
|
|
virtual const elf_symbols&
|
|
get_unreferenced_function_symbols() const;
|
|
|
|
virtual const elf_symbols&
|
|
get_unreferenced_variable_symbols() const;
|
|
|
|
unordered_set<interned_string, hash_interned_string>*
|
|
get_public_types_pretty_representations();
|
|
|
|
virtual bool
|
|
recording_types_reachable_from_public_interface_supported();
|
|
|
|
bool
|
|
operator==(const corpus_group&) const;
|
|
}; // end class corpus_group
|
|
|
|
}// end namespace ir
|
|
}//end namespace abigail
|
|
#endif //__ABG_CORPUS_H__
|