Make all type diff types extend new type_diff_base type

* include/abg-comparison.h (type_diff_base, decl_diff_base): New
	types.
	(type_diff_base_sptr): New typedef.
	(pointer_diff, reference_diff, array_diff, qualified_type_diff)
	(enum_diff, class_diff, type_decl_diff, typedef_diff): Make this
	extend the new type_diff_base.
	* src/abg-comparison.cc (type_diff_base::priv, type_diff_base):
	Define these new types and their methods.
	(pointer_diff::pointer_diff, array_diff::array_diff)
	(reference_diff::reference_diff)
	(qualified_type_diff::qualified_type_diff, enum_diff::enum_diff)
	(class_diff::class_diff, type_decl_diff::type_decl_diff)
	(typedef_diff::typedef_diff): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2014-09-19 11:01:00 +02:00
parent c2ca83d62a
commit 26869d665c
3 changed files with 96 additions and 20 deletions

View File

@ -593,6 +593,46 @@ compute_diff(const type_base_sptr,
const type_base_sptr,
diff_context_sptr ctxt);
class type_diff_base;
/// Convenience pointer for a shared pointer to a type_diff_base
typedef shared_ptr<type_diff_base> type_diff_base_sptr;
/// The base class of diff between types.
class type_diff_base : public diff
{
class priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
type_diff_base();
protected:
type_diff_base(decl_base_sptr first_subject,
decl_base_sptr second_subject,
diff_context_sptr ctxt);
public:
virtual ~type_diff_base();
};// end class type_diff_base
/// The base class of diff between decls.
class decl_diff_base : public diff
{
class priv;
typedef shared_ptr<priv> priv_sptr;
priv_sptr priv_;
protected:
decl_diff_base(decl_base_sptr first_subject,
decl_base_sptr second_subject,
diff_context_sptr ctxt);
public:
virtual ~decl_diff_base();
};// end class decl_diff_base
string
get_pretty_representation(diff*);
@ -710,7 +750,7 @@ class pointer_diff;
typedef shared_ptr<pointer_diff> pointer_diff_sptr;
/// The abstraction of a diff between two pointers.
class pointer_diff : public diff
class pointer_diff : public type_diff_base
{
struct priv;
shared_ptr<priv> priv_;
@ -767,7 +807,7 @@ class reference_diff;
typedef shared_ptr<reference_diff> reference_diff_sptr;
/// The abstraction of a diff between two references.
class reference_diff : public diff
class reference_diff : public type_diff_base
{
struct priv;
shared_ptr<priv> priv_;
@ -824,7 +864,7 @@ class array_diff;
typedef shared_ptr<array_diff> array_diff_sptr;
/// The abstraction of a diff between two arrays.
class array_diff : public diff
class array_diff : public type_diff_base
{
struct priv;
shared_ptr<priv> priv_;
@ -878,7 +918,7 @@ 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
class qualified_type_diff : public type_diff_base
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
@ -933,7 +973,7 @@ class enum_diff;
typedef shared_ptr<enum_diff> enum_diff_sptr;
/// Abstraction of a diff between two enums.
class enum_diff : public diff
class enum_diff : public type_diff_base
{
struct priv;
typedef shared_ptr<priv> priv_sptr;
@ -1006,7 +1046,7 @@ typedef shared_ptr<class_diff> class_diff_sptr;
/// This type abstracts changes for a class_decl.
class class_diff : public diff
class class_diff : public type_diff_base
{
struct priv;
shared_ptr<priv> priv_;
@ -1360,7 +1400,7 @@ class type_decl_diff;
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
class type_decl_diff : public type_diff_base
{
type_decl_diff();
@ -1405,7 +1445,7 @@ class typedef_diff;
typedef shared_ptr<typedef_diff> typedef_diff_sptr;
/// Abstraction of a diff between two typedef_decl.
class typedef_diff : public diff
class typedef_diff : public type_diff_base
{
struct priv;
shared_ptr<priv> priv_;

View File

@ -1022,6 +1022,42 @@ report_size_and_alignment_changes(decl_base_sptr first,
const string& indent,
bool nl);
// <type_diff_base stuff>
class type_diff_base::priv
{
public:
friend class type_diff_base;
}; // end class type_diff_base
type_diff_base::type_diff_base(decl_base_sptr first_subject,
decl_base_sptr second_subject,
diff_context_sptr ctxt)
: diff(first_subject, second_subject, ctxt),
priv_(new priv)
{}
type_diff_base::~type_diff_base()
{}
// </type_diff_base stuff>
// <decl_diff_base stuff>
class decl_diff_base::priv
{
public:
friend class decl_diff_base;
};//end class priv
decl_diff_base::decl_diff_base(decl_base_sptr first_subject,
decl_base_sptr second_subject,
diff_context_sptr ctxt)
: diff(first_subject, second_subject, ctxt),
priv_(new priv)
{}
decl_diff_base::~decl_diff_base()
{}
// </decl_diff_base stuff>
// <distinct_diff stuff>
/// The private data structure for @ref distinct_diff.
@ -2272,7 +2308,7 @@ pointer_diff::pointer_diff(pointer_type_def_sptr first,
pointer_type_def_sptr second,
diff_sptr underlying,
diff_context_sptr ctxt)
: diff(first, second, ctxt),
: type_diff_base(first, second, ctxt),
priv_(new priv(underlying))
{}
@ -2435,7 +2471,7 @@ array_diff::array_diff(const array_type_def_sptr first,
const array_type_def_sptr second,
diff_sptr element_type_diff,
diff_context_sptr ctxt)
: diff(first, second, ctxt),
: type_diff_base(first, second, ctxt),
priv_(new priv(element_type_diff))
{}
@ -2681,8 +2717,8 @@ reference_diff::reference_diff(const reference_type_def_sptr first,
const reference_type_def_sptr second,
diff_sptr underlying,
diff_context_sptr ctxt)
: diff(first, second, ctxt),
priv_(new priv(underlying))
: type_diff_base(first, second, ctxt),
priv_(new priv(underlying))
{}
/// Finish building the current instance of @ref reference_diff.
@ -2837,7 +2873,7 @@ qualified_type_diff::qualified_type_diff(qualified_type_def_sptr first,
qualified_type_def_sptr second,
diff_sptr under,
diff_context_sptr ctxt)
: diff(first, second, ctxt),
: type_diff_base(first, second, ctxt),
priv_(new priv(under))
{}
@ -3134,7 +3170,7 @@ enum_diff::enum_diff(const enum_type_decl_sptr first,
const enum_type_decl_sptr second,
const diff_sptr underlying_type_diff,
const diff_context_sptr ctxt)
: diff(first, second,ctxt),
: type_diff_base(first, second,ctxt),
priv_(new priv(underlying_type_diff))
{}
@ -4215,7 +4251,7 @@ class_diff::chain_into_hierarchy()
class_diff::class_diff(shared_ptr<class_decl> first_scope,
shared_ptr<class_decl> second_scope,
diff_context_sptr ctxt)
: diff(first_scope, second_scope, ctxt),
: type_diff_base(first_scope, second_scope, ctxt),
priv_(new priv)
{}
@ -6427,7 +6463,7 @@ compute_diff(const function_decl_sptr first,
type_decl_diff::type_decl_diff(const type_decl_sptr first,
const type_decl_sptr second,
diff_context_sptr ctxt)
: diff(first, second, ctxt)
: type_diff_base(first, second, ctxt)
{}
/// Finish building the current instance of @ref type_decl_diff.
@ -6601,7 +6637,7 @@ typedef_diff::typedef_diff(const typedef_decl_sptr first,
const typedef_decl_sptr second,
const diff_sptr underlying,
diff_context_sptr ctxt)
: diff(first, second, ctxt),
: type_diff_base(first, second, ctxt),
priv_(new priv(underlying))
{}

View File

@ -35,8 +35,8 @@ abisym_SOURCES = abisym.cc
abisymdir = $(bindir)
abisym_LDADD = ../src/libabigail.la
binilint_SOURCES = binilint.cc
binilint = $(bindir)
binilint_LDFLAGS = $(abs_top_builddir)/src/libabigail.la
abinilint_SOURCES = binilint.cc
abinilint = $(bindir)
abinilint_LDFLAGS = $(abs_top_builddir)/src/libabigail.la
AM_CPPFLAGS=-I$(abs_top_srcdir)/include -I$(abs_top_srcdir)/tools