libabigail/include/abg-corpus.h
Dodji Seketeli b13345fd86 Take symbol versions in account when computing added/removed decls
* include/abg-corpus.h
	(corpus::lookup_{function,variable}_symbol): Add an overload
	declaration that takes the version of the symbol to lookup.
	* src/abg-comparison.cc
	(corpus_diff::priv::ensure_lookup_tables_populated): So when looking
	up the corpora for symbols, take their versions in account.
	* src/abg-corpus.cc (corpus::lookup_{function,variable}_symbol):
	Add an overload definition that takes the version of the symbol to
	lookup.
	(symtab_build_visitor_type::build_id): New
	member functions.
	(corpus::priv::build_public_decl_table): Use the new member
	functions above.
	* src/abg-ir.cc (elf_symbol::version::operator==): Do not take the
	is_default flag in account when comparing two symbol versions.
	* libtest12-v{0,1}.so: New test input files.
	* libtest12-v{0,1}.c: Source code for the test input files.
	* test12-version-script: Version script to build the files above.
	* test12-report.txt: Test input file.
	* tests/Makefile.am: Add the new test input files above to the
	source distribution.
	* tests/test-diff-dwarf.cc (in_out_specs[]): Add an entry to this
	table for the new test input files.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-25 23:16:50 +02:00

161 lines
3.7 KiB
C++

// -*- mode: C++ -*-
//
// Copyright (C) 2013 Red Hat, Inc.
//
// This file is part of the GNU Application Binary Interface Generic
// Analysis and Instrumentation Library (libabigail). This library is
// free software; you can redistribute it and/or modify it under the
// terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3, or (at your option) any
// later version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this program; see the file COPYING-LGPLV3. If
// not, see <http://www.gnu.org/licenses/>.
/// @file
#ifndef __ABG_CORPUS_H__
#define __ABG_CORPUS_H__
#include <abg-ir.h>
namespace abigail
{
class corpus;
/// A convenience typedef for shared pointer to @ref corpus.
typedef shared_ptr<corpus> corpus_sptr;
/// 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:
struct priv;
typedef shared_ptr<priv> priv_sptr;
typedef std::string string;
typedef vector<function_decl*> functions;
typedef vector<var_decl*> variables;
/// 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,
DWARF_ORIGIN
};
private:
shared_ptr<priv> priv_;
corpus();
public:
corpus(const string&);
void
add(const translation_unit_sptr);
const translation_units&
get_translation_units() const;
void
drop_translation_units();
origin
get_origin() const;
void
set_origin(origin);
string&
get_path() const;
void
set_path(const string&);
bool
is_empty() const;
bool
operator==(const corpus&) const;
void
set_fun_symbol_map(string_elf_symbols_map_sptr);
void
set_var_symbol_map(string_elf_symbols_map_sptr);
const string_elf_symbols_map_sptr
get_fun_symbol_map_sptr() const;
const string_elf_symbols_map_type&
get_fun_symbol_map() const;
const string_elf_symbols_map_sptr
get_var_symbol_map_sptr() const;
const string_elf_symbols_map_type&
get_var_symbol_map() const;
const elf_symbol_sptr
lookup_function_symbol(const string& n) const;
const elf_symbol_sptr
lookup_function_symbol(const string& symbol_name,
const string& symbol_version) const;
const elf_symbol_sptr
lookup_variable_symbol(const string& n) const;
const elf_symbol_sptr
lookup_variable_symbol(const string& symbol_name,
const string& symbol_version) const;
const functions&
get_functions() const;
const variables&
get_variables() 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_regex_patterns_of_vars_to_keep();
const vector<string>&
get_regex_patterns_of_vars_to_keep() const;
};// end class corpus.
}//end namespace abigail
#endif //__ABG_CORPUS_H__