2013-09-28 12:39:57 +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/>.
|
|
|
|
//
|
|
|
|
// Author: Dodji Seketeli
|
|
|
|
|
|
|
|
/// @file
|
|
|
|
|
2013-10-11 15:19:29 +00:00
|
|
|
#include <tr1/unordered_map>
|
2013-09-28 12:39:57 +00:00
|
|
|
#include "abg-ir.h"
|
|
|
|
#include "abg-diff-utils.h"
|
|
|
|
|
|
|
|
namespace abigail
|
|
|
|
{
|
|
|
|
|
2013-11-20 09:54:15 +00:00
|
|
|
/// @brief utilities to compare abi artifacts
|
|
|
|
///
|
|
|
|
/// The main entry points of the namespace are the compute_diff()
|
|
|
|
/// overloads used to compute the difference between two abi artifacts.
|
2013-09-28 12:39:57 +00:00
|
|
|
namespace comparison
|
|
|
|
{
|
|
|
|
|
Un-debugged initial implementation of class diffing.
* include/abg-ir.h (decl_base::get_qualified_name): New
declaration.
(class_decl::{base_specs, member_types, data_members,
member_functions, member_function_templates,
member_class_templates}): Make all these containers be vectors,
rather than list. This makes these containers (like
class_decl::base_specs, class_decl::member_types, etc) be suitable
to be used by the core diffing algorithms to diff their content.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Declare
these new equality operators. These are to be used by the core
diffing algorithms when comparing two vectors of shared pointers
of members of class_decls.
* src/abg-ir.cc (decl_base::get_qualified_name): Define.
(class_decl::class_decl, class_decl::operator==(class_decl&)): Adjust for the
containers type change to a vector.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Define
these.
* include/abg-comparison.h (diff::scope_): Remove
(diff::{first_scope_, second_scope_}): New members.
(class_decl_diff::class_decl_diff): Pass the new scopes to this
constructor.
(class_decl_diff::{first_class_decl, second_class_decl})
(report_changes): New declarations.
* src/abg-comparison.cc (class_decl_diff::class_decl_diff): Update
as per the declaration.
(class_decl_diff::{first_class_decl, second_class_decl}): Define
as per the declaration.
(compute_diff): Initial implementation for this.
(report_changes): Define.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:39:08 +00:00
|
|
|
// Inject types we need into this namespace.
|
|
|
|
using std::ostream;
|
Initial un-debugged implementation of scope diffing
* include/abg-comparison.h (class scope_diff): New type.
(compute_diff(scope_decl_sptr, scope_decl_sptr, scope_diff)): New
declaration.
(report_changes): New declaration.
* src/abg-comparison.cc (struct scope_diff::priv): Define.
(scope_diff::{clear_lookup_tables, lookup_tables_empty,
ensure_lookup_tables_populated, scope_diff, member_changes,
deleted_member_at, inserted_member_at, changed_types,
changed_decls}): Define these new member functions.
(compute_diff): Define.
* include/abg-ir.h (decl_base_sptr): New typedef.
(operator==(decl_base_sptr, decl_base_sptr)): Declare new
operator.
* src/abg-ir.cc (operator==(decl_base_sptr, decl_base_sptr)):
Define.
(scope_decl::{operator==, traverse}): Adjust for using vectors to
store scope members now, rather than lists.
(scope_decl::{declarations, scopes}): Make these types be vector.
This makes the members of a scopes be vector, rather than lists.
This enables them to be diffed.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-05 21:11:22 +00:00
|
|
|
using std::vector;
|
|
|
|
using std::tr1::unordered_map;
|
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
|
|
|
using std::pair;
|
2013-10-11 15:19:29 +00:00
|
|
|
|
2013-09-28 12:39:57 +00:00
|
|
|
using diff_utils::insertion;
|
|
|
|
using diff_utils::deletion;
|
|
|
|
using diff_utils::edit_script;
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
class diff;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a shared_ptr for the @ref diff class
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
typedef shared_ptr<diff> diff_sptr;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a map which key is a string and which
|
|
|
|
/// value is a @ref decl_base_sptr.
|
Initial un-debugged implementation of scope diffing
* include/abg-comparison.h (class scope_diff): New type.
(compute_diff(scope_decl_sptr, scope_decl_sptr, scope_diff)): New
declaration.
(report_changes): New declaration.
* src/abg-comparison.cc (struct scope_diff::priv): Define.
(scope_diff::{clear_lookup_tables, lookup_tables_empty,
ensure_lookup_tables_populated, scope_diff, member_changes,
deleted_member_at, inserted_member_at, changed_types,
changed_decls}): Define these new member functions.
(compute_diff): Define.
* include/abg-ir.h (decl_base_sptr): New typedef.
(operator==(decl_base_sptr, decl_base_sptr)): Declare new
operator.
* src/abg-ir.cc (operator==(decl_base_sptr, decl_base_sptr)):
Define.
(scope_decl::{operator==, traverse}): Adjust for using vectors to
store scope members now, rather than lists.
(scope_decl::{declarations, scopes}): Make these types be vector.
This makes the members of a scopes be vector, rather than lists.
This enables them to be diffed.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-05 21:11:22 +00:00
|
|
|
typedef unordered_map<string, decl_base_sptr> string_decl_base_sptr_map;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a changed type or decl. The first element
|
|
|
|
/// of the pair is the old type/decl and the second is the new one.
|
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
|
|
|
typedef pair<decl_base_sptr, decl_base_sptr> changed_type_or_decl;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a changed function parameter. The first element of
|
|
|
|
/// the pair is the old function parm and the second element is the
|
|
|
|
/// new function parm.
|
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
|
|
|
typedef pair<function_decl::parameter_sptr,
|
|
|
|
function_decl::parameter_sptr> changed_parm;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a map which value is a changed function
|
|
|
|
/// parameter and which key is the name of the function parameter.
|
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
|
|
|
typedef unordered_map<string, changed_parm> string_changed_parm_map;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a map which value is changed type of decl.
|
|
|
|
/// The key of the map is the qualified name of the type/decl.
|
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
|
|
|
typedef unordered_map<string,
|
|
|
|
changed_type_or_decl> string_changed_type_or_decl_map;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a map which value is a function
|
|
|
|
/// parameter. The key is the name of the function parm.
|
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
|
|
|
typedef unordered_map<string, function_decl::parameter_sptr> string_parm_map;
|
Initial un-debugged implementation of scope diffing
* include/abg-comparison.h (class scope_diff): New type.
(compute_diff(scope_decl_sptr, scope_decl_sptr, scope_diff)): New
declaration.
(report_changes): New declaration.
* src/abg-comparison.cc (struct scope_diff::priv): Define.
(scope_diff::{clear_lookup_tables, lookup_tables_empty,
ensure_lookup_tables_populated, scope_diff, member_changes,
deleted_member_at, inserted_member_at, changed_types,
changed_decls}): Define these new member functions.
(compute_diff): Define.
* include/abg-ir.h (decl_base_sptr): New typedef.
(operator==(decl_base_sptr, decl_base_sptr)): Declare new
operator.
* src/abg-ir.cc (operator==(decl_base_sptr, decl_base_sptr)):
Define.
(scope_decl::{operator==, traverse}): Adjust for using vectors to
store scope members now, rather than lists.
(scope_decl::{declarations, scopes}): Make these types be vector.
This makes the members of a scopes be vector, rather than lists.
This enables them to be diffed.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-05 21:11:22 +00:00
|
|
|
|
Support diff for enum_type_decl
* include/abg-ir.h (enum_type_decl_sptr): New typedef.
(enum_type_decl::enumerator::enumerator): Make default constructor
public so that enumerators can be stored in vectors. Maybe I
should have made stored pointers to enumerators instead ...
(enum_type_decl::enumerator::get_qualified_name): Define new
method.
* include/abg-comparison.h (string_enumerator_map)
(changed_enumerator, string_changed_enumerator_map)
(enum_diff_sptr): New convenience typedefs.
(class enum_diff): Declare new class.
(compute_diff): New overload for enum_type_decl.
* src/abg-comparison.cc (enum diff_kind, report_mem_header): Move
these at the beginning of the file.
(struct enum_diff::priv): Define this.
(enum_diff::{clear_lookup_tables, lookup_tables_empty,
ensure_lookup_tables_populated, enum_diff, first_enum,
second_enum, underlying_type_diff, deleted_enumerators,
inserted_enumerators, changed_enumerators, length, report}):
Define these new methods.
(compute_diff): New overload for enum_diff.
(compute_diff_for_types): Add support enum_type_decl here.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-27 10:47:19 +00:00
|
|
|
/// Convenience typedef for a map which value is an enumerator. The
|
|
|
|
/// key is the name of the enumerator.
|
|
|
|
typedef unordered_map<string, enum_type_decl::enumerator> string_enumerator_map;
|
|
|
|
|
|
|
|
/// Convenience typedef for a changed enumerator. The first element
|
|
|
|
/// of the pair is the old enumerator and the second one is the new enumerator.
|
|
|
|
typedef std::pair<enum_type_decl::enumerator,
|
|
|
|
enum_type_decl::enumerator> changed_enumerator;
|
|
|
|
|
|
|
|
/// Convenience typedef for a map which value is a changed enumerator.
|
|
|
|
/// The key is the name of the changed enumerator.
|
|
|
|
typedef unordered_map<string, changed_enumerator> string_changed_enumerator_map;
|
|
|
|
|
2013-09-28 12:39:57 +00:00
|
|
|
/// This type encapsulates an edit script (a set of insertions and
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
/// deletions) for two constructs that are to be diff'ed. The two
|
|
|
|
/// constructs are called the "subjects" of the diff.
|
2013-09-28 12:39:57 +00:00
|
|
|
class diff
|
|
|
|
{
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
decl_base_sptr first_subject_;
|
|
|
|
decl_base_sptr second_subject_;
|
2013-09-28 12:39:57 +00:00
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
protected:
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
diff(decl_base_sptr first_subject,
|
|
|
|
decl_base_sptr second_subject)
|
|
|
|
: first_subject_(first_subject),
|
|
|
|
second_subject_(second_subject)
|
2013-09-28 12:39:57 +00:00
|
|
|
{}
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
public:
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
/// Getter of the first subject of the diff.
|
|
|
|
///
|
|
|
|
/// @return the first subject of the diff.
|
|
|
|
decl_base_sptr
|
|
|
|
first_subject() const
|
|
|
|
{return first_subject_;}
|
|
|
|
|
|
|
|
/// Getter of the second subject of the diff.
|
|
|
|
///
|
|
|
|
/// @return the second subject of the diff.
|
|
|
|
decl_base_sptr
|
|
|
|
second_subject() const
|
|
|
|
{return second_subject_;}
|
|
|
|
|
|
|
|
/// Pure interface to get the length of the changes
|
|
|
|
/// encapsulated by this diff. This is to be implemented by all
|
|
|
|
/// descendants of this class.
|
|
|
|
virtual unsigned
|
|
|
|
length() const = 0;
|
|
|
|
|
2013-11-20 11:32:12 +00:00
|
|
|
/// Pure interface to report the diff in a serialized form that is
|
|
|
|
/// legible for the user.
|
|
|
|
///
|
|
|
|
/// Note that the serializd report has to leave one empty line at
|
|
|
|
/// the end of its content.
|
|
|
|
///
|
|
|
|
/// @param the output stream to serialize the report to.
|
|
|
|
///
|
|
|
|
/// @param indent the indentation string to use.
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
virtual void
|
|
|
|
report(ostream& out, const string& indent = "") const = 0;
|
|
|
|
};// end class diff
|
Un-debugged initial implementation of class diffing.
* include/abg-ir.h (decl_base::get_qualified_name): New
declaration.
(class_decl::{base_specs, member_types, data_members,
member_functions, member_function_templates,
member_class_templates}): Make all these containers be vectors,
rather than list. This makes these containers (like
class_decl::base_specs, class_decl::member_types, etc) be suitable
to be used by the core diffing algorithms to diff their content.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Declare
these new equality operators. These are to be used by the core
diffing algorithms when comparing two vectors of shared pointers
of members of class_decls.
* src/abg-ir.cc (decl_base::get_qualified_name): Define.
(class_decl::class_decl, class_decl::operator==(class_decl&)): Adjust for the
containers type change to a vector.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Define
these.
* include/abg-comparison.h (diff::scope_): Remove
(diff::{first_scope_, second_scope_}): New members.
(class_decl_diff::class_decl_diff): Pass the new scopes to this
constructor.
(class_decl_diff::{first_class_decl, second_class_decl})
(report_changes): New declarations.
* src/abg-comparison.cc (class_decl_diff::class_decl_diff): Update
as per the declaration.
(class_decl_diff::{first_class_decl, second_class_decl}): Define
as per the declaration.
(compute_diff): Initial implementation for this.
(report_changes): Define.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:39:08 +00:00
|
|
|
|
Add diff support for var_decl
* include/abg-comparison.h (class var_diff): New declaration.
(var_diff_sptr): New convenience typedef.
(compute_diff): New overloads for var_diff, decl_base and
type_base.
* src/abg-comparison.cc (try_to_diff): Renamed try_to_diff_types
into this.
(compute_diff_for_types): Adjust for the try_to_diff_types
renaming. Fix comments.
(compute_diff_for_decls): Re-use try_to_diff. Update for
var_decl.
(compute_diff): Define overloads for decl_base, type_base and
var_decl.
(diff_length_of_decl_bases, diff_length_of_type_bases): New static
help functions.
(report_name_size_and_alignment_changes): Renamed
report_size_and_alignment_changes into this. Make it report name
changes as well.
(var_diff::priv): New struct.
(var_diff::{var_diff, first_var, second_var, type_diff, length,
report}): Define methods.
({qualified_type_diff, enum_diff, class_diff, scope_diff,
function_decl_diff}::report): Do not report
anything if the diff is empty.
(type_decl_diff::length): Fix this.
(type_decl_diff::report): Adjust for renaming to
report_name_size_and_alignment_changes.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-28 14:05:30 +00:00
|
|
|
diff_sptr
|
|
|
|
compute_diff(decl_base_sptr, decl_base_sptr);
|
|
|
|
|
|
|
|
diff_sptr
|
|
|
|
compute_diff(type_base_sptr, type_base_sptr);
|
|
|
|
|
|
|
|
class var_diff;
|
|
|
|
|
|
|
|
/// Convenience typedef for a shared pointer to var_diff.
|
|
|
|
typedef shared_ptr<var_diff> var_diff_sptr;
|
|
|
|
|
|
|
|
/// Abstracts a diff between two instances of @ref var_decls
|
|
|
|
class var_diff : public diff
|
|
|
|
{
|
|
|
|
struct priv;
|
|
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
var_diff(var_decl_sptr, var_decl_sptr, diff_sptr);
|
|
|
|
|
|
|
|
public:
|
|
|
|
var_decl_sptr
|
|
|
|
first_var() const;
|
|
|
|
|
|
|
|
var_decl_sptr
|
|
|
|
second_var() const;
|
|
|
|
|
|
|
|
diff_sptr
|
|
|
|
type_diff() const;
|
|
|
|
|
|
|
|
virtual unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
report(ostream& out, const string& indent = "") const;
|
|
|
|
|
|
|
|
friend var_diff_sptr
|
|
|
|
compute_diff(const var_decl_sptr, const var_decl_sptr);
|
|
|
|
}; // end class var_diff
|
|
|
|
|
|
|
|
var_diff_sptr
|
|
|
|
compute_diff(const var_decl_sptr, const var_decl_sptr);
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
class pointer_diff;
|
2013-11-20 09:54:15 +00:00
|
|
|
/// Convenience typedef for a shared pointer on a @ref
|
|
|
|
/// pointer_diff type.
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
typedef shared_ptr<pointer_diff> pointer_diff_sptr;
|
Initial un-debugged implementation of scope diffing
* include/abg-comparison.h (class scope_diff): New type.
(compute_diff(scope_decl_sptr, scope_decl_sptr, scope_diff)): New
declaration.
(report_changes): New declaration.
* src/abg-comparison.cc (struct scope_diff::priv): Define.
(scope_diff::{clear_lookup_tables, lookup_tables_empty,
ensure_lookup_tables_populated, scope_diff, member_changes,
deleted_member_at, inserted_member_at, changed_types,
changed_decls}): Define these new member functions.
(compute_diff): Define.
* include/abg-ir.h (decl_base_sptr): New typedef.
(operator==(decl_base_sptr, decl_base_sptr)): Declare new
operator.
* src/abg-ir.cc (operator==(decl_base_sptr, decl_base_sptr)):
Define.
(scope_decl::{operator==, traverse}): Adjust for using vectors to
store scope members now, rather than lists.
(scope_decl::{declarations, scopes}): Make these types be vector.
This makes the members of a scopes be vector, rather than lists.
This enables them to be diffed.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-05 21:11:22 +00:00
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
/// The abstraction of a diff between two pointers.
|
|
|
|
class pointer_diff : public diff
|
|
|
|
{
|
|
|
|
struct priv;
|
|
|
|
shared_ptr<priv> priv_;
|
2013-09-28 12:39:57 +00:00
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
protected:
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
pointer_diff(pointer_type_def_sptr first,
|
|
|
|
pointer_type_def_sptr second);
|
2013-11-25 21:46:10 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
const pointer_type_def_sptr
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
first_pointer() const;
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
const pointer_type_def_sptr
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
second_pointer() const;
|
|
|
|
|
|
|
|
diff_sptr
|
|
|
|
underlying_type_diff() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
underlying_type_diff(const diff_sptr);
|
|
|
|
|
|
|
|
virtual unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
report(ostream&, const string& indent = "") const;
|
2013-11-25 21:46:10 +00:00
|
|
|
|
|
|
|
friend pointer_diff_sptr
|
|
|
|
compute_diff(pointer_type_def_sptr first,
|
|
|
|
pointer_type_def_sptr second);
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
};// end class pointer_diff
|
|
|
|
|
|
|
|
pointer_diff_sptr
|
|
|
|
compute_diff(pointer_type_def_sptr first,
|
|
|
|
pointer_type_def_sptr second);
|
|
|
|
|
|
|
|
class reference_diff;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a shared pointer on a @ref
|
|
|
|
/// reference_diff type.
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
typedef shared_ptr<reference_diff> reference_diff_sptr;
|
|
|
|
|
|
|
|
/// The abstraction of a diff between two references.
|
|
|
|
class reference_diff : public diff
|
2013-09-28 12:39:57 +00:00
|
|
|
{
|
|
|
|
struct priv;
|
|
|
|
shared_ptr<priv> priv_;
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
protected:
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
reference_diff(const reference_type_def_sptr first,
|
|
|
|
const reference_type_def_sptr second);
|
2013-09-28 12:39:57 +00:00
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
public:
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
reference_type_def_sptr
|
|
|
|
first_reference() const;
|
Un-debugged initial implementation of class diffing.
* include/abg-ir.h (decl_base::get_qualified_name): New
declaration.
(class_decl::{base_specs, member_types, data_members,
member_functions, member_function_templates,
member_class_templates}): Make all these containers be vectors,
rather than list. This makes these containers (like
class_decl::base_specs, class_decl::member_types, etc) be suitable
to be used by the core diffing algorithms to diff their content.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Declare
these new equality operators. These are to be used by the core
diffing algorithms when comparing two vectors of shared pointers
of members of class_decls.
* src/abg-ir.cc (decl_base::get_qualified_name): Define.
(class_decl::class_decl, class_decl::operator==(class_decl&)): Adjust for the
containers type change to a vector.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Define
these.
* include/abg-comparison.h (diff::scope_): Remove
(diff::{first_scope_, second_scope_}): New members.
(class_decl_diff::class_decl_diff): Pass the new scopes to this
constructor.
(class_decl_diff::{first_class_decl, second_class_decl})
(report_changes): New declarations.
* src/abg-comparison.cc (class_decl_diff::class_decl_diff): Update
as per the declaration.
(class_decl_diff::{first_class_decl, second_class_decl}): Define
as per the declaration.
(compute_diff): Initial implementation for this.
(report_changes): Define.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:39:08 +00:00
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
reference_type_def_sptr
|
|
|
|
second_reference() const;
|
|
|
|
|
|
|
|
const diff_sptr&
|
|
|
|
underlying_type_diff() const;
|
|
|
|
|
|
|
|
diff_sptr&
|
|
|
|
underlying_type_diff(diff_sptr);
|
|
|
|
|
|
|
|
virtual unsigned
|
Un-debugged initial implementation of class diffing.
* include/abg-ir.h (decl_base::get_qualified_name): New
declaration.
(class_decl::{base_specs, member_types, data_members,
member_functions, member_function_templates,
member_class_templates}): Make all these containers be vectors,
rather than list. This makes these containers (like
class_decl::base_specs, class_decl::member_types, etc) be suitable
to be used by the core diffing algorithms to diff their content.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Declare
these new equality operators. These are to be used by the core
diffing algorithms when comparing two vectors of shared pointers
of members of class_decls.
* src/abg-ir.cc (decl_base::get_qualified_name): Define.
(class_decl::class_decl, class_decl::operator==(class_decl&)): Adjust for the
containers type change to a vector.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Define
these.
* include/abg-comparison.h (diff::scope_): Remove
(diff::{first_scope_, second_scope_}): New members.
(class_decl_diff::class_decl_diff): Pass the new scopes to this
constructor.
(class_decl_diff::{first_class_decl, second_class_decl})
(report_changes): New declarations.
* src/abg-comparison.cc (class_decl_diff::class_decl_diff): Update
as per the declaration.
(class_decl_diff::{first_class_decl, second_class_decl}): Define
as per the declaration.
(compute_diff): Initial implementation for this.
(report_changes): Define.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:39:08 +00:00
|
|
|
length() const;
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
virtual void
|
|
|
|
report(ostream&, const string& indent = "") const;
|
2013-11-25 21:46:10 +00:00
|
|
|
|
|
|
|
friend reference_diff_sptr
|
|
|
|
compute_diff(reference_type_def_sptr first,
|
|
|
|
reference_type_def_sptr second);
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
};// end class reference_diff
|
|
|
|
|
|
|
|
reference_diff_sptr
|
|
|
|
compute_diff(reference_type_def_sptr first,
|
|
|
|
reference_type_def_sptr second);
|
|
|
|
|
2013-11-25 22:14:58 +00:00
|
|
|
class qualified_type_diff;
|
|
|
|
typedef class shared_ptr<qualified_type_diff> qualified_type_diff_sptr;
|
|
|
|
|
|
|
|
/// Abstraction of a diff between two qualified types.
|
|
|
|
class qualified_type_diff : public diff
|
|
|
|
{
|
|
|
|
struct priv;
|
|
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
qualified_type_diff(qualified_type_def_sptr first,
|
|
|
|
qualified_type_def_sptr second);
|
|
|
|
|
|
|
|
public:
|
|
|
|
const qualified_type_def_sptr
|
|
|
|
first_qualified_type() const;
|
|
|
|
|
|
|
|
const qualified_type_def_sptr
|
|
|
|
second_qualified_type() const;
|
|
|
|
|
|
|
|
diff_sptr
|
|
|
|
underlying_type_diff() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
underlying_type_diff(const diff_sptr);
|
|
|
|
|
|
|
|
virtual unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
report(ostream&, const string& indent = "") const;
|
|
|
|
|
|
|
|
friend qualified_type_diff_sptr
|
|
|
|
compute_diff(const qualified_type_def_sptr,
|
|
|
|
const qualified_type_def_sptr);
|
|
|
|
};// end class qualified_type_diff.
|
|
|
|
|
|
|
|
qualified_type_diff_sptr
|
|
|
|
compute_diff(const qualified_type_def_sptr,
|
|
|
|
const qualified_type_def_sptr);
|
|
|
|
|
Support diff for enum_type_decl
* include/abg-ir.h (enum_type_decl_sptr): New typedef.
(enum_type_decl::enumerator::enumerator): Make default constructor
public so that enumerators can be stored in vectors. Maybe I
should have made stored pointers to enumerators instead ...
(enum_type_decl::enumerator::get_qualified_name): Define new
method.
* include/abg-comparison.h (string_enumerator_map)
(changed_enumerator, string_changed_enumerator_map)
(enum_diff_sptr): New convenience typedefs.
(class enum_diff): Declare new class.
(compute_diff): New overload for enum_type_decl.
* src/abg-comparison.cc (enum diff_kind, report_mem_header): Move
these at the beginning of the file.
(struct enum_diff::priv): Define this.
(enum_diff::{clear_lookup_tables, lookup_tables_empty,
ensure_lookup_tables_populated, enum_diff, first_enum,
second_enum, underlying_type_diff, deleted_enumerators,
inserted_enumerators, changed_enumerators, length, report}):
Define these new methods.
(compute_diff): New overload for enum_diff.
(compute_diff_for_types): Add support enum_type_decl here.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-27 10:47:19 +00:00
|
|
|
class enum_diff;
|
|
|
|
typedef shared_ptr<enum_diff> enum_diff_sptr;
|
|
|
|
|
|
|
|
/// Abstraction of a diff between two enums.
|
|
|
|
class enum_diff : public diff
|
|
|
|
{
|
|
|
|
struct priv;
|
|
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
|
|
|
|
void
|
|
|
|
clear_lookup_tables();
|
|
|
|
|
|
|
|
bool
|
|
|
|
lookup_tables_empty() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
ensure_lookup_tables_populated();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
enum_diff(const enum_type_decl_sptr,
|
|
|
|
const enum_type_decl_sptr,
|
|
|
|
const diff_sptr);
|
|
|
|
|
|
|
|
public:
|
|
|
|
const enum_type_decl_sptr
|
|
|
|
first_enum() const;
|
|
|
|
|
|
|
|
const enum_type_decl_sptr
|
|
|
|
second_enum() const;
|
|
|
|
|
|
|
|
diff_sptr
|
|
|
|
underlying_type_diff() const;
|
|
|
|
|
|
|
|
const string_enumerator_map&
|
|
|
|
deleted_enumerators() const;
|
|
|
|
|
|
|
|
const string_enumerator_map&
|
|
|
|
inserted_enumerators() const;
|
|
|
|
|
|
|
|
const string_changed_enumerator_map&
|
|
|
|
changed_enumerators() const;
|
|
|
|
|
|
|
|
virtual unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
report(ostream&, const string& indent = "") const;
|
|
|
|
|
|
|
|
friend enum_diff_sptr
|
|
|
|
compute_diff(const enum_type_decl_sptr,
|
|
|
|
const enum_type_decl_sptr);
|
|
|
|
};//end class enum_diff;
|
|
|
|
|
|
|
|
enum_diff_sptr
|
|
|
|
compute_diff(const enum_type_decl_sptr,
|
|
|
|
const enum_type_decl_sptr);
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
class class_diff;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a shared pointer on a @ref class_diff type.
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
typedef shared_ptr<class_diff> class_diff_sptr;
|
|
|
|
|
|
|
|
/// This type abstracts changes for a class_decl.
|
|
|
|
class class_diff : public diff
|
|
|
|
{
|
|
|
|
struct priv;
|
|
|
|
shared_ptr<priv> priv_;
|
|
|
|
|
Better support changed base classes and member types
* include/abg-comparison.h (class_diff::{clear_lookup_tables,
lookup_tables_empty, ensure_lookup_tables_populated}): Declare new
methods.
(compute_diff): Make this a friend of class_diff.
* src/abg-comparison.cc (class_diff::priv::{deleted_bases_,
inserted_bases_, changed_bases_, deleted_member_types_,
inserted_member_types_, changed_member_types_,
deleted_data_members_, inserted_data_members_,
changed_data_members_, deleted_member_class_tmpls_,
inserted_member_class_tmpls_, changed_member_class_tmpls_}):
Define new members.
(class_diff::priv::{base_has_changed, member_type_has_changed,
data_member_has_changed}): Declare and define new methods.
(class_diff::{clear_lookup_tables, lookup_tables_empty,
ensure_lookup_tables_populated}): Define new methods.
(class_diff::report): Detect and report when a base class or a
member type has changed, as opposed to just saying that it has
been removed and inserted. Fix the rest of the function to avoid
emitting useless vertical space and avoid saying that the class
has "zero" insertion/deletion of a given kind of member.
(scope_diff::report): avoid saying that the scope has "zero"
insertion/deletion of a given kind of member. Avoid useless
vertical spaces.
(type_decl_diff::report): Avoid useless vertical spaces.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-20 08:25:01 +00:00
|
|
|
void
|
|
|
|
clear_lookup_tables(void);
|
|
|
|
|
|
|
|
bool
|
|
|
|
lookup_tables_empty(void) const;
|
|
|
|
|
|
|
|
void
|
|
|
|
ensure_lookup_tables_populated(void) const;
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
protected:
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
class_diff(class_decl_sptr first_subject,
|
|
|
|
class_decl_sptr second_subject);
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
public:
|
Un-debugged initial implementation of class diffing.
* include/abg-ir.h (decl_base::get_qualified_name): New
declaration.
(class_decl::{base_specs, member_types, data_members,
member_functions, member_function_templates,
member_class_templates}): Make all these containers be vectors,
rather than list. This makes these containers (like
class_decl::base_specs, class_decl::member_types, etc) be suitable
to be used by the core diffing algorithms to diff their content.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Declare
these new equality operators. These are to be used by the core
diffing algorithms when comparing two vectors of shared pointers
of members of class_decls.
* src/abg-ir.cc (decl_base::get_qualified_name): Define.
(class_decl::class_decl, class_decl::operator==(class_decl&)): Adjust for the
containers type change to a vector.
(operator==(class_decl_sptr, class_decl_sptr))
(operator==(class_decl::member_type_sptr, class_decl::member_type_sptr))
(operator==(class_decl::base_spec_sptr,
class_decl::base_spec_sptr))
(operator==(class_decl::data_member_sptr,
class_decl::data_member_sptr))
(operator==(class_decl::member_function_sptr,
class_decl::member_function_sptr))
(operator==(class_decl::member_function_template_sptr,
class_decl::member_function_template_sptr))
(operator==(class_decl::member_class_template_sptr,
class_decl::member_class_template_sptr)): Define
these.
* include/abg-comparison.h (diff::scope_): Remove
(diff::{first_scope_, second_scope_}): New members.
(class_decl_diff::class_decl_diff): Pass the new scopes to this
constructor.
(class_decl_diff::{first_class_decl, second_class_decl})
(report_changes): New declarations.
* src/abg-comparison.cc (class_decl_diff::class_decl_diff): Update
as per the declaration.
(class_decl_diff::{first_class_decl, second_class_decl}): Define
as per the declaration.
(compute_diff): Initial implementation for this.
(report_changes): Define.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:39:08 +00:00
|
|
|
//TODO: add change of the name of the type.
|
|
|
|
|
|
|
|
shared_ptr<class_decl>
|
|
|
|
first_class_decl() const;
|
|
|
|
|
|
|
|
shared_ptr<class_decl>
|
|
|
|
second_class_decl() const;
|
2013-09-28 12:39:57 +00:00
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
const edit_script&
|
2013-09-28 12:39:57 +00:00
|
|
|
base_changes() const;
|
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
edit_script&
|
2013-09-28 12:39:57 +00:00
|
|
|
base_changes();
|
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
const edit_script&
|
2013-09-28 12:39:57 +00:00
|
|
|
member_types_changes() const;
|
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
edit_script&
|
2013-09-28 12:39:57 +00:00
|
|
|
member_types_changes();
|
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
const edit_script&
|
|
|
|
data_members_changes() const;
|
2013-09-28 12:39:57 +00:00
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
edit_script&
|
|
|
|
data_members_changes();
|
2013-09-28 12:39:57 +00:00
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
const edit_script&
|
2013-09-28 12:39:57 +00:00
|
|
|
member_fns_changes() const;
|
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
edit_script&
|
2013-09-28 12:39:57 +00:00
|
|
|
member_fns_changes();
|
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
const edit_script&
|
|
|
|
member_fn_tmpls_changes() const;
|
2013-09-28 12:39:57 +00:00
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
edit_script&
|
|
|
|
member_fn_tmpls_changes();
|
2013-09-28 12:39:57 +00:00
|
|
|
|
Change the diff::changes_type back to just edit_script
* include/abg-comparison.h (diff::changes_type):
Remove this typedef.
(class_decl_diff::data_members_changes): Rename
class_decl_diff::data_member_changes into this.
(class_decl_diff::member_fn_tmpls_changes): Renamed
class_decl_diff::member_fn_tmpl_changes into this.
(class_decl_diff::member_class_tmpls_changes): Renamed
class_decl_diff::member_class_tmpl_changes into this.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these declarations for the use of edit_script.
* src/abg-comparison.cc (class_decl_diff::priv::*): Likewise.
(class_decl_diff::{base_changes, member_types_changes,
data_members_changes, member_fns_changes, member_fn_tmpls_changes,
member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust
these definitions for the above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-04 15:17:26 +00:00
|
|
|
const edit_script&
|
|
|
|
member_class_tmpls_changes() const;
|
|
|
|
|
|
|
|
edit_script&
|
|
|
|
member_class_tmpls_changes();
|
2013-09-28 12:39:57 +00:00
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
virtual unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
report(ostream&, const string& indent = "") const;
|
Better support changed base classes and member types
* include/abg-comparison.h (class_diff::{clear_lookup_tables,
lookup_tables_empty, ensure_lookup_tables_populated}): Declare new
methods.
(compute_diff): Make this a friend of class_diff.
* src/abg-comparison.cc (class_diff::priv::{deleted_bases_,
inserted_bases_, changed_bases_, deleted_member_types_,
inserted_member_types_, changed_member_types_,
deleted_data_members_, inserted_data_members_,
changed_data_members_, deleted_member_class_tmpls_,
inserted_member_class_tmpls_, changed_member_class_tmpls_}):
Define new members.
(class_diff::priv::{base_has_changed, member_type_has_changed,
data_member_has_changed}): Declare and define new methods.
(class_diff::{clear_lookup_tables, lookup_tables_empty,
ensure_lookup_tables_populated}): Define new methods.
(class_diff::report): Detect and report when a base class or a
member type has changed, as opposed to just saying that it has
been removed and inserted. Fix the rest of the function to avoid
emitting useless vertical space and avoid saying that the class
has "zero" insertion/deletion of a given kind of member.
(scope_diff::report): avoid saying that the scope has "zero"
insertion/deletion of a given kind of member. Avoid useless
vertical spaces.
(type_decl_diff::report): Avoid useless vertical spaces.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-20 08:25:01 +00:00
|
|
|
|
|
|
|
friend class_diff_sptr
|
|
|
|
compute_diff(const class_decl_sptr first,
|
|
|
|
const class_decl_sptr second);
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
};// end class_diff
|
2013-09-28 12:39:57 +00:00
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
class_diff_sptr
|
|
|
|
compute_diff(const class_decl_sptr first,
|
|
|
|
const class_decl_sptr second);
|
2013-09-28 12:39:57 +00:00
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
class scope_diff;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a shared pointer on a @ref scope_diff.
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
typedef shared_ptr<scope_diff> scope_diff_sptr;
|
2013-10-11 15:19:29 +00:00
|
|
|
|
|
|
|
/// An abstractions of the changes between two scopes.
|
|
|
|
class scope_diff : public diff
|
|
|
|
{
|
|
|
|
struct priv;
|
|
|
|
shared_ptr<priv> priv_;
|
|
|
|
|
|
|
|
bool
|
|
|
|
lookup_tables_empty() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
clear_lookup_tables();
|
|
|
|
|
|
|
|
void
|
|
|
|
ensure_lookup_tables_populated();
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
protected:
|
|
|
|
scope_diff(scope_decl_sptr first_scope,
|
|
|
|
scope_decl_sptr second_scope);
|
|
|
|
|
2013-10-11 15:19:29 +00:00
|
|
|
public:
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
friend scope_diff_sptr
|
2013-11-25 21:46:10 +00:00
|
|
|
compute_diff(const scope_decl_sptr,
|
|
|
|
const scope_decl_sptr,
|
|
|
|
scope_diff_sptr);
|
2013-10-11 15:19:29 +00:00
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
friend scope_diff_sptr
|
|
|
|
compute_diff(const scope_decl_sptr first_scope,
|
|
|
|
const scope_decl_sptr second_scope);
|
2013-10-11 15:19:29 +00:00
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
const scope_decl_sptr
|
|
|
|
first_scope() const;
|
|
|
|
|
|
|
|
const scope_decl_sptr
|
|
|
|
second_scope() const;
|
|
|
|
|
2013-10-11 15:19:29 +00:00
|
|
|
const edit_script&
|
|
|
|
member_changes() const;
|
|
|
|
|
|
|
|
edit_script&
|
|
|
|
member_changes();
|
|
|
|
|
|
|
|
const decl_base_sptr
|
|
|
|
deleted_member_at(unsigned index) const;
|
|
|
|
|
|
|
|
const decl_base_sptr
|
|
|
|
deleted_member_at(vector<deletion>::const_iterator) const;
|
|
|
|
|
|
|
|
const decl_base_sptr
|
|
|
|
inserted_member_at(unsigned i);
|
|
|
|
|
|
|
|
const decl_base_sptr
|
|
|
|
inserted_member_at(vector<unsigned>::const_iterator i);
|
|
|
|
|
|
|
|
const string_changed_type_or_decl_map&
|
|
|
|
changed_types() const;
|
|
|
|
|
|
|
|
const string_changed_type_or_decl_map&
|
|
|
|
changed_decls() const;
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
|
2013-10-24 06:58:43 +00:00
|
|
|
const string_decl_base_sptr_map&
|
|
|
|
removed_types() const;
|
|
|
|
|
|
|
|
const string_decl_base_sptr_map&
|
|
|
|
removed_decls() const;
|
|
|
|
|
|
|
|
const string_decl_base_sptr_map&
|
|
|
|
added_types() const;
|
|
|
|
|
|
|
|
const string_decl_base_sptr_map&
|
|
|
|
added_decls() const;
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
virtual unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
report(ostream&, const string& indent = "") const;
|
2013-10-11 15:19:29 +00:00
|
|
|
};// end class scope_diff
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
scope_diff_sptr
|
|
|
|
compute_diff(const scope_decl_sptr first_scope,
|
|
|
|
const scope_decl_sptr second_scope,
|
|
|
|
scope_diff_sptr d);
|
2013-10-11 15:19:29 +00:00
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
scope_diff_sptr
|
|
|
|
compute_diff(const scope_decl_sptr first_scope,
|
|
|
|
const scope_decl_sptr second_scope);
|
|
|
|
|
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
|
|
|
class function_decl_diff;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a shared pointer on a @ref function_decl type.
|
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
|
|
|
typedef shared_ptr<function_decl_diff> function_decl_diff_sptr;
|
|
|
|
|
|
|
|
/// Abstraction of a diff between two function_decl.
|
|
|
|
class function_decl_diff : public diff
|
|
|
|
{
|
|
|
|
struct priv;
|
|
|
|
shared_ptr<priv> priv_;
|
|
|
|
|
|
|
|
void
|
|
|
|
ensure_lookup_tables_populated();
|
|
|
|
|
|
|
|
const function_decl::parameter_sptr
|
|
|
|
deleted_parameter_at(int i) const;
|
|
|
|
|
|
|
|
const function_decl::parameter_sptr
|
|
|
|
inserted_parameter_at(int i) const;
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
protected:
|
|
|
|
function_decl_diff(const function_decl_sptr first,
|
|
|
|
const function_decl_sptr second);
|
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
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
public:
|
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
|
|
|
friend function_decl_diff_sptr
|
|
|
|
compute_diff(const function_decl_sptr first,
|
|
|
|
const function_decl_sptr second);
|
|
|
|
|
|
|
|
const function_decl_sptr
|
|
|
|
first_function_decl() const;
|
|
|
|
|
|
|
|
const function_decl_sptr
|
|
|
|
second_function_decl() const;
|
|
|
|
|
|
|
|
const diff_sptr
|
|
|
|
return_diff() const;
|
|
|
|
|
|
|
|
const string_changed_parm_map&
|
|
|
|
changed_parms() const;
|
|
|
|
|
|
|
|
const string_parm_map&
|
|
|
|
removed_parms() const;
|
|
|
|
|
|
|
|
const string_parm_map&
|
|
|
|
added_parms() const;
|
|
|
|
|
|
|
|
virtual unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
report(ostream&, const string& indent = "") const;
|
|
|
|
}; // end class function_decl_diff
|
|
|
|
|
|
|
|
function_decl_diff_sptr
|
|
|
|
compute_diff(const function_decl_sptr first,
|
|
|
|
const function_decl_sptr second);
|
|
|
|
|
Add diff support for typedef_decl and type_decl
* include/abg-ir.h (operator<<(std::ostream&,
decl_base::visibility)): Declare new streaming operator.
* src/abg-ir.cc (operator<<(std::ostream&,
decl_base::visibility)): Define it.
(type_decl::{operator==, get_pretty_representation}): Likewise,
define these new overloads.
(decl_base::{operator==, get_pretty_representation}): New overloads.
* include/abg-comparison.h (type_decl_diff type_decl_diff_sptr,
typedef_diff, typedef_diff_sptr): Declare new classes and
typedefs.
* src/abg-comparison.cc (type_decl_diff::{type_decl_diff,
first_type_decl, second_type_decl, length, report}): New methods
definitions.
(compute_diff): New function definition that takes pointers of
type_decl.
(typedef_diff::{typedef_diff, first_typedef_decl,
second_typedef_decl, underlying_type_diff, length, report}): New
methods.
(compute_diff): New function definition that takes pointers of
typedef_decl.
(try_to_diff_types): New template function, factorized out of ...
(compute_diff_for_types): ... this. Add support diffing type_decl
and typedef_decl.
(pointer_diff::report): Fix indentation of emitted report.
* tools/bidiff.cc (parse_command_line): Fix style.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-19 09:58:56 +00:00
|
|
|
class type_decl_diff;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a shared pointer on a @ref type_decl_diff type.
|
Add diff support for typedef_decl and type_decl
* include/abg-ir.h (operator<<(std::ostream&,
decl_base::visibility)): Declare new streaming operator.
* src/abg-ir.cc (operator<<(std::ostream&,
decl_base::visibility)): Define it.
(type_decl::{operator==, get_pretty_representation}): Likewise,
define these new overloads.
(decl_base::{operator==, get_pretty_representation}): New overloads.
* include/abg-comparison.h (type_decl_diff type_decl_diff_sptr,
typedef_diff, typedef_diff_sptr): Declare new classes and
typedefs.
* src/abg-comparison.cc (type_decl_diff::{type_decl_diff,
first_type_decl, second_type_decl, length, report}): New methods
definitions.
(compute_diff): New function definition that takes pointers of
type_decl.
(typedef_diff::{typedef_diff, first_typedef_decl,
second_typedef_decl, underlying_type_diff, length, report}): New
methods.
(compute_diff): New function definition that takes pointers of
typedef_decl.
(try_to_diff_types): New template function, factorized out of ...
(compute_diff_for_types): ... this. Add support diffing type_decl
and typedef_decl.
(pointer_diff::report): Fix indentation of emitted report.
* tools/bidiff.cc (parse_command_line): Fix style.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-19 09:58:56 +00:00
|
|
|
typedef shared_ptr<type_decl_diff> type_decl_diff_sptr;
|
|
|
|
|
|
|
|
/// Abstraction of a diff between two basic type declarations.
|
|
|
|
class type_decl_diff : public diff
|
|
|
|
{
|
|
|
|
type_decl_diff();
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
protected:
|
|
|
|
type_decl_diff(const type_decl_sptr, const type_decl_sptr);
|
Add diff support for typedef_decl and type_decl
* include/abg-ir.h (operator<<(std::ostream&,
decl_base::visibility)): Declare new streaming operator.
* src/abg-ir.cc (operator<<(std::ostream&,
decl_base::visibility)): Define it.
(type_decl::{operator==, get_pretty_representation}): Likewise,
define these new overloads.
(decl_base::{operator==, get_pretty_representation}): New overloads.
* include/abg-comparison.h (type_decl_diff type_decl_diff_sptr,
typedef_diff, typedef_diff_sptr): Declare new classes and
typedefs.
* src/abg-comparison.cc (type_decl_diff::{type_decl_diff,
first_type_decl, second_type_decl, length, report}): New methods
definitions.
(compute_diff): New function definition that takes pointers of
type_decl.
(typedef_diff::{typedef_diff, first_typedef_decl,
second_typedef_decl, underlying_type_diff, length, report}): New
methods.
(compute_diff): New function definition that takes pointers of
typedef_decl.
(try_to_diff_types): New template function, factorized out of ...
(compute_diff_for_types): ... this. Add support diffing type_decl
and typedef_decl.
(pointer_diff::report): Fix indentation of emitted report.
* tools/bidiff.cc (parse_command_line): Fix style.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-19 09:58:56 +00:00
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
public:
|
Add diff support for typedef_decl and type_decl
* include/abg-ir.h (operator<<(std::ostream&,
decl_base::visibility)): Declare new streaming operator.
* src/abg-ir.cc (operator<<(std::ostream&,
decl_base::visibility)): Define it.
(type_decl::{operator==, get_pretty_representation}): Likewise,
define these new overloads.
(decl_base::{operator==, get_pretty_representation}): New overloads.
* include/abg-comparison.h (type_decl_diff type_decl_diff_sptr,
typedef_diff, typedef_diff_sptr): Declare new classes and
typedefs.
* src/abg-comparison.cc (type_decl_diff::{type_decl_diff,
first_type_decl, second_type_decl, length, report}): New methods
definitions.
(compute_diff): New function definition that takes pointers of
type_decl.
(typedef_diff::{typedef_diff, first_typedef_decl,
second_typedef_decl, underlying_type_diff, length, report}): New
methods.
(compute_diff): New function definition that takes pointers of
typedef_decl.
(try_to_diff_types): New template function, factorized out of ...
(compute_diff_for_types): ... this. Add support diffing type_decl
and typedef_decl.
(pointer_diff::report): Fix indentation of emitted report.
* tools/bidiff.cc (parse_command_line): Fix style.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-19 09:58:56 +00:00
|
|
|
friend type_decl_diff_sptr
|
|
|
|
compute_diff(const type_decl_sptr, const type_decl_sptr);
|
|
|
|
|
|
|
|
const type_decl_sptr
|
|
|
|
first_type_decl() const;
|
|
|
|
|
|
|
|
const type_decl_sptr
|
|
|
|
second_type_decl() const;
|
|
|
|
|
|
|
|
unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
report(ostream& out, const string& indent = "") const;
|
|
|
|
};// end type_decl_diff
|
|
|
|
|
|
|
|
type_decl_diff_sptr
|
|
|
|
compute_diff(const type_decl_sptr, const type_decl_sptr);
|
|
|
|
|
|
|
|
class typedef_diff;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a shared pointer on a typedef_diff type.
|
Add diff support for typedef_decl and type_decl
* include/abg-ir.h (operator<<(std::ostream&,
decl_base::visibility)): Declare new streaming operator.
* src/abg-ir.cc (operator<<(std::ostream&,
decl_base::visibility)): Define it.
(type_decl::{operator==, get_pretty_representation}): Likewise,
define these new overloads.
(decl_base::{operator==, get_pretty_representation}): New overloads.
* include/abg-comparison.h (type_decl_diff type_decl_diff_sptr,
typedef_diff, typedef_diff_sptr): Declare new classes and
typedefs.
* src/abg-comparison.cc (type_decl_diff::{type_decl_diff,
first_type_decl, second_type_decl, length, report}): New methods
definitions.
(compute_diff): New function definition that takes pointers of
type_decl.
(typedef_diff::{typedef_diff, first_typedef_decl,
second_typedef_decl, underlying_type_diff, length, report}): New
methods.
(compute_diff): New function definition that takes pointers of
typedef_decl.
(try_to_diff_types): New template function, factorized out of ...
(compute_diff_for_types): ... this. Add support diffing type_decl
and typedef_decl.
(pointer_diff::report): Fix indentation of emitted report.
* tools/bidiff.cc (parse_command_line): Fix style.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-19 09:58:56 +00:00
|
|
|
typedef shared_ptr<typedef_diff> typedef_diff_sptr;
|
|
|
|
|
|
|
|
/// Abstraction of a diff between two typedef_decl.
|
|
|
|
class typedef_diff : public diff
|
|
|
|
{
|
|
|
|
struct priv;
|
|
|
|
shared_ptr<priv> priv_;
|
|
|
|
|
|
|
|
typedef_diff();
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
protected:
|
|
|
|
typedef_diff(const typedef_decl_sptr first,
|
|
|
|
const typedef_decl_sptr second);
|
Add diff support for typedef_decl and type_decl
* include/abg-ir.h (operator<<(std::ostream&,
decl_base::visibility)): Declare new streaming operator.
* src/abg-ir.cc (operator<<(std::ostream&,
decl_base::visibility)): Define it.
(type_decl::{operator==, get_pretty_representation}): Likewise,
define these new overloads.
(decl_base::{operator==, get_pretty_representation}): New overloads.
* include/abg-comparison.h (type_decl_diff type_decl_diff_sptr,
typedef_diff, typedef_diff_sptr): Declare new classes and
typedefs.
* src/abg-comparison.cc (type_decl_diff::{type_decl_diff,
first_type_decl, second_type_decl, length, report}): New methods
definitions.
(compute_diff): New function definition that takes pointers of
type_decl.
(typedef_diff::{typedef_diff, first_typedef_decl,
second_typedef_decl, underlying_type_diff, length, report}): New
methods.
(compute_diff): New function definition that takes pointers of
typedef_decl.
(try_to_diff_types): New template function, factorized out of ...
(compute_diff_for_types): ... this. Add support diffing type_decl
and typedef_decl.
(pointer_diff::report): Fix indentation of emitted report.
* tools/bidiff.cc (parse_command_line): Fix style.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-19 09:58:56 +00:00
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
|
|
|
|
public:
|
Add diff support for typedef_decl and type_decl
* include/abg-ir.h (operator<<(std::ostream&,
decl_base::visibility)): Declare new streaming operator.
* src/abg-ir.cc (operator<<(std::ostream&,
decl_base::visibility)): Define it.
(type_decl::{operator==, get_pretty_representation}): Likewise,
define these new overloads.
(decl_base::{operator==, get_pretty_representation}): New overloads.
* include/abg-comparison.h (type_decl_diff type_decl_diff_sptr,
typedef_diff, typedef_diff_sptr): Declare new classes and
typedefs.
* src/abg-comparison.cc (type_decl_diff::{type_decl_diff,
first_type_decl, second_type_decl, length, report}): New methods
definitions.
(compute_diff): New function definition that takes pointers of
type_decl.
(typedef_diff::{typedef_diff, first_typedef_decl,
second_typedef_decl, underlying_type_diff, length, report}): New
methods.
(compute_diff): New function definition that takes pointers of
typedef_decl.
(try_to_diff_types): New template function, factorized out of ...
(compute_diff_for_types): ... this. Add support diffing type_decl
and typedef_decl.
(pointer_diff::report): Fix indentation of emitted report.
* tools/bidiff.cc (parse_command_line): Fix style.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-19 09:58:56 +00:00
|
|
|
friend typedef_diff_sptr
|
|
|
|
compute_diff(const typedef_decl_sptr, const typedef_decl_sptr);
|
|
|
|
|
|
|
|
const typedef_decl_sptr
|
|
|
|
first_typedef_decl() const;
|
|
|
|
|
|
|
|
const typedef_decl_sptr
|
|
|
|
second_typedef_decl() const;
|
|
|
|
|
|
|
|
const diff_sptr
|
|
|
|
underlying_type_diff() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
underlying_type_diff(const diff_sptr);
|
|
|
|
|
|
|
|
virtual unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
report(ostream&, const string& indent = "") const;
|
|
|
|
};// end class typedef_diff
|
|
|
|
|
|
|
|
typedef_diff_sptr
|
|
|
|
compute_diff(const typedef_decl_sptr, const typedef_decl_sptr);
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
class translation_unit_diff;
|
2013-11-20 09:54:15 +00:00
|
|
|
|
|
|
|
/// Convenience typedef for a shared pointer on a
|
|
|
|
/// @ref translation_unit_diff type.
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
typedef shared_ptr<translation_unit_diff> translation_unit_diff_sptr;
|
2013-10-11 15:19:29 +00:00
|
|
|
|
|
|
|
class translation_unit_diff : public scope_diff
|
|
|
|
{
|
2013-11-25 21:46:10 +00:00
|
|
|
protected:
|
2013-10-11 15:19:29 +00:00
|
|
|
translation_unit_diff(translation_unit_sptr first,
|
|
|
|
translation_unit_sptr second);
|
|
|
|
|
2013-11-25 21:46:10 +00:00
|
|
|
public:
|
|
|
|
friend translation_unit_diff_sptr
|
|
|
|
compute_diff(const translation_unit_sptr first,
|
|
|
|
const translation_unit_sptr second);
|
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
virtual unsigned
|
|
|
|
length() const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
report(ostream& out, const string& indent = "") const;
|
|
|
|
};//end clss translation_unit_diff
|
2013-10-11 15:19:29 +00:00
|
|
|
|
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed
first_scope/second_scope into these; so that this diff class now works on
stuff that are not scope. Changed the type of these to
decl_base_sptr
(diff::diff): Update for the change above.
(diff::{length, report}): New virtual pure methods.
(class pointer_diff, reference_diff): New classes declarations.
(compute_diff): New overloads for the new classes above. Make the
existing overloads take shared_pointers instead of references.
Also make them return shared pointers of the computed diff, rather
than just populating diff references passed in parameter.
(class class_diff): Renamed class class_decl_diff into this.
(report_changes): Change these functions into member functions.
* src/abg-comparison.cc (compute_diff_for_types): New static
function.
(pointer_diff::pointer_diff, pointer_diff::first_pointer)
(pointer_diff::second_pointer, pointer_diff::length)
(pointer_diff::underlying_type_diff)
(pointer_diff::underlying_type_diff, pointer_diff::report)
(pointer_diff::report, compute_diff)
(reference_diff::reference_diff, reference_diff::first_reference)
(reference_diff::second_reference)
(reference_diff::underlying_type_diff)
(reference_diff::underlying_type_diff, reference_diff::length)
(reference_diff::report, compute_diff): New functions.
(class_diff::class_diff, class_diff::length)
(class_diff::first_class_decl, class_diff::second_class_decl)
(class_diff::base_changes, class_diff::base_changes)
(class_diff::member_types_changes)
(class_diff::member_types_changes)
(class_diff::data_members_changes)
(class_diff::data_members_changes, class_diff::member_fns_changes)
(class_diff::member_fns_changes)
(class_diff::member_fn_tmpls_changes)
(class_diff::member_class_tmpls_changes)
Update wrt class_decl_diff -> class_diff renaming.
(class_diff::report): Make the report function be a member
function. Add an indentation parameter. Add support for member
types and data members.
(compute_diff): New overload for class_decl_sptr.
(scope_diff::first_scope, scope_diff::second_scope)
(scope_diff::length, scope_diff::report): New member functions.
(scope_diff::{deleted_member_at, inserted_member_at}): Update wrt
first_scope -> first_subject change.
(compute_diff): New overload for scope_decl_sptr.
(translation_unit_diff::report): Change the report function into
this member function.
(compute_diff): Change the overload for translation_unit to take a
translation_unit_sptr rather than a reference.
* tools/bidiff.cc (main): Update this wrt the change of the
signature of compute_diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-15 08:49:44 +00:00
|
|
|
translation_unit_diff_sptr
|
|
|
|
compute_diff(const translation_unit_sptr first,
|
|
|
|
const translation_unit_sptr second);
|
2013-10-11 15:19:29 +00:00
|
|
|
|
2013-09-28 12:39:57 +00:00
|
|
|
}// end namespace comparison
|
|
|
|
|
|
|
|
}// end namespace abigail
|