2013-08-02 03:16:22 +00:00
|
|
|
// -*- 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.
|
2013-12-07 07:07:54 +00:00
|
|
|
#include <ostream>
|
2013-08-02 03:16:22 +00:00
|
|
|
#include "abg-hash.h"
|
|
|
|
|
|
|
|
/// Toplevel namespace for libabigail.
|
|
|
|
namespace abigail
|
|
|
|
{
|
2013-10-10 08:11:35 +00:00
|
|
|
/**
|
|
|
|
@mainpage libabigail
|
2013-08-02 23:30:56 +00:00
|
|
|
|
|
|
|
|
2013-10-10 08:11:35 +00:00
|
|
|
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://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::string;
|
|
|
|
|
|
|
|
// Pull in relational operators.
|
|
|
|
using namespace std::rel_ops;
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
struct type_shared_ptr_equal;
|
|
|
|
struct traversable_base;
|
|
|
|
|
|
|
|
void
|
|
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
|
|
|
|
|
|
|
void
|
|
|
|
add_decl_to_scope (shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
|
|
|
|
|
|
|
global_scope*
|
|
|
|
get_global_scope(const shared_ptr<decl_base>);
|
|
|
|
|
|
|
|
translation_unit*
|
|
|
|
get_translation_unit(const shared_ptr<decl_base>);
|
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_global_scope(const scope_decl*);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_global_scope(const shared_ptr<scope_decl>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_at_global_scope(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_at_class_scope(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_at_template_scope(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_template_parameter(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
2013-11-28 13:51:23 +00:00
|
|
|
shared_ptr<type_base>
|
2013-10-19 14:01:59 +00:00
|
|
|
is_type(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_var_decl(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_template_parm_composition_type(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_template_decl(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_function_template_pattern(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
void
|
2013-10-19 14:01:59 +00:00
|
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
void
|
2013-10-19 14:01:59 +00:00
|
|
|
add_decl_to_scope(shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
global_scope*
|
2013-10-19 14:01:59 +00:00
|
|
|
get_global_scope(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
translation_unit*
|
2013-10-19 14:01:59 +00:00
|
|
|
get_translation_unit(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
Support diff/reporting for functions & better diff/report in general
* include/abg-ir.h ({decl_base, class_decl,
function_decl}::get_pretty_representation): New virtual member to
get a pretty string name for decls & types.
(class_decl::parameter): Add an index to the parameter type.
(class_decl::parameter::parameter): Update the constructor for the
change above.
(class_decl::parameter::{get_index, set_index}): Accessors for the
new index.
(class_decl::parameter::operator==): Take in account the index.
(function_type::append_parameter): Set the index of the parameter
here.
* include/abg-fwd.h (get_type_name): New declaration.
* src/abg-ir.cc (get_type_name): New definition.
({decl_base, function_decl,
class_decl}::get_pretty_representation): New implementations.
(method_type::set_class_type): Update this to set function
parameter's index by default.
(function_decl::append_parameters): Use the append_parameter
method from function_type.
* include/abg-comparison.h (class function_decl_diff): New type
declaration.
* src/abg-comparison.cc (compute_diff_for_decls, compute_diff):
New definitions.
({pointer_diff, class_diff, scope_diff}::report): Use the new
get_pretty_representation. Output a prettier report.
(function_decl_diff::priv): New type.
(function_decl_diff::{deleted_parameter_at, inserted_parameter_at,
ensure_lookup_tables_populated, function_decl_diff,
first_function_decl, second_function_decl, changed_parms,
removed_parms, added_parms, length, report}): New member function
definitions.
* src/abg-hash.cc (function_decl::parameter::hash): Update this to
take the index in account.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-19 14:33:40 +00:00
|
|
|
string
|
|
|
|
get_type_name(const shared_ptr<type_base>);
|
|
|
|
|
Avoid missing member types while reading bi files
* include/abg-fwd.h (get_type_declaration): Declare function.
* include/abg-ir.h (class decl_base): Add class_decl as a friend.
This to be able to call decl_base::set_scope from class_decl.
(scope_decl::add_member_decl): Make this virtual protected, so
that it can be called (virtually) from e.g, class_decl.
(type_decl_sptr, typedef_decl_sptr): New convenience typedefs.
(class_decl::add_member_decl): New virtual overload for
scope_decl::add_member_decl.
(class_decl::{add_member_type, add_data_member,
add_member_function}): New overloads.
* src/abg-ir.cc (add_decl_to_scope): Benign style cleanup.
(get_type_declaration): Define new function.
(class_decl::add_member_decl): New method.
(class_decl::add_member_type): Avoid silently added a new member
type when that member type has already been (perhaps
inadvertently) added to a scope already. Rather, put a strict
assert in place there. Also add a new overload that constructs
the member type out of a classic type and adds it to the class.
(class_decl::{add_data_member, add_member_function}): Likewise.
(class_decl::{add_member_function_template,
add_member_class_template}): Avoid silently added a new member
template when that template has already been (perhaps
inadvertently) added to a scope already. Rather, put a strict
assert in place there.
* src/abg-reader.cc (push_decl_to_current_scope): Take a an extra
flag saying if the current decl should be added to the current
scope as well (in addition to being pushed onto the stack of
scopes maintained in the reader context).
(push_and_key_type_decl): Likewise, take that extra flag and pass
it to push_decl_to_current_scope.
(build_function_decl, build_var_decl, build_type_decl)
(build_qualified_type_decl, build_pointer_type_def)
(build_reference_type_def, build_enum_type_decl, build_typedef_decl)
(build_function_tdecl, build_class_tdecl): Likewise.
(build_class_decl): Likewise. When building member data, types,
and functions, make sure /not/ to add the data, type of function to
the current scope before adding it to the class_decl. This was
making the member not being added to the class because it already
had a scope.
(build_type_tparameter, build_type_composition)
(build_non_type_tparameter, build_template_tparameter)
(build_type): Adjust to add the template parm to the current scope
explicitly, like previously.
(handle_type_decl): Use build_type_decl function. Add the
type_decl to the current scope, like previously.
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl)
(handle_function_decl, handle_class_decl, handle_function_tdecl)
(handle_class_tdecl): Adjust to add the decl to the current scope,
like previously.
* tests/data/test-read-write/test21.xml: New test input with
member type(def).
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-19 09:06:04 +00:00
|
|
|
shared_ptr<decl_base>
|
|
|
|
get_type_declaration(const shared_ptr<type_base>);
|
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<decl_base>, std::ostream&);
|
|
|
|
|
2013-10-16 20:01:28 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<decl_base>);
|
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<type_base>, std::ostream&);
|
|
|
|
|
2013-10-16 20:01:28 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<type_base>);
|
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<var_decl>, std::ostream&);
|
|
|
|
|
2013-10-16 20:01:28 +00:00
|
|
|
void
|
2013-10-19 14:01:59 +00:00
|
|
|
dump(const shared_ptr<var_decl>);
|
2013-10-16 20:01:28 +00:00
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const translation_unit&, std::ostream&);
|
|
|
|
|
2013-10-16 20:01:28 +00:00
|
|
|
void
|
|
|
|
dump(const translation_unit&);
|
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<translation_unit>, std::ostream&);
|
|
|
|
|
|
|
|
void
|
|
|
|
dump(const shared_ptr<translation_unit>);
|
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
} // end namespace abigail
|
|
|
|
#endif // __ABG_IRFWD_H__
|