mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-10 18:46:54 +00:00
23772b3f8d
* include/abg-comparison.h (enum visiting_kind): Change the meaning of this. It was to determine if traversal was to be done in a pre or post manner. But with the recent addition of diff_node_visitor::visit_{begin,end}() notifiers, the pre/post handling is taken care of in a different way. So now the meaning of this enum is changed to handle whether diff node children should be visited or not. So the enumerators are now DEFAULT_VISITING_KIND, and SKIP_CHILDREN_VISITING_KIND. And it's a bit-field. (operator{&,~}): Declare more bit manipulation operators for the enum visiting_kind. (function_suppression_sptr, function_suppressions_type): New typedefs. (function_suppression, function_suppression::parameter_spec): Declare new types. (read_function_suppressions): Declare new function. (diff_node_visitor::diff_node_visitor): Adjust for the enum visiting_kind change. Value-initialize the visiting_kind_ data member. * src/abg-comparison.cc (operator{&,~}): Define these operators for enum visiting_kind. (read_type_suppressions): Forward declare this static function. (read_function_suppression, read_parameter_spec_from_string): Define new static functions. (read_suppressions): Update to read function suppressions too, using the new read_function_suppression function above. (class function_suppression::parameter_spec::priv): Define new type. (function_suppression::parameter_spec::*): Define the member functions of the new function_suppression::parameter_spec type. (class function_suppression::priv): Define new type. (function_suppression::*): Define the member functions of the new function_suppression type. (diff::traverse): There is no more {PRE,POST}_VISITING_KIND enumerator. So nuke the code that was dealing with it. (redundancy_marking_visitor::skip_children_nodes_): New data member flag. (redundancy_marking_visitor::visit_begin): If the current diff node is not be reported (is filtered out), do not bother visit its children nodes for the purpose of marking redundant nodes. So use the new skip_children_nodes_ flag above to know we are in that case. (redundancy_marking_visitor::visit_end): Unset the new skip_children_nodes_ flag above when appropriate. * include/abg-fwd.h (is_function_decl): Declare new function. * include/abg-ir.h (function_type::get_parm_at_index_from_first_non_implicit_parm): Declare new member function. * src/abg-ir.cc (is_function_decl): Define new function. (function_type::get_parm_at_index_from_first_non_implicit_parm): Define new member function. * src/abg-comp-filter.cc (apply_filter): Adjust for the enum visiting_kind change. No need to set it for filters anymore * doc/suppr-doc.txt: Update examples of function suppression. * doc/manuals/libabigail-concepts.rst: Update the manual for the function suppression addition. * tests/data/test-diff-suppr/libtest5-fn-suppr-v0.so: New test input. * tests/data/test-diff-suppr/libtest5-fn-suppr-v1.so: New test input. * tests/data/test-diff-suppr/libtest6-fn-suppr-v0.so: New test input. * tests/data/test-diff-suppr/libtest6-fn-suppr-v1.so: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-1.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-2.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-4.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-v0.cc: Source code for new test input. * tests/data/test-diff-suppr/test5-fn-suppr-v1.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-1.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-2.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-v0.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-v1.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-version-script: New test input. * tests/Makefile.am: Add the new files above to source the distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the test inputs above to the list of tests to be run by this harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
510 lines
11 KiB
C++
510 lines
11 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_IRFWD_H__
|
|
#define __ABG_IRFWD_H__
|
|
|
|
#include <cstddef>
|
|
#include <tr1/memory>
|
|
#include <list>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <tr1/functional>
|
|
#include <typeinfo>
|
|
#include <utility> // for std::rel_ops, at least.
|
|
#include <ostream>
|
|
#include "abg-hash.h"
|
|
|
|
/// Toplevel namespace for libabigail.
|
|
namespace abigail
|
|
{
|
|
/**
|
|
@mainpage libabigail
|
|
|
|
|
|
The GNU Application Binary Interface Generic Analysis and
|
|
Instrumentation Library.
|
|
|
|
This is an interface to the GNU Compiler Collection for the
|
|
collection and analysis of compiler-generated binaries.
|
|
|
|
Checkout out the project homepage <a
|
|
href="http://sourceware.org/libabigail"> here</a>.
|
|
|
|
The current libabigail source code can be checked out with:
|
|
git clone git://sourceware.org/git/libabigail.git.
|
|
|
|
The mailing list to send messages and patches to is
|
|
libabigail@sourceware.org.
|
|
*/
|
|
|
|
// Inject some types.
|
|
using std::tr1::shared_ptr;
|
|
using std::tr1::weak_ptr;
|
|
using std::string;
|
|
using std::vector;
|
|
|
|
// Pull in relational operators.
|
|
using namespace std::rel_ops;
|
|
|
|
namespace ir
|
|
{
|
|
|
|
// Forward declarations for corpus.
|
|
|
|
class corpus;
|
|
|
|
// Forward declarations for ir.
|
|
class location;
|
|
class location_manager;
|
|
class translation_unit;
|
|
class class_decl;
|
|
class class_tdecl;
|
|
class decl_base;
|
|
class enum_type_decl;
|
|
class function_decl;
|
|
class function_tdecl;
|
|
class function_type;
|
|
class global_scope;
|
|
class node_visitor;
|
|
class location;
|
|
class location_manager;
|
|
class method_type;
|
|
class namespace_decl;
|
|
class parameter;
|
|
class pointer_type_def;
|
|
class qualified_type_def;
|
|
class reference_type_def;
|
|
class scope_decl;
|
|
class scope_type_decl;
|
|
class template_decl;
|
|
class template_parameter;
|
|
class non_type_tparameter;
|
|
class type_tparameter;
|
|
class template_tparameter;
|
|
|
|
class type_composition;
|
|
class type_base;
|
|
class type_decl;
|
|
class typedef_decl;
|
|
class var_decl;
|
|
class array_type_def;
|
|
class subrange_type;
|
|
|
|
struct type_shared_ptr_equal;
|
|
struct traversable_base;
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope (shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
|
|
|
const global_scope*
|
|
get_global_scope(const decl_base&);
|
|
|
|
const global_scope*
|
|
get_global_scope(const decl_base*);
|
|
|
|
const global_scope*
|
|
get_global_scope(const shared_ptr<decl_base>);
|
|
|
|
translation_unit*
|
|
get_translation_unit(const decl_base&);
|
|
|
|
translation_unit*
|
|
get_translation_unit(const decl_base*);
|
|
|
|
translation_unit*
|
|
get_translation_unit(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_global_scope(const scope_decl&);
|
|
|
|
bool
|
|
is_global_scope(const scope_decl*);
|
|
|
|
bool
|
|
is_global_scope(const shared_ptr<scope_decl>);
|
|
|
|
bool
|
|
is_at_global_scope(const decl_base&);
|
|
|
|
bool
|
|
is_at_global_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_at_class_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_at_class_scope(const decl_base*);
|
|
|
|
bool
|
|
is_at_class_scope(const decl_base&);
|
|
|
|
bool
|
|
is_at_template_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_template_parameter(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<function_decl>
|
|
is_function_decl(shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_type(const decl_base&);
|
|
|
|
shared_ptr<type_base>
|
|
is_type(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<type_decl>
|
|
is_type_decl(const shared_ptr<type_base>);
|
|
|
|
shared_ptr<typedef_decl>
|
|
is_typedef(const shared_ptr<type_base>);
|
|
|
|
shared_ptr<typedef_decl>
|
|
is_typedef(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<enum_type_decl>
|
|
is_enum(const shared_ptr<type_base>&);
|
|
|
|
shared_ptr<enum_type_decl>
|
|
is_enum(const shared_ptr<decl_base>&);
|
|
|
|
shared_ptr<class_decl>
|
|
is_class_type(const shared_ptr<type_base>);
|
|
|
|
shared_ptr<class_decl>
|
|
is_class_type(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<pointer_type_def>
|
|
is_pointer(const shared_ptr<type_base>);
|
|
|
|
shared_ptr<qualified_type_def>
|
|
is_qualified_type(const shared_ptr<type_base>);
|
|
|
|
shared_ptr<class_decl>
|
|
look_through_decl_only_class(shared_ptr<class_decl>);
|
|
|
|
|
|
shared_ptr<var_decl>
|
|
is_var_decl(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_template_parm_composition_type(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_template_decl(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_function_template_pattern(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope(shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
|
|
|
shared_ptr<decl_base>
|
|
insert_decl_into_scope(shared_ptr<decl_base>,
|
|
vector<shared_ptr<decl_base> >::iterator,
|
|
scope_decl*);
|
|
|
|
shared_ptr<decl_base>
|
|
insert_decl_into_scope(shared_ptr<decl_base>,
|
|
vector<shared_ptr<decl_base> >::iterator,
|
|
shared_ptr<scope_decl>);
|
|
|
|
bool
|
|
has_scope(const decl_base&);
|
|
|
|
bool
|
|
has_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_member_decl(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_member_decl(const decl_base*);
|
|
|
|
bool
|
|
is_member_decl(const decl_base&);
|
|
|
|
bool
|
|
is_member_type(const shared_ptr<type_base>);
|
|
|
|
bool
|
|
is_member_type(const shared_ptr<decl_base>);
|
|
|
|
void
|
|
remove_decl_from_scope(shared_ptr<decl_base>);
|
|
|
|
bool
|
|
get_member_is_static(const decl_base&);
|
|
|
|
bool
|
|
get_member_is_static(const decl_base*);
|
|
|
|
bool
|
|
get_member_is_static(const shared_ptr<decl_base>);
|
|
|
|
void
|
|
set_member_is_static(decl_base&, bool);
|
|
|
|
void
|
|
set_member_is_static(shared_ptr<decl_base>, bool);
|
|
|
|
bool
|
|
is_data_member(const var_decl&);
|
|
|
|
bool
|
|
is_data_member(const var_decl*);
|
|
|
|
bool
|
|
is_data_member(const shared_ptr<var_decl>);
|
|
|
|
shared_ptr<var_decl>
|
|
is_data_member(const shared_ptr<decl_base>&);
|
|
|
|
shared_ptr<array_type_def>
|
|
is_array_def(const shared_ptr<type_base> decl);
|
|
|
|
void
|
|
set_data_member_offset(shared_ptr<var_decl>, size_t);
|
|
|
|
size_t
|
|
get_data_member_offset(const var_decl&);
|
|
|
|
size_t
|
|
get_data_member_offset(const shared_ptr<var_decl>);
|
|
|
|
size_t
|
|
get_data_member_offset(const shared_ptr<decl_base>);
|
|
|
|
void
|
|
set_data_member_is_laid_out(shared_ptr<var_decl>, bool);
|
|
|
|
bool
|
|
get_data_member_is_laid_out(const var_decl&);
|
|
|
|
bool
|
|
get_data_member_is_laid_out(const shared_ptr<var_decl>);
|
|
|
|
bool
|
|
is_member_function(const function_decl&);
|
|
|
|
bool
|
|
is_member_function(const function_decl*);
|
|
|
|
bool
|
|
is_member_function(const shared_ptr<function_decl>);
|
|
|
|
bool
|
|
get_member_function_is_ctor(const function_decl&);
|
|
|
|
bool
|
|
get_member_function_is_ctor(const shared_ptr<function_decl>);
|
|
|
|
void
|
|
set_member_function_is_ctor(const function_decl&, bool);
|
|
|
|
void
|
|
set_member_function_is_ctor(const shared_ptr<function_decl>, bool);
|
|
|
|
bool
|
|
get_member_function_is_dtor(const function_decl&);
|
|
|
|
bool
|
|
get_member_function_is_dtor(const shared_ptr<function_decl>);
|
|
|
|
void
|
|
set_member_function_is_dtor(const function_decl&, bool);
|
|
|
|
void
|
|
set_member_function_is_dtor(const shared_ptr<function_decl>, bool);
|
|
|
|
bool
|
|
get_member_function_is_const(const function_decl&);
|
|
|
|
bool
|
|
get_member_function_is_const(const shared_ptr<function_decl>);
|
|
|
|
void
|
|
set_member_function_is_const(const function_decl&, bool);
|
|
|
|
void
|
|
set_member_function_is_const(const shared_ptr<function_decl>, bool);
|
|
|
|
size_t
|
|
get_member_function_vtable_offset(const function_decl&);
|
|
|
|
size_t
|
|
get_member_function_vtable_offset(const shared_ptr<function_decl>);
|
|
|
|
void
|
|
set_member_function_vtable_offset(const function_decl& f,
|
|
size_t s);
|
|
|
|
void
|
|
set_member_function_vtable_offset(const shared_ptr<function_decl> f,
|
|
size_t s);
|
|
|
|
bool
|
|
get_member_function_is_virtual(const function_decl&);
|
|
|
|
bool
|
|
get_member_function_is_virtual(const shared_ptr<function_decl>);
|
|
|
|
bool
|
|
get_member_function_is_virtual(const function_decl*);
|
|
|
|
void
|
|
set_member_function_is_virtual(const function_decl&, bool);
|
|
|
|
void
|
|
set_member_function_is_virtual(const shared_ptr<function_decl>&, bool);
|
|
|
|
shared_ptr<type_base>
|
|
strip_typedef(const shared_ptr<type_base>);
|
|
|
|
string
|
|
get_type_name(const shared_ptr<type_base>);
|
|
|
|
string
|
|
get_pretty_representation(const decl_base*);
|
|
|
|
string
|
|
get_pretty_representation(const type_base*);
|
|
|
|
string
|
|
get_pretty_representation(const shared_ptr<decl_base>&);
|
|
|
|
string
|
|
get_pretty_representation(const shared_ptr<type_base>&);
|
|
|
|
const decl_base*
|
|
get_type_declaration(const type_base*);
|
|
|
|
decl_base*
|
|
get_type_declaration(type_base*);
|
|
|
|
shared_ptr<decl_base>
|
|
get_type_declaration(const shared_ptr<type_base>);
|
|
|
|
bool
|
|
types_are_compatible(const shared_ptr<type_base>,
|
|
const shared_ptr<type_base>);
|
|
|
|
bool
|
|
types_are_compatible(const shared_ptr<decl_base>,
|
|
const shared_ptr<decl_base>);
|
|
|
|
const scope_decl*
|
|
get_top_most_scope_under(const decl_base*,
|
|
const scope_decl*);
|
|
|
|
const scope_decl*
|
|
get_top_most_scope_under(const shared_ptr<decl_base>,
|
|
const scope_decl*);
|
|
|
|
const scope_decl*
|
|
get_top_most_scope_under(const shared_ptr<decl_base>,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
void
|
|
fqn_to_components(const std::string&,
|
|
std::list<string>&);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_type_in_translation_unit(const string&,
|
|
const translation_unit&);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_type_in_translation_unit(const std::list<string>&,
|
|
const translation_unit&);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_type_in_scope(const string&,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_type_in_scope(const std::list<string>&,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_var_decl_in_scope(const string&,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_var_decl_in_scope(const std::list<string>&,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
string
|
|
demangle_cplus_mangled_name(const string&);
|
|
|
|
} // end namespace ir
|
|
|
|
using namespace abigail::ir;
|
|
|
|
void
|
|
dump(const shared_ptr<decl_base>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<decl_base>);
|
|
|
|
void
|
|
dump(const shared_ptr<type_base>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<type_base>);
|
|
|
|
void
|
|
dump(const shared_ptr<var_decl>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<var_decl>);
|
|
|
|
void
|
|
dump(const translation_unit&, std::ostream&);
|
|
|
|
void
|
|
dump(const translation_unit&);
|
|
|
|
void
|
|
dump(const shared_ptr<translation_unit>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<translation_unit>);
|
|
|
|
void
|
|
dump_decl_location(const decl_base&);
|
|
|
|
void
|
|
dump_decl_location(const decl_base*);
|
|
|
|
void
|
|
dump_decl_location(const shared_ptr<decl_base>&);
|
|
|
|
} // end namespace abigail
|
|
#endif // __ABG_IRFWD_H__
|