2013-07-16 19:58:43 +00:00
|
|
|
// -*- Mode: C++ -*-
|
|
|
|
//
|
|
|
|
// Copyright (C) 2013 Red Hat, Inc.
|
2013-07-17 21:39:24 +00:00
|
|
|
//
|
|
|
|
// 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
|
2013-07-16 19:58:43 +00:00
|
|
|
// terms of the GNU Lesser General Public License as published by the
|
|
|
|
// Free Software Foundation; either version 3, or (at your option) any
|
2013-07-17 21:39:24 +00:00
|
|
|
// 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
|
2013-07-16 19:58:43 +00:00
|
|
|
// General Lesser Public License for more details.
|
2013-07-17 21:39:24 +00:00
|
|
|
|
2013-07-16 19:58:43 +00:00
|
|
|
// 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/>.
|
2013-10-10 08:11:35 +00:00
|
|
|
//
|
|
|
|
// Author: Dodji Seketeli
|
2013-07-17 21:39:24 +00:00
|
|
|
|
2013-04-03 06:23:33 +00:00
|
|
|
/// @file
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
|
2013-03-29 14:30:34 +00:00
|
|
|
#ifndef __ABG_IR_H__
|
|
|
|
#define __ABG_IR_H__
|
2013-02-28 10:42:57 +00:00
|
|
|
|
2013-08-27 11:21:26 +00:00
|
|
|
#include "abg-fwd.h"
|
2013-08-07 09:07:29 +00:00
|
|
|
#include "abg-hash.h"
|
2013-08-27 11:21:26 +00:00
|
|
|
#include "abg-traverse.h"
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-02-28 10:42:57 +00:00
|
|
|
namespace abigail
|
|
|
|
{
|
2013-03-28 14:27:15 +00:00
|
|
|
|
2013-08-27 11:21:26 +00:00
|
|
|
/// @brief The source location of a token.
|
|
|
|
///
|
|
|
|
/// This represents the location of a token coming from a given
|
|
|
|
/// translation unit. This location is actually an abstraction of
|
|
|
|
/// cursor in the table of all the locations of all the tokens of the
|
|
|
|
/// translation unit. That table is managed by the location_manager
|
|
|
|
/// type.
|
|
|
|
class location
|
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
unsigned value_;
|
2013-08-27 11:21:26 +00:00
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
location(unsigned v) : value_(v) { }
|
2013-08-27 11:21:26 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
location() : value_(0) { }
|
2013-08-27 11:21:26 +00:00
|
|
|
|
|
|
|
unsigned
|
|
|
|
get_value() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return value_;}
|
2013-08-27 11:21:26 +00:00
|
|
|
|
|
|
|
operator bool() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{ return !!value_; }
|
2013-08-27 11:21:26 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
operator==(const location other) const
|
2013-10-10 08:11:35 +00:00
|
|
|
{return value_ == other.value_;}
|
2013-08-27 11:21:26 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
operator<(const location other) const
|
2013-09-26 14:45:00 +00:00
|
|
|
{ return value_ < other.value_; }
|
2013-08-27 11:21:26 +00:00
|
|
|
|
|
|
|
friend class location_manager;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// @brief The entry point to manage locations.
|
|
|
|
///
|
|
|
|
/// This type keeps a table of all the locations for tokens of a
|
|
|
|
/// given translation unit.
|
|
|
|
class location_manager
|
|
|
|
{
|
|
|
|
struct _Impl;
|
|
|
|
|
|
|
|
/// Pimpl.
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<_Impl> priv_;
|
2013-08-27 11:21:26 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
location_manager();
|
|
|
|
|
|
|
|
location
|
|
|
|
create_new_location(const std::string& fle, size_t lne, size_t col);
|
|
|
|
|
|
|
|
void
|
|
|
|
expand_location(const location location, std::string& path,
|
|
|
|
unsigned& line, unsigned& column) const;
|
|
|
|
};
|
|
|
|
|
2013-09-26 21:33:23 +00:00
|
|
|
struct ir_node_visitor;
|
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
typedef shared_ptr<translation_unit> translation_unit_sptr;
|
|
|
|
typedef std::vector<translation_unit_sptr> translation_units;
|
|
|
|
|
2013-08-27 11:21:26 +00:00
|
|
|
/// This is the abstraction of the set of relevant artefacts (types,
|
|
|
|
/// variable declarations, functions, templates, etc) bundled together
|
|
|
|
/// into a translation unit.
|
|
|
|
class translation_unit : public traversable_base
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
typedef shared_ptr<global_scope> global_scope_sptr;
|
|
|
|
|
|
|
|
private:
|
2013-09-26 14:45:00 +00:00
|
|
|
std::string path_;
|
|
|
|
location_manager loc_mgr_;
|
|
|
|
mutable global_scope_sptr global_scope_;
|
2013-08-27 11:21:26 +00:00
|
|
|
|
|
|
|
// Forbidden
|
|
|
|
translation_unit();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
translation_unit(const std::string& path);
|
|
|
|
|
|
|
|
virtual ~translation_unit();
|
|
|
|
|
|
|
|
const std::string&
|
|
|
|
get_path() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_path(const string&);
|
|
|
|
|
|
|
|
const global_scope_sptr
|
|
|
|
get_global_scope() const;
|
|
|
|
|
|
|
|
location_manager&
|
|
|
|
get_loc_mgr();
|
|
|
|
|
|
|
|
const location_manager&
|
|
|
|
get_loc_mgr() const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_empty() const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
read();
|
|
|
|
|
|
|
|
bool
|
|
|
|
read(const string& buffer);
|
|
|
|
|
|
|
|
bool
|
|
|
|
write(std::ostream& out) const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
write(const string& path) const;
|
|
|
|
|
|
|
|
void
|
|
|
|
traverse(ir_node_visitor& v);
|
|
|
|
};//end class translation_unit
|
|
|
|
|
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 shared_ptr<decl_base> decl_base_sptr;
|
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
/// The base type of all declarations.
|
2013-08-06 22:28:56 +00:00
|
|
|
class decl_base : public traversable_base
|
2013-02-28 23:38:28 +00:00
|
|
|
{
|
2013-03-04 15:29:31 +00:00
|
|
|
public:
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Facility to hash instances of decl_base.
|
|
|
|
struct hash;
|
2013-02-28 23:38:28 +00:00
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
/// ELF visibility
|
2013-03-31 18:04:17 +00:00
|
|
|
enum visibility
|
|
|
|
{
|
|
|
|
VISIBILITY_NONE,
|
|
|
|
VISIBILITY_DEFAULT,
|
|
|
|
VISIBILITY_PROTECTED,
|
|
|
|
VISIBILITY_HIDDEN,
|
|
|
|
VISIBILITY_INTERNAL
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
/// ELF binding
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
enum binding
|
|
|
|
{
|
|
|
|
BINDING_NONE,
|
|
|
|
BINDING_LOCAL,
|
|
|
|
BINDING_GLOBAL,
|
2013-05-10 12:31:24 +00:00
|
|
|
BINDING_WEAK
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2013-08-06 17:18:35 +00:00
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
location location_;
|
|
|
|
std::string name_;
|
|
|
|
std::string mangled_name_;
|
|
|
|
scope_decl* context_;
|
|
|
|
visibility visibility_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
|
|
|
// Forbidden
|
|
|
|
decl_base();
|
|
|
|
|
|
|
|
void
|
|
|
|
set_scope(scope_decl*);
|
|
|
|
|
|
|
|
public:
|
2013-03-31 18:04:17 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
decl_base(const std::string& name, location locus,
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
const std::string& mangled_name = "",
|
2013-08-06 17:18:35 +00:00
|
|
|
visibility vis = VISIBILITY_DEFAULT);
|
2013-03-28 14:27:15 +00:00
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
decl_base(location);
|
2013-03-28 14:27:15 +00:00
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
decl_base(const decl_base&);
|
2013-03-28 14:27:15 +00:00
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
2013-08-06 22:28:56 +00:00
|
|
|
void
|
|
|
|
traverse(ir_node_visitor& v);
|
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
virtual ~decl_base();
|
|
|
|
|
|
|
|
location
|
|
|
|
get_location() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return location_;}
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
|
|
|
|
void
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
set_location(const location& l)
|
2013-09-26 14:45:00 +00:00
|
|
|
{ location_ = l; }
|
2013-02-28 23:38:28 +00:00
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
const string&
|
|
|
|
get_name() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return name_;}
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
|
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
|
|
|
void
|
|
|
|
get_qualified_name(string& qualified_name,
|
|
|
|
const string& separator = "::") const;
|
|
|
|
|
|
|
|
string
|
|
|
|
get_qualified_name(const string& separator = "::") const;
|
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
void
|
|
|
|
set_name(const string& n)
|
2013-09-26 14:45:00 +00:00
|
|
|
{ name_ = n; }
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
const string&
|
|
|
|
get_mangled_name() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return mangled_name_;}
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
set_mangled_name(const std::string& m)
|
2013-09-26 14:45:00 +00:00
|
|
|
{ mangled_name_ = m; }
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
|
2013-03-31 17:35:41 +00:00
|
|
|
scope_decl*
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
get_scope() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return context_;}
|
2013-03-04 15:29:31 +00:00
|
|
|
|
2013-03-31 18:04:17 +00:00
|
|
|
visibility
|
|
|
|
get_visibility() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return visibility_;}
|
2013-03-31 18:04:17 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
set_visibility(visibility v)
|
2013-09-26 14:45:00 +00:00
|
|
|
{ visibility_ = v; }
|
2013-03-31 18:04:17 +00:00
|
|
|
|
Debug read-write of a type-decl in a namespace-decl
* abg-ir.{h,cc} (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, namespace_decl::namespace_decl): Do not
append a decl to its context from within its constructor. It's
better doing that in a function that takes shared_ptrs to decl and
context. That way we avoid memory management havoc.
(decl_base::set_scope): New private function.
(scope_decl::add_member_decl): Make this private.
(add_decl_to_scope): New function, friend of decl_base and
scope_decl.
* abg-reader.cc (read_context::get_cur_scope): Add a non-const
overload.
(handle_type_decl, handle_namespace_decl): Use add_decl_to_scope.
Adjust to new type_decl and namespace_decl constructor signature.
* src/abg-writer.cc (write_type): Emit 'id', not 'xml:id'.
(write_namespace_decl): Emit "namespace-decl", not
"namespace-decl-name", as the name of namespace element.
* tests/Makefile.am (test0.xml): Rename input0.xml into this.
(test1.xml): New test input.
* tests/data/test-read-write/test0.xml: Update to use 'id' as id
attribute, rather than xml:id.
* tests/data/test-read-write/test1.xml: New test.
* test-read-write.cc (struct InOutSpec): New
(main): Reorganize to give a list of input files to read and to
write to an output file, have the test read the input files, write
them, and diff the two.
2013-03-25 15:56:00 +00:00
|
|
|
friend void
|
2013-08-02 23:30:56 +00:00
|
|
|
add_decl_to_scope(shared_ptr<decl_base> dcl, scope_decl* scpe);
|
2013-10-05 20:54:38 +00:00
|
|
|
};// end class decl_base
|
2013-04-22 18:59:50 +00:00
|
|
|
|
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
|
|
|
bool
|
|
|
|
operator==(decl_base_sptr, decl_base_sptr);
|
|
|
|
|
|
|
|
typedef shared_ptr<scope_decl> scope_decl_sptr;
|
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
/// A declaration that introduces a scope.
|
2013-08-06 22:28:56 +00:00
|
|
|
class scope_decl : public virtual decl_base
|
2013-02-28 23:38:28 +00:00
|
|
|
{
|
2013-08-06 17:18:35 +00:00
|
|
|
public:
|
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 std::vector<shared_ptr<decl_base> > declarations;
|
|
|
|
typedef std::vector<shared_ptr<scope_decl> > scopes;
|
2013-08-06 17:18:35 +00:00
|
|
|
|
|
|
|
private:
|
2013-10-05 20:54:38 +00:00
|
|
|
declarations members_;
|
|
|
|
scopes member_scopes_;
|
2013-02-28 23:38:28 +00:00
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
scope_decl();
|
2013-05-23 15:40:05 +00:00
|
|
|
|
Debug read-write of a type-decl in a namespace-decl
* abg-ir.{h,cc} (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, namespace_decl::namespace_decl): Do not
append a decl to its context from within its constructor. It's
better doing that in a function that takes shared_ptrs to decl and
context. That way we avoid memory management havoc.
(decl_base::set_scope): New private function.
(scope_decl::add_member_decl): Make this private.
(add_decl_to_scope): New function, friend of decl_base and
scope_decl.
* abg-reader.cc (read_context::get_cur_scope): Add a non-const
overload.
(handle_type_decl, handle_namespace_decl): Use add_decl_to_scope.
Adjust to new type_decl and namespace_decl constructor signature.
* src/abg-writer.cc (write_type): Emit 'id', not 'xml:id'.
(write_namespace_decl): Emit "namespace-decl", not
"namespace-decl-name", as the name of namespace element.
* tests/Makefile.am (test0.xml): Rename input0.xml into this.
(test1.xml): New test input.
* tests/data/test-read-write/test0.xml: Update to use 'id' as id
attribute, rather than xml:id.
* tests/data/test-read-write/test1.xml: New test.
* test-read-write.cc (struct InOutSpec): New
(main): Reorganize to give a list of input files to read and to
write to an output file, have the test read the input files, write
them, and diff the two.
2013-03-25 15:56:00 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
add_member_decl(const shared_ptr<decl_base> member);
|
Debug read-write of a type-decl in a namespace-decl
* abg-ir.{h,cc} (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, namespace_decl::namespace_decl): Do not
append a decl to its context from within its constructor. It's
better doing that in a function that takes shared_ptrs to decl and
context. That way we avoid memory management havoc.
(decl_base::set_scope): New private function.
(scope_decl::add_member_decl): Make this private.
(add_decl_to_scope): New function, friend of decl_base and
scope_decl.
* abg-reader.cc (read_context::get_cur_scope): Add a non-const
overload.
(handle_type_decl, handle_namespace_decl): Use add_decl_to_scope.
Adjust to new type_decl and namespace_decl constructor signature.
* src/abg-writer.cc (write_type): Emit 'id', not 'xml:id'.
(write_namespace_decl): Emit "namespace-decl", not
"namespace-decl-name", as the name of namespace element.
* tests/Makefile.am (test0.xml): Rename input0.xml into this.
(test1.xml): New test input.
* tests/data/test-read-write/test0.xml: Update to use 'id' as id
attribute, rather than xml:id.
* tests/data/test-read-write/test1.xml: New test.
* test-read-write.cc (struct InOutSpec): New
(main): Reorganize to give a list of input files to read and to
write to an output file, have the test read the input files, write
them, and diff the two.
2013-03-25 15:56:00 +00:00
|
|
|
|
2013-03-04 15:29:31 +00:00
|
|
|
public:
|
2013-08-02 23:30:56 +00:00
|
|
|
scope_decl(const std::string& name, location locus,
|
Introduce/use translation_unit & global_scope types
* abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove.
(abi_corpus::add): New function to add a translation unit.
(abi_corpus::get_translation_units): New declaration.
* abg-corpus.cc (abi_corpus::*): Remove all the definitions of
abi_corpus for now, as the abi_corpus type is not used anymore --
for now at least.
* src/abg-ir.h (add_decl_to_scope, get_global_scope)
(get_translation_unit, is_global_scope, is_decl_at_global_scope)
(class translation_unit, class global_scope): New declarations
* src/abg-ir.cc (translation_unit::translation_unit)
(translation_unit::get_global_scope)
(translation_unit::get_loc_mgr, translation_unit::get_loc_mgr)
(translation_unit::is_empty, get_global_scope)
(get_translation_unit, is_global_scope, is_global_scope)
(is_decl_at_global_scope, global_scope::~global_scope): New
definitions.
(scope_decl::scope_decl, scope_decl::scope_decl)
(scope_decl::add_member_decl, scope_decl::get_member_decls): Move
to abg-ir.h, inline.
* src/abg-reader.h (read_file): Don't use abi_corpus in the api.
Rather, use translation_unit.
* src/abg-reader.cc (read_context::get_cur_scope): Now that we
have a specific instance of global_scope to represent global
scope, don't play games with empty scopes to detect a global
scope.
(read_context::get_translation_unit): New definition.
(read_context::finish_decl_creation, finish_type_decl_creation):
(read_input, read_file, read_location, handle_element)
(handle_type_decl)
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl):
Don't use abi_corpus anymore. Rather, the translation unit a decl
belongs to is accessible from the decl itself.
* src/abg-writer.h (write_to_ostream): Use translation_unit in
this API, rather than abi_corpus.
* src/abg-writer.cc (write_translation_unit): Rename write_corpus
into this. And stop using abi_corpus here.
(write_to_ostream, write_corpus, write_location, write_decl)
(write_type_decl, write_namespace_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl, write_var_decl): Stop
using abi_corpus. Use the translation_unit that is accessible
from the decl being serialized, if need be.
* test-read-write.cc (main): De-serialize the input into an
instance of translation_unit, not an abi_corpus anymore, and
serialize that translation_unit.
2013-04-03 12:36:22 +00:00
|
|
|
visibility vis = VISIBILITY_DEFAULT)
|
2013-08-02 23:30:56 +00:00
|
|
|
: decl_base(name, locus, /*mangled_name=*/name, vis)
|
2013-10-04 15:03:34 +00:00
|
|
|
{}
|
2013-03-28 14:27:15 +00:00
|
|
|
|
Introduce/use translation_unit & global_scope types
* abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove.
(abi_corpus::add): New function to add a translation unit.
(abi_corpus::get_translation_units): New declaration.
* abg-corpus.cc (abi_corpus::*): Remove all the definitions of
abi_corpus for now, as the abi_corpus type is not used anymore --
for now at least.
* src/abg-ir.h (add_decl_to_scope, get_global_scope)
(get_translation_unit, is_global_scope, is_decl_at_global_scope)
(class translation_unit, class global_scope): New declarations
* src/abg-ir.cc (translation_unit::translation_unit)
(translation_unit::get_global_scope)
(translation_unit::get_loc_mgr, translation_unit::get_loc_mgr)
(translation_unit::is_empty, get_global_scope)
(get_translation_unit, is_global_scope, is_global_scope)
(is_decl_at_global_scope, global_scope::~global_scope): New
definitions.
(scope_decl::scope_decl, scope_decl::scope_decl)
(scope_decl::add_member_decl, scope_decl::get_member_decls): Move
to abg-ir.h, inline.
* src/abg-reader.h (read_file): Don't use abi_corpus in the api.
Rather, use translation_unit.
* src/abg-reader.cc (read_context::get_cur_scope): Now that we
have a specific instance of global_scope to represent global
scope, don't play games with empty scopes to detect a global
scope.
(read_context::get_translation_unit): New definition.
(read_context::finish_decl_creation, finish_type_decl_creation):
(read_input, read_file, read_location, handle_element)
(handle_type_decl)
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl):
Don't use abi_corpus anymore. Rather, the translation unit a decl
belongs to is accessible from the decl itself.
* src/abg-writer.h (write_to_ostream): Use translation_unit in
this API, rather than abi_corpus.
* src/abg-writer.cc (write_translation_unit): Rename write_corpus
into this. And stop using abi_corpus here.
(write_to_ostream, write_corpus, write_location, write_decl)
(write_type_decl, write_namespace_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl, write_var_decl): Stop
using abi_corpus. Use the translation_unit that is accessible
from the decl being serialized, if need be.
* test-read-write.cc (main): De-serialize the input into an
instance of translation_unit, not an abi_corpus anymore, and
serialize that translation_unit.
2013-04-03 12:36:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
scope_decl(location l) : decl_base("", l)
|
2013-10-04 15:03:34 +00:00
|
|
|
{}
|
2013-02-28 23:38:28 +00:00
|
|
|
|
2013-03-28 14:27:15 +00:00
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
2013-03-28 14:27:15 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const declarations&
|
Introduce/use translation_unit & global_scope types
* abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove.
(abi_corpus::add): New function to add a translation unit.
(abi_corpus::get_translation_units): New declaration.
* abg-corpus.cc (abi_corpus::*): Remove all the definitions of
abi_corpus for now, as the abi_corpus type is not used anymore --
for now at least.
* src/abg-ir.h (add_decl_to_scope, get_global_scope)
(get_translation_unit, is_global_scope, is_decl_at_global_scope)
(class translation_unit, class global_scope): New declarations
* src/abg-ir.cc (translation_unit::translation_unit)
(translation_unit::get_global_scope)
(translation_unit::get_loc_mgr, translation_unit::get_loc_mgr)
(translation_unit::is_empty, get_global_scope)
(get_translation_unit, is_global_scope, is_global_scope)
(is_decl_at_global_scope, global_scope::~global_scope): New
definitions.
(scope_decl::scope_decl, scope_decl::scope_decl)
(scope_decl::add_member_decl, scope_decl::get_member_decls): Move
to abg-ir.h, inline.
* src/abg-reader.h (read_file): Don't use abi_corpus in the api.
Rather, use translation_unit.
* src/abg-reader.cc (read_context::get_cur_scope): Now that we
have a specific instance of global_scope to represent global
scope, don't play games with empty scopes to detect a global
scope.
(read_context::get_translation_unit): New definition.
(read_context::finish_decl_creation, finish_type_decl_creation):
(read_input, read_file, read_location, handle_element)
(handle_type_decl)
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl):
Don't use abi_corpus anymore. Rather, the translation unit a decl
belongs to is accessible from the decl itself.
* src/abg-writer.h (write_to_ostream): Use translation_unit in
this API, rather than abi_corpus.
* src/abg-writer.cc (write_translation_unit): Rename write_corpus
into this. And stop using abi_corpus here.
(write_to_ostream, write_corpus, write_location, write_decl)
(write_type_decl, write_namespace_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl, write_var_decl): Stop
using abi_corpus. Use the translation_unit that is accessible
from the decl being serialized, if need be.
* test-read-write.cc (main): De-serialize the input into an
instance of translation_unit, not an abi_corpus anymore, and
serialize that translation_unit.
2013-04-03 12:36:22 +00:00
|
|
|
get_member_decls() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return members_;}
|
Introduce/use translation_unit & global_scope types
* abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove.
(abi_corpus::add): New function to add a translation unit.
(abi_corpus::get_translation_units): New declaration.
* abg-corpus.cc (abi_corpus::*): Remove all the definitions of
abi_corpus for now, as the abi_corpus type is not used anymore --
for now at least.
* src/abg-ir.h (add_decl_to_scope, get_global_scope)
(get_translation_unit, is_global_scope, is_decl_at_global_scope)
(class translation_unit, class global_scope): New declarations
* src/abg-ir.cc (translation_unit::translation_unit)
(translation_unit::get_global_scope)
(translation_unit::get_loc_mgr, translation_unit::get_loc_mgr)
(translation_unit::is_empty, get_global_scope)
(get_translation_unit, is_global_scope, is_global_scope)
(is_decl_at_global_scope, global_scope::~global_scope): New
definitions.
(scope_decl::scope_decl, scope_decl::scope_decl)
(scope_decl::add_member_decl, scope_decl::get_member_decls): Move
to abg-ir.h, inline.
* src/abg-reader.h (read_file): Don't use abi_corpus in the api.
Rather, use translation_unit.
* src/abg-reader.cc (read_context::get_cur_scope): Now that we
have a specific instance of global_scope to represent global
scope, don't play games with empty scopes to detect a global
scope.
(read_context::get_translation_unit): New definition.
(read_context::finish_decl_creation, finish_type_decl_creation):
(read_input, read_file, read_location, handle_element)
(handle_type_decl)
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl):
Don't use abi_corpus anymore. Rather, the translation unit a decl
belongs to is accessible from the decl itself.
* src/abg-writer.h (write_to_ostream): Use translation_unit in
this API, rather than abi_corpus.
* src/abg-writer.cc (write_translation_unit): Rename write_corpus
into this. And stop using abi_corpus here.
(write_to_ostream, write_corpus, write_location, write_decl)
(write_type_decl, write_namespace_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl, write_var_decl): Stop
using abi_corpus. Use the translation_unit that is accessible
from the decl being serialized, if need be.
* test-read-write.cc (main): De-serialize the input into an
instance of translation_unit, not an abi_corpus anymore, and
serialize that translation_unit.
2013-04-03 12:36:22 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const scopes&
|
2013-05-23 15:40:05 +00:00
|
|
|
get_member_scopes() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return member_scopes_;}
|
2013-05-23 15:40:05 +00:00
|
|
|
|
Introduce/use translation_unit & global_scope types
* abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove.
(abi_corpus::add): New function to add a translation unit.
(abi_corpus::get_translation_units): New declaration.
* abg-corpus.cc (abi_corpus::*): Remove all the definitions of
abi_corpus for now, as the abi_corpus type is not used anymore --
for now at least.
* src/abg-ir.h (add_decl_to_scope, get_global_scope)
(get_translation_unit, is_global_scope, is_decl_at_global_scope)
(class translation_unit, class global_scope): New declarations
* src/abg-ir.cc (translation_unit::translation_unit)
(translation_unit::get_global_scope)
(translation_unit::get_loc_mgr, translation_unit::get_loc_mgr)
(translation_unit::is_empty, get_global_scope)
(get_translation_unit, is_global_scope, is_global_scope)
(is_decl_at_global_scope, global_scope::~global_scope): New
definitions.
(scope_decl::scope_decl, scope_decl::scope_decl)
(scope_decl::add_member_decl, scope_decl::get_member_decls): Move
to abg-ir.h, inline.
* src/abg-reader.h (read_file): Don't use abi_corpus in the api.
Rather, use translation_unit.
* src/abg-reader.cc (read_context::get_cur_scope): Now that we
have a specific instance of global_scope to represent global
scope, don't play games with empty scopes to detect a global
scope.
(read_context::get_translation_unit): New definition.
(read_context::finish_decl_creation, finish_type_decl_creation):
(read_input, read_file, read_location, handle_element)
(handle_type_decl)
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl):
Don't use abi_corpus anymore. Rather, the translation unit a decl
belongs to is accessible from the decl itself.
* src/abg-writer.h (write_to_ostream): Use translation_unit in
this API, rather than abi_corpus.
* src/abg-writer.cc (write_translation_unit): Rename write_corpus
into this. And stop using abi_corpus here.
(write_to_ostream, write_corpus, write_location, write_decl)
(write_type_decl, write_namespace_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl, write_var_decl): Stop
using abi_corpus. Use the translation_unit that is accessible
from the decl being serialized, if need be.
* test-read-write.cc (main): De-serialize the input into an
instance of translation_unit, not an abi_corpus anymore, and
serialize that translation_unit.
2013-04-03 12:36:22 +00:00
|
|
|
bool
|
|
|
|
is_empty() const
|
2013-10-04 15:03:34 +00:00
|
|
|
{return get_member_decls().empty();}
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
|
|
|
traverse(ir_node_visitor&);
|
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
virtual ~scope_decl();
|
2013-03-04 15:29:31 +00:00
|
|
|
|
Debug read-write of a type-decl in a namespace-decl
* abg-ir.{h,cc} (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, namespace_decl::namespace_decl): Do not
append a decl to its context from within its constructor. It's
better doing that in a function that takes shared_ptrs to decl and
context. That way we avoid memory management havoc.
(decl_base::set_scope): New private function.
(scope_decl::add_member_decl): Make this private.
(add_decl_to_scope): New function, friend of decl_base and
scope_decl.
* abg-reader.cc (read_context::get_cur_scope): Add a non-const
overload.
(handle_type_decl, handle_namespace_decl): Use add_decl_to_scope.
Adjust to new type_decl and namespace_decl constructor signature.
* src/abg-writer.cc (write_type): Emit 'id', not 'xml:id'.
(write_namespace_decl): Emit "namespace-decl", not
"namespace-decl-name", as the name of namespace element.
* tests/Makefile.am (test0.xml): Rename input0.xml into this.
(test1.xml): New test input.
* tests/data/test-read-write/test0.xml: Update to use 'id' as id
attribute, rather than xml:id.
* tests/data/test-read-write/test1.xml: New test.
* test-read-write.cc (struct InOutSpec): New
(main): Reorganize to give a list of input files to read and to
write to an output file, have the test read the input files, write
them, and diff the two.
2013-03-25 15:56:00 +00:00
|
|
|
friend void
|
2013-08-02 23:30:56 +00:00
|
|
|
add_decl_to_scope(shared_ptr<decl_base> dcl, scope_decl* scpe);
|
2013-10-05 20:54:38 +00:00
|
|
|
};//end class scope_decl
|
Debug read-write of a type-decl in a namespace-decl
* abg-ir.{h,cc} (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, namespace_decl::namespace_decl): Do not
append a decl to its context from within its constructor. It's
better doing that in a function that takes shared_ptrs to decl and
context. That way we avoid memory management havoc.
(decl_base::set_scope): New private function.
(scope_decl::add_member_decl): Make this private.
(add_decl_to_scope): New function, friend of decl_base and
scope_decl.
* abg-reader.cc (read_context::get_cur_scope): Add a non-const
overload.
(handle_type_decl, handle_namespace_decl): Use add_decl_to_scope.
Adjust to new type_decl and namespace_decl constructor signature.
* src/abg-writer.cc (write_type): Emit 'id', not 'xml:id'.
(write_namespace_decl): Emit "namespace-decl", not
"namespace-decl-name", as the name of namespace element.
* tests/Makefile.am (test0.xml): Rename input0.xml into this.
(test1.xml): New test input.
* tests/data/test-read-write/test0.xml: Update to use 'id' as id
attribute, rather than xml:id.
* tests/data/test-read-write/test1.xml: New test.
* test-read-write.cc (struct InOutSpec): New
(main): Reorganize to give a list of input files to read and to
write to an output file, have the test read the input files, write
them, and diff the two.
2013-03-25 15:56:00 +00:00
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
|
Introduce/use translation_unit & global_scope types
* abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove.
(abi_corpus::add): New function to add a translation unit.
(abi_corpus::get_translation_units): New declaration.
* abg-corpus.cc (abi_corpus::*): Remove all the definitions of
abi_corpus for now, as the abi_corpus type is not used anymore --
for now at least.
* src/abg-ir.h (add_decl_to_scope, get_global_scope)
(get_translation_unit, is_global_scope, is_decl_at_global_scope)
(class translation_unit, class global_scope): New declarations
* src/abg-ir.cc (translation_unit::translation_unit)
(translation_unit::get_global_scope)
(translation_unit::get_loc_mgr, translation_unit::get_loc_mgr)
(translation_unit::is_empty, get_global_scope)
(get_translation_unit, is_global_scope, is_global_scope)
(is_decl_at_global_scope, global_scope::~global_scope): New
definitions.
(scope_decl::scope_decl, scope_decl::scope_decl)
(scope_decl::add_member_decl, scope_decl::get_member_decls): Move
to abg-ir.h, inline.
* src/abg-reader.h (read_file): Don't use abi_corpus in the api.
Rather, use translation_unit.
* src/abg-reader.cc (read_context::get_cur_scope): Now that we
have a specific instance of global_scope to represent global
scope, don't play games with empty scopes to detect a global
scope.
(read_context::get_translation_unit): New definition.
(read_context::finish_decl_creation, finish_type_decl_creation):
(read_input, read_file, read_location, handle_element)
(handle_type_decl)
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl):
Don't use abi_corpus anymore. Rather, the translation unit a decl
belongs to is accessible from the decl itself.
* src/abg-writer.h (write_to_ostream): Use translation_unit in
this API, rather than abi_corpus.
* src/abg-writer.cc (write_translation_unit): Rename write_corpus
into this. And stop using abi_corpus here.
(write_to_ostream, write_corpus, write_location, write_decl)
(write_type_decl, write_namespace_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl, write_var_decl): Stop
using abi_corpus. Use the translation_unit that is accessible
from the decl being serialized, if need be.
* test-read-write.cc (main): De-serialize the input into an
instance of translation_unit, not an abi_corpus anymore, and
serialize that translation_unit.
2013-04-03 12:36:22 +00:00
|
|
|
/// This abstracts the global scope of a given translation unit.
|
|
|
|
///
|
|
|
|
/// Only one instance of this class must be present in a given
|
|
|
|
/// translation_unit. That instance is implicitely created the first
|
|
|
|
/// time translatin_unit::get_global_scope is invoked.
|
|
|
|
class global_scope : public scope_decl
|
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
translation_unit* translation_unit_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-05-23 15:30:27 +00:00
|
|
|
global_scope(translation_unit *tu)
|
2013-08-02 03:16:22 +00:00
|
|
|
: decl_base("", location()), scope_decl("", location()),
|
2013-09-26 14:45:00 +00:00
|
|
|
translation_unit_(tu)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
Introduce/use translation_unit & global_scope types
* abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove.
(abi_corpus::add): New function to add a translation unit.
(abi_corpus::get_translation_units): New declaration.
* abg-corpus.cc (abi_corpus::*): Remove all the definitions of
abi_corpus for now, as the abi_corpus type is not used anymore --
for now at least.
* src/abg-ir.h (add_decl_to_scope, get_global_scope)
(get_translation_unit, is_global_scope, is_decl_at_global_scope)
(class translation_unit, class global_scope): New declarations
* src/abg-ir.cc (translation_unit::translation_unit)
(translation_unit::get_global_scope)
(translation_unit::get_loc_mgr, translation_unit::get_loc_mgr)
(translation_unit::is_empty, get_global_scope)
(get_translation_unit, is_global_scope, is_global_scope)
(is_decl_at_global_scope, global_scope::~global_scope): New
definitions.
(scope_decl::scope_decl, scope_decl::scope_decl)
(scope_decl::add_member_decl, scope_decl::get_member_decls): Move
to abg-ir.h, inline.
* src/abg-reader.h (read_file): Don't use abi_corpus in the api.
Rather, use translation_unit.
* src/abg-reader.cc (read_context::get_cur_scope): Now that we
have a specific instance of global_scope to represent global
scope, don't play games with empty scopes to detect a global
scope.
(read_context::get_translation_unit): New definition.
(read_context::finish_decl_creation, finish_type_decl_creation):
(read_input, read_file, read_location, handle_element)
(handle_type_decl)
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl):
Don't use abi_corpus anymore. Rather, the translation unit a decl
belongs to is accessible from the decl itself.
* src/abg-writer.h (write_to_ostream): Use translation_unit in
this API, rather than abi_corpus.
* src/abg-writer.cc (write_translation_unit): Rename write_corpus
into this. And stop using abi_corpus here.
(write_to_ostream, write_corpus, write_location, write_decl)
(write_type_decl, write_namespace_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl, write_var_decl): Stop
using abi_corpus. Use the translation_unit that is accessible
from the decl being serialized, if need be.
* test-read-write.cc (main): De-serialize the input into an
instance of translation_unit, not an abi_corpus anymore, and
serialize that translation_unit.
2013-04-03 12:36:22 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
friend class translation_unit;
|
|
|
|
|
|
|
|
translation_unit*
|
|
|
|
get_translation_unit() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return translation_unit_;}
|
Introduce/use translation_unit & global_scope types
* abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove.
(abi_corpus::add): New function to add a translation unit.
(abi_corpus::get_translation_units): New declaration.
* abg-corpus.cc (abi_corpus::*): Remove all the definitions of
abi_corpus for now, as the abi_corpus type is not used anymore --
for now at least.
* src/abg-ir.h (add_decl_to_scope, get_global_scope)
(get_translation_unit, is_global_scope, is_decl_at_global_scope)
(class translation_unit, class global_scope): New declarations
* src/abg-ir.cc (translation_unit::translation_unit)
(translation_unit::get_global_scope)
(translation_unit::get_loc_mgr, translation_unit::get_loc_mgr)
(translation_unit::is_empty, get_global_scope)
(get_translation_unit, is_global_scope, is_global_scope)
(is_decl_at_global_scope, global_scope::~global_scope): New
definitions.
(scope_decl::scope_decl, scope_decl::scope_decl)
(scope_decl::add_member_decl, scope_decl::get_member_decls): Move
to abg-ir.h, inline.
* src/abg-reader.h (read_file): Don't use abi_corpus in the api.
Rather, use translation_unit.
* src/abg-reader.cc (read_context::get_cur_scope): Now that we
have a specific instance of global_scope to represent global
scope, don't play games with empty scopes to detect a global
scope.
(read_context::get_translation_unit): New definition.
(read_context::finish_decl_creation, finish_type_decl_creation):
(read_input, read_file, read_location, handle_element)
(handle_type_decl)
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl):
Don't use abi_corpus anymore. Rather, the translation unit a decl
belongs to is accessible from the decl itself.
* src/abg-writer.h (write_to_ostream): Use translation_unit in
this API, rather than abi_corpus.
* src/abg-writer.cc (write_translation_unit): Rename write_corpus
into this. And stop using abi_corpus here.
(write_to_ostream, write_corpus, write_location, write_decl)
(write_type_decl, write_namespace_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl, write_var_decl): Stop
using abi_corpus. Use the translation_unit that is accessible
from the decl being serialized, if need be.
* test-read-write.cc (main): De-serialize the input into an
instance of translation_unit, not an abi_corpus anymore, and
serialize that translation_unit.
2013-04-03 12:36:22 +00:00
|
|
|
|
|
|
|
virtual ~global_scope();
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
Introduce/use translation_unit & global_scope types
* abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove.
(abi_corpus::add): New function to add a translation unit.
(abi_corpus::get_translation_units): New declaration.
* abg-corpus.cc (abi_corpus::*): Remove all the definitions of
abi_corpus for now, as the abi_corpus type is not used anymore --
for now at least.
* src/abg-ir.h (add_decl_to_scope, get_global_scope)
(get_translation_unit, is_global_scope, is_decl_at_global_scope)
(class translation_unit, class global_scope): New declarations
* src/abg-ir.cc (translation_unit::translation_unit)
(translation_unit::get_global_scope)
(translation_unit::get_loc_mgr, translation_unit::get_loc_mgr)
(translation_unit::is_empty, get_global_scope)
(get_translation_unit, is_global_scope, is_global_scope)
(is_decl_at_global_scope, global_scope::~global_scope): New
definitions.
(scope_decl::scope_decl, scope_decl::scope_decl)
(scope_decl::add_member_decl, scope_decl::get_member_decls): Move
to abg-ir.h, inline.
* src/abg-reader.h (read_file): Don't use abi_corpus in the api.
Rather, use translation_unit.
* src/abg-reader.cc (read_context::get_cur_scope): Now that we
have a specific instance of global_scope to represent global
scope, don't play games with empty scopes to detect a global
scope.
(read_context::get_translation_unit): New definition.
(read_context::finish_decl_creation, finish_type_decl_creation):
(read_input, read_file, read_location, handle_element)
(handle_type_decl)
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl):
Don't use abi_corpus anymore. Rather, the translation unit a decl
belongs to is accessible from the decl itself.
* src/abg-writer.h (write_to_ostream): Use translation_unit in
this API, rather than abi_corpus.
* src/abg-writer.cc (write_translation_unit): Rename write_corpus
into this. And stop using abi_corpus here.
(write_to_ostream, write_corpus, write_location, write_decl)
(write_type_decl, write_namespace_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl, write_var_decl): Stop
using abi_corpus. Use the translation_unit that is accessible
from the decl being serialized, if need be.
* test-read-write.cc (main): De-serialize the input into an
instance of translation_unit, not an abi_corpus anymore, and
serialize that translation_unit.
2013-04-03 12:36:22 +00:00
|
|
|
|
2013-10-05 20:54:38 +00:00
|
|
|
typedef shared_ptr<type_base> type_base_sptr;
|
|
|
|
|
2013-03-04 15:29:31 +00:00
|
|
|
/// An abstraction helper for type declarations
|
2013-02-28 23:38:28 +00:00
|
|
|
class type_base
|
|
|
|
{
|
2013-10-05 20:54:38 +00:00
|
|
|
size_t size_in_bits_;
|
|
|
|
size_t alignment_in_bits_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-03-04 15:29:31 +00:00
|
|
|
// Forbid this.
|
2013-02-28 23:38:28 +00:00
|
|
|
type_base();
|
2013-03-04 15:29:31 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// A hasher for type_base types.
|
|
|
|
struct hash;
|
|
|
|
|
|
|
|
/// A hasher for types. It gets the dynamic type of the current
|
|
|
|
/// instance of type and hashes it accordingly. Note that the hashing
|
|
|
|
/// function of this hasher must be updated each time a new kind of
|
|
|
|
/// type is added to the IR.
|
|
|
|
struct dynamic_hash;
|
|
|
|
|
|
|
|
/// A hasher for shared_ptr<type_base> that will hash it based on the
|
|
|
|
/// runtime type of the type pointed to.
|
|
|
|
struct shared_ptr_hash;
|
|
|
|
|
2013-03-04 15:29:31 +00:00
|
|
|
type_base(size_t s, size_t a);
|
2013-03-28 14:27:15 +00:00
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
virtual ~type_base();
|
2013-03-04 15:29:31 +00:00
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
void
|
|
|
|
set_size_in_bits(size_t);
|
2013-02-28 23:38:28 +00:00
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
size_t
|
|
|
|
get_size_in_bits() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_alignment_in_bits(size_t);
|
|
|
|
|
|
|
|
size_t
|
|
|
|
get_alignment_in_bits() const;
|
2013-10-05 20:54:38 +00:00
|
|
|
};//end class type_base
|
2013-03-27 22:34:07 +00:00
|
|
|
|
2013-02-28 23:38:28 +00:00
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
/// A predicate for deep equality of instances of shared_ptr<type_base>
|
2013-03-28 14:27:15 +00:00
|
|
|
struct type_shared_ptr_equal
|
|
|
|
{
|
|
|
|
bool
|
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
|
|
|
operator()(const type_base_sptr l, const type_base_sptr r) const
|
2013-03-28 14:27:15 +00:00
|
|
|
{
|
|
|
|
if (l != r)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (l)
|
|
|
|
return *l == *r;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
2013-03-28 14:27:15 +00:00
|
|
|
|
2013-02-28 23:38:28 +00:00
|
|
|
/// A basic type declaration that introduces no scope.
|
2013-08-27 11:55:45 +00:00
|
|
|
class type_decl
|
2013-08-08 02:06:43 +00:00
|
|
|
: public virtual decl_base, public virtual type_base
|
2013-02-28 23:38:28 +00:00
|
|
|
{
|
2013-03-04 15:29:31 +00:00
|
|
|
// Forbidden.
|
2013-02-28 23:38:28 +00:00
|
|
|
type_decl();
|
2013-03-04 15:29:31 +00:00
|
|
|
|
2013-02-28 23:38:28 +00:00
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Facility to hash instance of type_decl
|
|
|
|
struct hash;
|
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
type_decl(const std::string& name,
|
|
|
|
size_t size_in_bits, size_t alignment_in_bits,
|
|
|
|
location locus, const std::string& mangled_name = "",
|
|
|
|
visibility vis = VISIBILITY_DEFAULT);
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
|
2013-03-28 14:27:15 +00:00
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const type_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const decl_base&) const;
|
2013-03-28 14:27:15 +00:00
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
|
|
|
traverse(ir_node_visitor&);
|
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
virtual ~type_decl();
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
2013-02-28 23:38:28 +00:00
|
|
|
|
|
|
|
/// A type that introduces a scope.
|
2013-04-23 07:35:31 +00:00
|
|
|
class scope_type_decl : public scope_decl, public virtual type_base
|
2013-02-28 23:38:28 +00:00
|
|
|
{
|
|
|
|
scope_type_decl();
|
2013-03-04 15:29:31 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher for instances of scope_type_decl
|
|
|
|
struct hash;
|
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
scope_type_decl(const std::string& name, size_t size_in_bits,
|
|
|
|
size_t alignment_in_bits, location locus,
|
|
|
|
visibility vis = VISIBILITY_DEFAULT);
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
|
2013-03-28 14:27:15 +00:00
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
2013-03-28 14:27:15 +00:00
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
virtual ~scope_type_decl();
|
2013-03-04 15:29:31 +00:00
|
|
|
};
|
|
|
|
|
2013-03-27 22:34:07 +00:00
|
|
|
/// The abstraction of a namespace declaration
|
2013-03-04 15:29:31 +00:00
|
|
|
class namespace_decl : public scope_decl
|
|
|
|
{
|
2013-02-28 23:38:28 +00:00
|
|
|
public:
|
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
namespace_decl(const std::string& name, location locus,
|
|
|
|
visibility vis = VISIBILITY_DEFAULT);
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
|
2013-03-28 14:27:15 +00:00
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
2013-03-28 14:27:15 +00:00
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
|
|
|
traverse(ir_node_visitor&);
|
|
|
|
|
Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
* src/abg-corpus.{h,cc}: New files.
* src/abg-hash.{h,cc}: Likewise.
* src/abg-libxml-utils.{h,cc}: Likewise.
* src/abg-reader.{h,cc}: Likewise.
* src/abg-serialize.{h,cc}: Likewise.
* src/abg-writer.h: Likewise.
* src/Makefile.am: Build the new files above.
* src/abg-ir.h (class location): Add public accessors for the value, and
a truth operator. Make the methods be inline.
(class decl_base): Renamed decl into this. Renamed what_decl_kind
into what_kind. Renamed get_context into get_scope. Add virtual
destructor, accessors for location and name.
(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
Re-style.
(struct {decl_base_hash, type_decl_hash}): New hashing functors.
(class {scope_type_decl, namespace_decl}): Add virtual dtor.
* src/abg-ir.cc (location::*): Remove location definitions. There
are now inline in the header.
(class decl_base): Renamed decl into this. Remove most of the
definitions from here as their are now inline in the header.
(scope_decl::~scope_decl, type_base::~type_base)
(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
definitions.
2013-03-08 12:49:05 +00:00
|
|
|
virtual ~namespace_decl();
|
2013-10-10 08:11:35 +00:00
|
|
|
};// end class namespace_decl
|
2013-03-27 22:34:07 +00:00
|
|
|
|
|
|
|
/// The abstraction of a qualified type.
|
2013-10-10 08:11:35 +00:00
|
|
|
class qualified_type_def : public virtual type_base, public virtual decl_base
|
2013-03-27 22:34:07 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
char cv_quals_;
|
|
|
|
shared_ptr<type_base> underlying_type_;
|
2013-03-27 22:34:07 +00:00
|
|
|
|
2013-03-28 14:27:15 +00:00
|
|
|
// Forbidden.
|
|
|
|
qualified_type_def();
|
2013-08-02 23:30:56 +00:00
|
|
|
|
2013-03-27 22:34:07 +00:00
|
|
|
public:
|
2013-08-02 23:30:56 +00:00
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// A Hasher for instances of qualified_type_def
|
|
|
|
struct hash;
|
|
|
|
|
2013-03-27 22:34:07 +00:00
|
|
|
/// Bit field values representing the cv qualifiers of the
|
|
|
|
/// underlying type.
|
|
|
|
enum CV
|
|
|
|
{
|
|
|
|
CV_NONE = 0,
|
|
|
|
CV_CONST = 1,
|
2013-06-21 07:39:13 +00:00
|
|
|
CV_VOLATILE = 1 << 1,
|
|
|
|
CV_RESTRICT = 1 << 2
|
2013-03-27 22:34:07 +00:00
|
|
|
};
|
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
qualified_type_def(shared_ptr<type_base> type, CV quals, location locus);
|
2013-03-27 22:34:07 +00:00
|
|
|
|
2013-03-28 14:27:15 +00:00
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
2013-03-28 14:27:15 +00:00
|
|
|
|
2013-03-27 22:34:07 +00:00
|
|
|
char
|
|
|
|
get_cv_quals() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_cv_quals(char cv_quals);
|
|
|
|
|
|
|
|
const shared_ptr<type_base>
|
|
|
|
get_underlying_type() const;
|
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
traverse(ir_node_visitor& v);
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
|
2013-03-27 22:34:07 +00:00
|
|
|
virtual ~qualified_type_def();
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
2013-03-27 22:34:07 +00:00
|
|
|
|
2013-08-27 11:55:45 +00:00
|
|
|
qualified_type_def::CV
|
2013-08-02 23:30:56 +00:00
|
|
|
operator|(qualified_type_def::CV, qualified_type_def::CV);
|
2013-06-21 07:39:13 +00:00
|
|
|
|
2013-10-15 07:44:53 +00:00
|
|
|
typedef shared_ptr<pointer_type_def> pointer_type_def_sptr;
|
|
|
|
|
2013-03-28 14:27:15 +00:00
|
|
|
/// The abstraction of a pointer type.
|
2013-10-10 08:11:35 +00:00
|
|
|
class pointer_type_def : public virtual type_base, public virtual decl_base
|
2013-03-28 14:27:15 +00:00
|
|
|
{
|
2013-10-10 08:11:35 +00:00
|
|
|
shared_ptr<type_base> pointed_to_type_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-03-28 14:27:15 +00:00
|
|
|
// Forbidden.
|
|
|
|
pointer_type_def();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// A hasher for instances of pointer_type_def
|
|
|
|
struct hash;
|
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
pointer_type_def(shared_ptr<type_base>& pointed_to_type, size_t size_in_bits,
|
|
|
|
size_t alignment_in_bits, location locus);
|
2013-03-28 14:27:15 +00:00
|
|
|
|
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
2013-03-28 14:27:15 +00:00
|
|
|
|
|
|
|
shared_ptr<type_base>
|
|
|
|
get_pointed_to_type() const;
|
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
traverse(ir_node_visitor& v);
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
|
2013-03-28 14:27:15 +00:00
|
|
|
virtual ~pointer_type_def();
|
2013-10-10 08:11:35 +00:00
|
|
|
}; // end class pointer_type_def
|
2013-03-29 14:30:34 +00:00
|
|
|
|
2013-10-15 07:44:53 +00:00
|
|
|
typedef shared_ptr<reference_type_def> reference_type_def_sptr;
|
|
|
|
|
2013-03-29 14:30:34 +00:00
|
|
|
/// Abstracts a reference type.
|
2013-10-10 08:11:35 +00:00
|
|
|
class reference_type_def : public virtual type_base, public virtual decl_base
|
2013-03-29 14:30:34 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<type_base> pointed_to_type_;
|
|
|
|
bool is_lvalue_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-03-29 14:30:34 +00:00
|
|
|
// Forbidden.
|
|
|
|
reference_type_def();
|
|
|
|
|
|
|
|
public:
|
2013-08-07 09:07:29 +00:00
|
|
|
|
|
|
|
/// Hasher for intances of reference_type_def.
|
|
|
|
struct hash;
|
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
reference_type_def(const type_base_sptr pointed_to_type,
|
2013-08-02 23:30:56 +00:00
|
|
|
bool lvalue, size_t size_in_bits,
|
|
|
|
size_t alignment_in_bits, location locus);
|
2013-03-29 14:30:34 +00:00
|
|
|
|
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
2013-03-29 14:30:34 +00:00
|
|
|
|
|
|
|
shared_ptr<type_base>
|
|
|
|
get_pointed_to_type() const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_lvalue() const;
|
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
traverse(ir_node_visitor& v);
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
|
2013-03-29 14:30:34 +00:00
|
|
|
virtual ~reference_type_def();
|
2013-10-10 08:11:35 +00:00
|
|
|
}; // end class reference_type_def
|
2013-03-29 14:30:34 +00:00
|
|
|
|
2013-03-30 18:02:51 +00:00
|
|
|
/// Abstracts a declaration for an enum type.
|
2013-10-10 08:11:35 +00:00
|
|
|
class enum_type_decl : public virtual type_base, public virtual decl_base
|
2013-03-30 18:02:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-08-07 09:07:29 +00:00
|
|
|
|
|
|
|
/// A hasher for an enum_type_decl.
|
|
|
|
struct hash;
|
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
/// Enumerator Datum.
|
2013-03-30 18:02:51 +00:00
|
|
|
class enumerator
|
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
string name_;
|
|
|
|
size_t value_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-03-30 18:02:51 +00:00
|
|
|
//Forbidden
|
|
|
|
enumerator();
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
|
2013-03-30 18:02:51 +00:00
|
|
|
public:
|
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
enumerator(const string& name, size_t value)
|
2013-09-26 14:45:00 +00:00
|
|
|
: name_(name), value_(value) { }
|
2013-03-30 18:02:51 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
operator==(const enumerator& other) const
|
|
|
|
{
|
|
|
|
return (get_name() == other.get_name()
|
|
|
|
&& get_value() == other.get_value());
|
|
|
|
}
|
|
|
|
const string&
|
|
|
|
get_name() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return name_;}
|
2013-03-30 18:02:51 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
set_name(const string& n)
|
2013-09-26 14:45:00 +00:00
|
|
|
{name_ = n;}
|
2013-03-30 18:02:51 +00:00
|
|
|
|
|
|
|
size_t
|
|
|
|
get_value() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return value_;}
|
2013-03-30 18:02:51 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
set_value(size_t v)
|
2013-09-26 14:45:00 +00:00
|
|
|
{value_=v;}
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
typedef std::list<enumerator> enumerators;
|
|
|
|
typedef shared_ptr<type_base> type_sptr;
|
2013-08-06 17:18:35 +00:00
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
private:
|
2013-03-30 18:02:51 +00:00
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
type_sptr underlying_type_;
|
|
|
|
enumerators enumerators_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
|
|
|
// Forbidden
|
|
|
|
enum_type_decl();
|
|
|
|
|
|
|
|
public:
|
2013-03-30 18:02:51 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Constructor of an enum type declaration.
|
|
|
|
///
|
|
|
|
/// @param name the name of the enum
|
|
|
|
///
|
|
|
|
/// @param locus the locus at which the enum appears in the source
|
|
|
|
/// code.
|
|
|
|
///
|
|
|
|
/// @param underlying_type the underlying type of the enum
|
|
|
|
///
|
|
|
|
/// @param enumerators a list of enumerators for this enum.
|
2013-08-06 17:18:35 +00:00
|
|
|
enum_type_decl(const string& name, location locus, type_sptr underlying_type,
|
|
|
|
enumerators& enms, const std::string& mangled_name = "",
|
2013-08-02 23:30:56 +00:00
|
|
|
visibility vis = VISIBILITY_DEFAULT)
|
|
|
|
: type_base(underlying_type->get_size_in_bits(),
|
|
|
|
underlying_type->get_alignment_in_bits()),
|
|
|
|
decl_base(name, locus, mangled_name, vis),
|
2013-09-26 14:45:00 +00:00
|
|
|
underlying_type_(underlying_type),
|
|
|
|
enumerators_(enms)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-03-30 18:02:51 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
type_sptr
|
2013-03-30 18:02:51 +00:00
|
|
|
get_underlying_type() const;
|
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const enumerators&
|
2013-03-30 18:02:51 +00:00
|
|
|
get_enumerators() const;
|
|
|
|
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
2013-03-30 18:02:51 +00:00
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
traverse(ir_node_visitor& v);
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
|
2013-03-30 18:02:51 +00:00
|
|
|
virtual ~enum_type_decl();
|
2013-10-10 08:11:35 +00:00
|
|
|
}; // end class enum_type_decl
|
2013-03-30 18:02:51 +00:00
|
|
|
|
2013-03-30 20:51:43 +00:00
|
|
|
/// The abstraction of a typedef declaration.
|
2013-10-10 08:11:35 +00:00
|
|
|
class typedef_decl : public virtual type_base, public virtual decl_base
|
2013-03-30 20:51:43 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<type_base> underlying_type_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-03-30 20:51:43 +00:00
|
|
|
// Forbidden
|
|
|
|
typedef_decl();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher for the typedef_decl type.
|
|
|
|
struct hash;
|
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
typedef_decl(const string& name, const shared_ptr<type_base> underlying_type,
|
2013-09-26 14:45:00 +00:00
|
|
|
location locus, const std::string& mangled_name = "",
|
2013-08-02 23:30:56 +00:00
|
|
|
visibility vis = VISIBILITY_DEFAULT);
|
2013-03-30 20:51:43 +00:00
|
|
|
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
2013-03-30 20:51:43 +00:00
|
|
|
|
|
|
|
shared_ptr<type_base>
|
|
|
|
get_underlying_type() const;
|
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
|
|
|
traverse(ir_node_visitor&);
|
|
|
|
|
2013-03-30 20:51:43 +00:00
|
|
|
virtual ~typedef_decl();
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
2013-03-30 20:51:43 +00:00
|
|
|
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
/// Abstracts a variable declaration.
|
2013-08-06 22:28:56 +00:00
|
|
|
class var_decl : public virtual decl_base
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<type_base> type_;
|
|
|
|
binding binding_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
// Forbidden
|
|
|
|
var_decl();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher for a var_decl type.
|
|
|
|
struct hash;
|
|
|
|
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
var_decl(const std::string& name,
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
shared_ptr<type_base> type,
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
location locus,
|
|
|
|
const std::string& mangled_name,
|
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_NONE);
|
|
|
|
|
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
|
|
|
|
shared_ptr<type_base>
|
|
|
|
get_type() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return type_;}
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
|
|
|
|
binding
|
|
|
|
get_binding() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return binding_;}
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
set_binding(binding b)
|
2013-09-26 14:45:00 +00:00
|
|
|
{binding_ = b;}
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
traverse(ir_node_visitor& v);
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
virtual ~var_decl();
|
2013-10-10 08:11:35 +00:00
|
|
|
}; // end class var_decl
|
Support var decl & mangled_name attributes
* src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name)
(decl_base::set_mangled_name, decl_base::m_mangled_name): New
declarations.
(scope_decl::scope_decl: type_decl::type_decl)
(scope_type_decl::scope_type_decl, typedef_decl::typedef_decl):
Initialize mangled_name.
(namespace_decl::namespace_decl): Initialize visibility.
(class var_decl): New declaration.
* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
(type_decl::type_decl, scope_type_decl::scope_type_decl):
Initialize mangled name.
(namespace_decl::namespace_decl): Initialize visibility.
(qualified_type_def::qualified_type_def)
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def): By default, set the
visibility to the same as for the underlying type.
(enum_type_decl::enum_type_decl, typedef_decl::typedef_decl):
Initialize mangled name.
(var_decl::var_decl, var_decl::operator==, var_decl::~var_decl):
New definitions.
* src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New
definitions.
(read_file): Handle var-decl elements.
* src/abg-writer.cc (write_location): Rename write_decl_location
into this.
(write_var_decl, write_visibility, write_binding): New definitions.
(write_decl, write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_enum_type_decl, write_typedef_decl): Adjust to use
write_location.
* tests/data/test-read-write/test8.xml: New test input.
* tests/test-read-write.cc: De-serialize the above and serialize
it back and ensure both are equal.
* tests/Makefile.am: add tests/data/test-read-write/test8.xml to
the distribution.
2013-04-02 12:24:08 +00:00
|
|
|
|
2013-04-03 22:16:29 +00:00
|
|
|
/// Abstraction for a function declaration.
|
2013-08-06 22:28:56 +00:00
|
|
|
class function_decl : public virtual decl_base
|
2013-04-03 22:16:29 +00:00
|
|
|
{
|
2013-08-02 03:16:22 +00:00
|
|
|
protected:
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<function_type> type_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
|
|
|
private:
|
2013-09-26 14:45:00 +00:00
|
|
|
bool declared_inline_;
|
|
|
|
decl_base::binding binding_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-04-03 22:16:29 +00:00
|
|
|
public:
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher for function_decl
|
|
|
|
struct hash;
|
2013-04-03 22:16:29 +00:00
|
|
|
|
|
|
|
/// Abtraction for the parameter of a function.
|
|
|
|
class parameter
|
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<type_base> type_;
|
|
|
|
std::string name_;
|
|
|
|
location location_;
|
|
|
|
bool variadic_marker_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-04-03 22:16:29 +00:00
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher for an instance of function::parameter
|
|
|
|
struct hash;
|
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
parameter(const shared_ptr<type_base> type, const std::string& name,
|
|
|
|
location loc, bool variadic_marker = false)
|
2013-09-26 14:45:00 +00:00
|
|
|
: type_(type), name_(name), location_(loc),
|
|
|
|
variadic_marker_ (variadic_marker)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-04-03 22:16:29 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
parameter(const shared_ptr<type_base> type, bool variadic_marker = false)
|
2013-09-26 14:45:00 +00:00
|
|
|
: type_(type),
|
|
|
|
variadic_marker_ (variadic_marker)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
|
2013-04-03 22:16:29 +00:00
|
|
|
const shared_ptr<type_base>
|
|
|
|
get_type()const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return type_;}
|
2013-04-03 22:16:29 +00:00
|
|
|
|
2013-06-01 13:41:59 +00:00
|
|
|
const shared_ptr<type_base>
|
|
|
|
get_type()
|
2013-09-26 14:45:00 +00:00
|
|
|
{return type_;}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
2013-04-03 22:16:29 +00:00
|
|
|
const std::string&
|
|
|
|
get_name() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return name_;}
|
2013-04-03 22:16:29 +00:00
|
|
|
|
|
|
|
location
|
|
|
|
get_location() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return location_;}
|
2013-04-03 22:16:29 +00:00
|
|
|
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
bool
|
|
|
|
operator==(const parameter& o) const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return *get_type() == *o.get_type();}
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
|
2013-06-01 13:41:59 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
get_variadic_marker() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return variadic_marker_;}
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
2013-04-03 22:16:29 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
function_decl(const std::string& name,
|
|
|
|
const std::vector<shared_ptr<parameter> >& parms,
|
|
|
|
shared_ptr<type_base> return_type,
|
|
|
|
size_t fptr_size_in_bits,
|
|
|
|
size_t fptr_align_in_bits,
|
|
|
|
bool declared_inline,
|
|
|
|
location locus,
|
|
|
|
const std::string& mangled_name = "",
|
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_GLOBAL);
|
|
|
|
|
|
|
|
function_decl(const std::string& name,
|
|
|
|
shared_ptr<function_type> function_type, bool declared_inline,
|
|
|
|
location locus, const std::string& mangled_name = "",
|
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_GLOBAL)
|
|
|
|
: decl_base(name, locus, mangled_name, vis),
|
2013-09-26 14:45:00 +00:00
|
|
|
type_(function_type),
|
|
|
|
declared_inline_(declared_inline),
|
|
|
|
binding_(bind)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-04-03 22:16:29 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
function_decl(const std::string& name,
|
|
|
|
shared_ptr<type_base> fn_type,
|
|
|
|
bool declared_inline,
|
|
|
|
location locus,
|
|
|
|
const std::string& mangled_name = "",
|
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_GLOBAL);
|
|
|
|
|
2013-06-01 13:41:59 +00:00
|
|
|
const std::vector<shared_ptr<parameter> >&
|
|
|
|
get_parameters() const;
|
2013-04-03 22:16:29 +00:00
|
|
|
|
|
|
|
void
|
2013-06-01 13:41:59 +00:00
|
|
|
append_parameter(shared_ptr<parameter> parm);
|
2013-04-03 22:16:29 +00:00
|
|
|
|
|
|
|
void
|
2013-06-01 13:41:59 +00:00
|
|
|
append_parameters(std::vector<shared_ptr<parameter> >& parms);
|
|
|
|
|
|
|
|
const shared_ptr<function_type>
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
get_type() const;
|
2013-04-03 22:16:29 +00:00
|
|
|
|
|
|
|
const shared_ptr<type_base>
|
2013-06-01 13:41:59 +00:00
|
|
|
get_return_type() const;
|
2013-04-03 22:16:29 +00:00
|
|
|
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
void
|
2013-06-01 13:41:59 +00:00
|
|
|
set_type(shared_ptr<function_type> fn_type)
|
2013-09-26 14:45:00 +00:00
|
|
|
{type_ = fn_type; }
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
|
2013-04-03 22:16:29 +00:00
|
|
|
bool
|
|
|
|
is_declared_inline() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return declared_inline_;}
|
2013-04-03 22:16:29 +00:00
|
|
|
|
|
|
|
binding
|
|
|
|
get_binding() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return binding_;}
|
2013-04-03 22:16:29 +00:00
|
|
|
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base& o) const;
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
|
2013-06-01 13:41:59 +00:00
|
|
|
/// Return true iff the function takes a variable number of
|
|
|
|
/// parameters.
|
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @return true if the function taks a variable number
|
2013-06-01 13:41:59 +00:00
|
|
|
/// of parameters.
|
|
|
|
bool
|
|
|
|
is_variadic() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{
|
|
|
|
return (!get_parameters().empty()
|
|
|
|
&& get_parameters().back()->get_variadic_marker());
|
|
|
|
}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
|
|
|
traverse(ir_node_visitor&);
|
|
|
|
|
2013-04-03 22:16:29 +00:00
|
|
|
virtual ~function_decl();
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
2013-04-03 22:16:29 +00:00
|
|
|
|
2013-06-01 13:41:59 +00:00
|
|
|
/// Abstraction of a function type.
|
|
|
|
class function_type : public virtual type_base
|
|
|
|
{
|
2013-08-06 17:18:35 +00:00
|
|
|
public:
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher for an instance of function_type
|
|
|
|
struct hash;
|
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
typedef shared_ptr<function_decl::parameter> parameter_sptr;
|
|
|
|
typedef std::vector<parameter_sptr> parameters;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
|
|
|
private:
|
2013-08-06 17:18:35 +00:00
|
|
|
function_type();
|
2013-06-01 13:41:59 +00:00
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<type_base> return_type_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
|
|
|
protected:
|
2013-09-26 14:45:00 +00:00
|
|
|
parameters parms_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-06-01 13:41:59 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
/// The most straightforward constructor for the the function_type
|
|
|
|
/// class.
|
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param return_type the return type of the function type.
|
2013-06-01 13:41:59 +00:00
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param parms the list of parameters of the function type.
|
2013-06-01 13:41:59 +00:00
|
|
|
/// Stricto sensu, we just need a list of types; we are using a list
|
|
|
|
/// of parameters (where each parameter also carries the name of the
|
|
|
|
/// parameter and its source location) to try and provide better
|
|
|
|
/// diagnostics whenever it makes sense. If it appears that this
|
|
|
|
/// wasts too many resources, we can fall back to taking just a
|
|
|
|
/// vector of types here.
|
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param size_in_bits the size of this type, in bits.
|
2013-06-01 13:41:59 +00:00
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param alignment_in_bits the alignment of this type, in bits.
|
2013-06-01 13:41:59 +00:00
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param size_in_bits the size of this type.
|
2013-08-06 17:18:35 +00:00
|
|
|
function_type(shared_ptr<type_base> return_type, const parameters& parms,
|
|
|
|
size_t size_in_bits, size_t alignment_in_bits)
|
2013-09-26 14:45:00 +00:00
|
|
|
: type_base(size_in_bits, alignment_in_bits), return_type_(return_type),
|
|
|
|
parms_(parms)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
|
|
|
/// A constructor for a function_type that takes no parameters.
|
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param return_type the return type of this function_type.
|
2013-06-01 13:41:59 +00:00
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param size_in_bits the size of this type, in bits.
|
2013-06-01 13:41:59 +00:00
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param alignment_in_bits the alignment of this type, in bits.
|
2013-06-01 13:41:59 +00:00
|
|
|
function_type(shared_ptr<type_base> return_type,
|
2013-08-06 17:18:35 +00:00
|
|
|
size_t size_in_bits, size_t alignment_in_bits)
|
2013-09-26 14:45:00 +00:00
|
|
|
: type_base(size_in_bits, alignment_in_bits),
|
|
|
|
return_type_(return_type)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
|
|
|
/// A constructor for a function_type that takes no parameter and
|
|
|
|
/// that has no return_type yet. These missing parts can (and must)
|
|
|
|
/// be added later.
|
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param size_in_bits the size of this type, in bits.
|
2013-06-01 13:41:59 +00:00
|
|
|
///
|
2013-08-02 03:16:22 +00:00
|
|
|
/// @param alignment_in_bits the alignment of this type, in bits.
|
2013-08-06 17:18:35 +00:00
|
|
|
function_type(size_t size_in_bits, size_t alignment_in_bits)
|
|
|
|
: type_base(size_in_bits, alignment_in_bits)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
|
|
|
const shared_ptr<type_base>
|
|
|
|
get_return_type() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return return_type_;}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
set_return_type(shared_ptr<type_base> t)
|
2013-09-26 14:45:00 +00:00
|
|
|
{return_type_ = t;}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const parameters&
|
2013-06-01 13:41:59 +00:00
|
|
|
get_parameters() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return parms_;}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
2013-10-10 08:11:35 +00:00
|
|
|
parameters&
|
2013-06-01 13:41:59 +00:00
|
|
|
get_parameters()
|
2013-09-26 14:45:00 +00:00
|
|
|
{return parms_;}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
|
|
|
void
|
2013-08-06 17:18:35 +00:00
|
|
|
set_parameters(const parameters &p)
|
2013-09-26 14:45:00 +00:00
|
|
|
{parms_ = p;}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
|
|
|
void
|
2013-08-06 17:18:35 +00:00
|
|
|
append_parameter(parameter_sptr parm)
|
2013-09-26 14:45:00 +00:00
|
|
|
{parms_.push_back(parm);}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
is_variadic() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return !parms_.empty() && parms_.back()->get_variadic_marker();}
|
2013-06-01 13:41:59 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
2013-06-01 13:41:59 +00:00
|
|
|
|
|
|
|
virtual ~function_type();
|
2013-10-10 08:11:35 +00:00
|
|
|
};//end class function_type
|
2013-06-01 13:41:59 +00:00
|
|
|
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
/// Abstracts the type of a class member function.
|
|
|
|
class method_type : public function_type
|
|
|
|
{
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<class_decl> class_type_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
method_type();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher for intances of method_type
|
|
|
|
struct hash;
|
|
|
|
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
method_type(shared_ptr<type_base> return_type,
|
|
|
|
shared_ptr<class_decl> class_type,
|
|
|
|
const std::vector<shared_ptr<function_decl::parameter> >& parms,
|
|
|
|
size_t size_in_bits,
|
|
|
|
size_t alignment_in_bits);
|
|
|
|
|
|
|
|
method_type(shared_ptr<type_base> return_type,
|
|
|
|
shared_ptr<type_base> class_type,
|
|
|
|
const std::vector<shared_ptr<function_decl::parameter> >& parms,
|
|
|
|
size_t size_in_bits,
|
|
|
|
size_t alignment_in_bits);
|
|
|
|
|
|
|
|
method_type(shared_ptr<class_decl> class_type,
|
|
|
|
size_t size_in_bits,
|
|
|
|
size_t alignment_in_bits);
|
|
|
|
|
|
|
|
method_type(size_t size_in_bits,
|
|
|
|
size_t alignment_in_bits);
|
|
|
|
|
|
|
|
shared_ptr<class_decl>
|
|
|
|
get_class_type() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return class_type_;}
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
|
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
set_class_type(shared_ptr<class_decl> t);
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
|
|
|
|
virtual ~method_type();
|
2013-10-10 08:11:35 +00:00
|
|
|
};// end class method_type.
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
/// The base class of templates.
|
|
|
|
class template_decl
|
|
|
|
{
|
2013-08-06 17:18:35 +00:00
|
|
|
// XXX
|
2013-09-26 14:45:00 +00:00
|
|
|
std::list<shared_ptr<template_parameter> > parms_;
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
template_decl()
|
2013-09-26 14:45:00 +00:00
|
|
|
{}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
add_template_parameter(shared_ptr<template_parameter> p)
|
2013-09-26 14:45:00 +00:00
|
|
|
{parms_.push_back(p);}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
const std::list<shared_ptr<template_parameter> >&
|
|
|
|
get_template_parameters() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return parms_;}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const template_decl& o) const;
|
|
|
|
|
|
|
|
virtual ~template_decl();
|
2013-10-10 08:11:35 +00:00
|
|
|
};//end class template_decl
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
/// Base class for a template parameter. Client code should use the
|
|
|
|
/// more specialized type_template_parameter,
|
|
|
|
/// non_type_template_parameter and template_template_parameter below.
|
|
|
|
class template_parameter
|
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
unsigned index_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
// Forbidden
|
|
|
|
template_parameter();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hashers.
|
|
|
|
struct hash;
|
|
|
|
struct dynamic_hash;
|
|
|
|
struct shared_ptr_hash;
|
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
template_parameter(unsigned index) : index_(index)
|
|
|
|
{}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const template_parameter&) const;
|
|
|
|
|
|
|
|
unsigned
|
|
|
|
get_index() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return index_;}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
virtual ~template_parameter();
|
2013-10-10 08:11:35 +00:00
|
|
|
};//end class template_parameter
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
/// Abstracts a type template parameter.
|
2013-10-10 08:11:35 +00:00
|
|
|
class type_tparameter : public template_parameter, public virtual type_decl
|
2013-04-30 14:43:20 +00:00
|
|
|
{
|
|
|
|
// Forbidden
|
2013-08-08 06:54:44 +00:00
|
|
|
type_tparameter();
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
public:
|
2013-08-07 09:07:29 +00:00
|
|
|
|
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
type_tparameter(unsigned index,
|
|
|
|
const std::string& name,
|
|
|
|
location locus)
|
2013-04-30 14:43:20 +00:00
|
|
|
: decl_base(name, locus),
|
|
|
|
type_base(0, 0),
|
|
|
|
type_decl(name, 0, 0, locus),
|
|
|
|
template_parameter(index)
|
2013-09-26 14:45:00 +00:00
|
|
|
{}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const template_parameter&) const;
|
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
virtual bool
|
2013-08-08 06:54:44 +00:00
|
|
|
operator==(const type_tparameter&) const;
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
virtual ~type_tparameter();
|
2013-10-10 08:11:35 +00:00
|
|
|
};// end class type_tparameter.
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
/// Abstracts non type template parameters.
|
2013-10-10 08:11:35 +00:00
|
|
|
class non_type_tparameter : public template_parameter, public virtual decl_base
|
2013-04-30 14:43:20 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<type_base> type_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
// Forbidden
|
2013-08-08 06:54:44 +00:00
|
|
|
non_type_tparameter();
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
public:
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
non_type_tparameter(unsigned index, const std::string& name,
|
2013-08-02 23:30:56 +00:00
|
|
|
shared_ptr<type_base> type, location locus)
|
2013-04-30 14:43:20 +00:00
|
|
|
: decl_base(name, locus, ""),
|
|
|
|
template_parameter(index),
|
2013-09-26 14:45:00 +00:00
|
|
|
type_(type)
|
|
|
|
{}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const template_parameter&) const;
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
shared_ptr<type_base>
|
|
|
|
get_type() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return type_;}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
virtual ~non_type_tparameter();
|
2013-10-10 08:11:35 +00:00
|
|
|
};// end class non_type_tparameter
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
/// Abstracts a template template parameter.
|
2013-10-10 08:11:35 +00:00
|
|
|
class template_tparameter : public type_tparameter, public template_decl
|
2013-04-30 14:43:20 +00:00
|
|
|
{
|
|
|
|
// Forbidden
|
2013-08-08 06:54:44 +00:00
|
|
|
template_tparameter();
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
/// A hasher for instances of template_tparameter
|
2013-08-07 09:07:29 +00:00
|
|
|
struct hash;
|
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
template_tparameter(unsigned index,
|
2013-04-30 14:43:20 +00:00
|
|
|
const std::string& name,
|
|
|
|
location locus)
|
|
|
|
: decl_base(name, locus),
|
|
|
|
type_base(0, 0),
|
|
|
|
type_decl(name, 0, 0, locus, name, VISIBILITY_DEFAULT),
|
2013-08-08 06:54:44 +00:00
|
|
|
type_tparameter(index, name, locus)
|
2013-09-26 14:45:00 +00:00
|
|
|
{}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const type_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const template_parameter&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const template_decl&) const;
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
virtual ~template_tparameter();
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
/// This abstracts a composition of types based on template type
|
|
|
|
/// parameters. The result of the composition is a type that can be
|
|
|
|
/// referred to by a template non-type parameter. Instances of this
|
|
|
|
/// type can appear at the same level as template parameters, in the
|
|
|
|
/// scope of a template_decl.
|
2013-10-10 08:11:35 +00:00
|
|
|
class type_composition : public template_parameter, public virtual decl_base
|
2013-04-30 14:43:20 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<type_base> type_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
type_composition();
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
public:
|
2013-08-08 06:54:44 +00:00
|
|
|
type_composition(unsigned index,
|
2013-10-10 08:11:35 +00:00
|
|
|
shared_ptr<type_base> composed_type);
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
shared_ptr<type_base>
|
|
|
|
get_composed_type() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return type_;}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
set_composed_type(shared_ptr<type_base> t)
|
2013-09-26 14:45:00 +00:00
|
|
|
{type_ = t;}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
virtual ~type_composition();
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
typedef shared_ptr<function_tdecl> function_tdecl_sptr;
|
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
/// Abstract a function template declaration.
|
2013-10-10 08:11:35 +00:00
|
|
|
class function_tdecl : public template_decl, public scope_decl
|
2013-04-30 14:43:20 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<function_decl> pattern_;
|
|
|
|
binding binding_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
// Forbidden
|
2013-08-08 06:54:44 +00:00
|
|
|
function_tdecl();
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hash functor for function templates.
|
|
|
|
struct hash;
|
|
|
|
struct shared_ptr_hash;
|
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
function_tdecl(location locus,
|
2013-08-02 23:30:56 +00:00
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_NONE)
|
2013-08-07 09:07:29 +00:00
|
|
|
: decl_base("", locus, "", vis), scope_decl("", locus),
|
2013-09-26 14:45:00 +00:00
|
|
|
binding_(bind)
|
|
|
|
{}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
function_tdecl(shared_ptr<function_decl> pattern,
|
2013-04-30 14:43:20 +00:00
|
|
|
location locus,
|
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_NONE)
|
2013-08-07 09:07:29 +00:00
|
|
|
: decl_base(pattern->get_name(), locus,
|
|
|
|
pattern->get_name(), vis),
|
|
|
|
scope_decl(pattern->get_name(), locus),
|
2013-09-26 14:45:00 +00:00
|
|
|
binding_(bind)
|
|
|
|
{set_pattern(pattern);}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const template_decl&) const;
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
set_pattern(shared_ptr<function_decl> p)
|
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
pattern_ = p;
|
2013-04-30 14:43:20 +00:00
|
|
|
add_decl_to_scope(p, this);
|
|
|
|
set_name(p->get_name());
|
|
|
|
}
|
|
|
|
|
|
|
|
shared_ptr<function_decl>
|
|
|
|
get_pattern() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return pattern_;}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
|
|
|
binding
|
|
|
|
get_binding() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return binding_;}
|
2013-04-30 14:43:20 +00:00
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
traverse(ir_node_visitor& v);
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
virtual ~function_tdecl();
|
2013-10-10 08:11:35 +00:00
|
|
|
}; // end class function_tdecl.
|
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
typedef shared_ptr<class_tdecl> class_tdecl_sptr;
|
2013-04-30 14:43:20 +00:00
|
|
|
|
2013-05-02 13:25:04 +00:00
|
|
|
/// Abstract a class template.
|
2013-08-08 06:54:44 +00:00
|
|
|
class class_tdecl : public template_decl, public scope_decl
|
2013-05-02 13:25:04 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<class_decl> pattern_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-05-02 13:25:04 +00:00
|
|
|
// Forbidden
|
2013-08-08 06:54:44 +00:00
|
|
|
class_tdecl();
|
2013-05-02 13:25:04 +00:00
|
|
|
|
|
|
|
public:
|
2013-08-27 11:55:45 +00:00
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hashers.
|
|
|
|
struct hash;
|
|
|
|
struct shared_ptr_hash;
|
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
class_tdecl(location locus, visibility vis = VISIBILITY_DEFAULT)
|
2013-08-06 17:18:35 +00:00
|
|
|
: decl_base("", locus, "", vis), scope_decl("", locus)
|
2013-09-26 14:45:00 +00:00
|
|
|
{}
|
2013-05-02 13:25:04 +00:00
|
|
|
|
2013-10-10 08:11:35 +00:00
|
|
|
class_tdecl(shared_ptr<class_decl> pattern,
|
|
|
|
location locus, visibility vis = VISIBILITY_DEFAULT);
|
2013-05-02 13:25:04 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const template_decl&) const;
|
2013-05-02 13:25:04 +00:00
|
|
|
|
|
|
|
virtual bool
|
2013-08-08 06:54:44 +00:00
|
|
|
operator==(const class_tdecl&) const;
|
2013-05-02 13:25:04 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
set_pattern(shared_ptr<class_decl> p);
|
|
|
|
|
|
|
|
shared_ptr<class_decl>
|
|
|
|
get_pattern() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return pattern_;}
|
2013-05-02 13:25:04 +00:00
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
traverse(ir_node_visitor& v);
|
2013-05-02 13:25:04 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
virtual ~class_tdecl();
|
2013-10-10 08:11:35 +00:00
|
|
|
};// end class class_tdecl
|
2013-05-02 13:25:04 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
/// Abstracts a class declaration.
|
|
|
|
class class_decl : public scope_type_decl
|
|
|
|
{
|
|
|
|
// Forbidden
|
|
|
|
class_decl();
|
|
|
|
|
|
|
|
public:
|
2013-08-07 09:07:29 +00:00
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
/// Language access specifier.
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
enum access_specifier
|
|
|
|
{
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
no_access,
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
private_access,
|
|
|
|
protected_access,
|
2013-05-10 12:31:24 +00:00
|
|
|
public_access
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
Initial Support for class declarations
* src/abg-ir.h (scope_decl::scope_decl)
(scope_type_decl::scope_type_decl): Don't set mangled name for
scope_decl instances as it doesn't make sense.
(var_decl::var_decl): Pass the type shared pointer by value.
(struct var_decl_hash, function_decl::parameter::operator==)
(struct function_decl::parameter_hash, function_decl::operator==)
(struct function_decl_hash, class class_decl, struct
class_decl_hash): New declarations.
* src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the
mangled name. It doesn't make sense for scope_decls.
(dynamic_type_hash::operator): Fix comment. Run the hashing for
scope_type_decl instances *after* running it for class_decl
instance, otherwise, the class_decl instances case will never get
hit.
(var_decl::var_decl): Pass the type shared pointer by value.
(function_decl::operator==, class_decl::operator==)
(class_decl_hash::operator()): New fns.
* src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn.
(XML_READER_GET_ATTRIBUTE): Fix comment.
(XML_NODE_GET_ATTRIBUTE): New getter macro.
* src/abg-libxml-utils.cc (get_xml_node_depth): New definition.
* src/abg-reader.cc (update_read_context)
(update_depth_info_of_read_context, read_visibility, read_binding)
(read_access, read_size_and_alignment, read_static)
(read_var_offset_in_bits, read_cdtor_const, build_function_decl)
( build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, build_class_decl)
(build_type, handle_class_decl): New functions or overloads.
(handle_element): Update to handle "class-decl" xml elements.
* src/abg-writer.cc (write_size_and_alignment, write_access)
(write_class, do_indent_to_level, get_indent_to_level): New fns.
(write_decl): Update to serialize instances of class_decl.
(write_type_decl, write_pointer_type_def)
(write_reference_type_def): Use the new write_size_and_alignment instead of
writing the attributes directly.
* tests/data/test-read-write/test10.xml: New test file.
* tests/Makefile.am: Add tests/data/test-read-write/test10.xml to
the build system.
* tests/test-read-write.cc (in_out_spec): De-serialize
data/test-read-write/test10.xml, serialize it back into
output/test-read-write/test10.xml, and compare the two output that
should be identical.
2013-04-11 20:02:08 +00:00
|
|
|
|
2013-08-08 02:50:07 +00:00
|
|
|
/// Forward declarations.
|
|
|
|
class member_base;
|
|
|
|
class member_type;
|
|
|
|
class base_spec;
|
|
|
|
class data_member;
|
|
|
|
class method_decl;
|
|
|
|
class member_function;
|
|
|
|
class member_function_template;
|
|
|
|
class member_class_template;
|
|
|
|
|
|
|
|
/// Typedefs.
|
2013-09-26 14:45:00 +00:00
|
|
|
typedef shared_ptr<base_spec> base_spec_sptr;
|
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
|
|
|
typedef std::vector<base_spec_sptr> base_specs;
|
2013-09-26 14:45:00 +00:00
|
|
|
typedef shared_ptr<member_type> member_type_sptr;
|
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
|
|
|
typedef std::vector<member_type_sptr> member_types;
|
2013-09-26 14:45:00 +00:00
|
|
|
typedef shared_ptr<data_member> data_member_sptr;
|
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
|
|
|
typedef std::vector<data_member_sptr> data_members;
|
2013-09-26 14:45:00 +00:00
|
|
|
typedef shared_ptr<member_function> member_function_sptr;
|
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
|
|
|
typedef std::vector<member_function_sptr> member_functions;
|
2013-09-26 14:45:00 +00:00
|
|
|
typedef shared_ptr<member_function_template> member_function_template_sptr;
|
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
|
|
|
typedef std::vector<member_function_template_sptr> member_function_templates;
|
2013-09-26 14:45:00 +00:00
|
|
|
typedef shared_ptr<member_class_template> member_class_template_sptr;
|
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
|
|
|
typedef std::vector<member_class_template_sptr> member_class_templates;
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
private:
|
2013-09-26 14:45:00 +00:00
|
|
|
mutable bool hashing_started_;
|
|
|
|
shared_ptr<class_decl> declaration_;
|
|
|
|
bool is_declaration_only_;
|
|
|
|
base_specs bases_;
|
|
|
|
member_types member_types_;
|
|
|
|
data_members data_members_;
|
|
|
|
member_functions member_functions_;
|
|
|
|
member_function_templates member_function_templates_;
|
|
|
|
member_class_templates member_class_templates_;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
class_decl(const std::string& name, size_t size_in_bits,
|
|
|
|
size_t align_in_bits, location locus, visibility vis,
|
2013-08-06 17:18:35 +00:00
|
|
|
base_specs& bases, member_types& mbrs,
|
|
|
|
data_members& data_mbrs, member_functions& member_fns);
|
2013-08-27 11:55:45 +00:00
|
|
|
|
|
|
|
class_decl(const std::string& name, size_t size_in_bits,
|
2013-08-02 23:30:56 +00:00
|
|
|
size_t align_in_bits, location locus, visibility vis);
|
|
|
|
|
|
|
|
class_decl(const std::string& name, bool is_declaration_only = true);
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
hashing_started() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return hashing_started_;}
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
hashing_started(bool b) const
|
2013-09-26 14:45:00 +00:00
|
|
|
{hashing_started_ = b;}
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
is_declaration_only() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return is_declaration_only_;}
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
|
|
|
|
void
|
2013-06-21 15:08:49 +00:00
|
|
|
set_earlier_declaration(shared_ptr<class_decl> declaration);
|
|
|
|
|
|
|
|
void
|
|
|
|
set_earlier_declaration(shared_ptr<type_base> declaration);
|
Support method type/decl, variadic functions, class declarations-only
* src/abg-ir.h (function_decl::parameter::parameter): New
constructor with variadic parameter marker.
(function_decl::m_type): Make this protected to let method_decl
inheriting class to access it.
(function_decl::get_type): Move this out-of-line.
(class method_type, method_type_hash): New types.
(enum class_decl::access_specifier): Add no_access new enumerator.
(class_decl::data_member::data_member): Move this out-of-line.
(class_decl::data_member::~data_member): Declare virtual
destructor.
(class method_decl): New class.
(class member_function): Make this inherit method_decl, instead of
function_decl.
(class_decl::class_decl): New constructors.
(class_decl::{hashing_started, is_declaration_only,
set_earlier_declaration, get_earlier_declaration}): New methods.
* src/abg-ir.cc (add_decl_to_scope): If a decl is already in a
scope, don't add it to this scope.
(get_global_scope): Make this work when passed an instance of
global_scope.
(dynamic_type_hash::operator()): Add support for method_type.
(method_type::{method_type, set_class_type, ~method_type, })
(method_type_hash::operator()): New defintions.
(function_decl::get_type, class_decl::class_decl): Move these
out-of-line here.
(class_decl::method_decl::{method_decl, ~method_decl, get_type}):
New definitions.
(class_decl::member_function::member_function): Move this
out-of-line here. Support method_decl.
(class_decl::data_member::data_member): Likewise.
(class_decl_hash::operator()): Guard this against endless loop.
* src/abg-reader.cc (write_class_is_declaration_only): New static
function.
(write_var_decl): Take a flag to write the mangled name or not.
(write_function_decl): Take a flag to skip the first parameter.
(write_cdtor_const_static): Use 'yes' instead of 'true' as value
of the properties.
(write_decl, write_function_template_decl): Adjust wrt the new
signatures of write_var_decl and write_function_decl.
(write_enum_type_decl): Simplify call to write_location.
(write_class_decl): Support serializing declaration-only classes.
* src/abg-writer.cc:
* tests/data/test-read-write/test17.xml: New test input.
* tests/test-read-write.cc: De-serialize the above, and serialize it back.
* tests/data/test-read-write/test10.xml: Update this test.
2013-06-14 08:35:09 +00:00
|
|
|
|
|
|
|
shared_ptr<class_decl>
|
|
|
|
get_earlier_declaration() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return declaration_;}
|
2013-04-25 13:42:04 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
void
|
|
|
|
add_base_specifier(shared_ptr<base_spec> b)
|
2013-09-26 14:45:00 +00:00
|
|
|
{bases_.push_back(b);}
|
2013-04-25 13:42:04 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const base_specs&
|
2013-04-30 14:43:20 +00:00
|
|
|
get_base_specifiers() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return bases_;}
|
2013-04-25 13:42:04 +00:00
|
|
|
|
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
add_member_type(shared_ptr<member_type> t);
|
2013-04-25 13:42:04 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const member_types&
|
2013-04-30 14:43:20 +00:00
|
|
|
get_member_types() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return member_types_;}
|
2013-04-25 13:42:04 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
void
|
|
|
|
add_data_member(shared_ptr<data_member> m);
|
2013-04-25 13:42:04 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const data_members&
|
2013-04-30 14:43:20 +00:00
|
|
|
get_data_members() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return data_members_;}
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
void
|
|
|
|
add_member_function(shared_ptr<member_function> m);
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const member_functions&
|
2013-04-30 14:43:20 +00:00
|
|
|
get_member_functions() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return member_functions_;}
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
|
|
|
|
void
|
2013-05-02 15:12:55 +00:00
|
|
|
add_member_function_template(shared_ptr<member_function_template>);
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const member_function_templates&
|
2013-04-30 14:43:20 +00:00
|
|
|
get_member_function_templates() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return member_function_templates_;}
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
|
2013-05-02 15:12:55 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
add_member_class_template(shared_ptr<member_class_template> m);
|
2013-05-02 15:12:55 +00:00
|
|
|
|
2013-08-06 17:18:35 +00:00
|
|
|
const member_class_templates&
|
2013-05-02 15:12:55 +00:00
|
|
|
get_member_class_templates() const
|
2013-06-25 13:16:51 +00:00
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
{return member_class_templates_;}
|
2013-05-02 15:12:55 +00:00
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
|
|
|
has_no_base_nor_member() const;
|
2013-06-25 13:16:51 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
virtual bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const type_base&) const;
|
|
|
|
|
|
|
|
bool
|
2013-04-30 14:43:20 +00:00
|
|
|
operator==(const class_decl&) const;
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
void
|
2013-08-02 23:30:56 +00:00
|
|
|
traverse(ir_node_visitor& v);
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
|
2013-04-30 14:43:20 +00:00
|
|
|
virtual ~class_decl();
|
2013-10-04 15:03:34 +00:00
|
|
|
};// end class class_decl
|
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
typedef shared_ptr<class_decl> class_decl_sptr;
|
2013-08-07 09:07:29 +00:00
|
|
|
|
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
|
|
|
bool
|
|
|
|
operator==(class_decl_sptr l, class_decl_sptr r);
|
|
|
|
|
2013-08-08 02:50:07 +00:00
|
|
|
/// The base class for member types, data members and member
|
2013-10-04 15:03:34 +00:00
|
|
|
/// functions. Its purpose is mainly to carry the access specifier
|
|
|
|
/// (and possibly other properties that might be shared by all class
|
|
|
|
/// members) for the member.
|
2013-08-08 02:50:07 +00:00
|
|
|
class class_decl::member_base
|
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
enum access_specifier access_;
|
|
|
|
bool is_static_;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
// Forbidden
|
|
|
|
member_base();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
|
|
|
|
|
|
|
member_base(access_specifier a, bool is_static = false)
|
2013-09-26 14:45:00 +00:00
|
|
|
: access_(a), is_static_(is_static)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
access_specifier
|
|
|
|
get_access_specifier() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return access_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
is_static() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return is_static_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const member_base& o) const;
|
2013-10-04 15:03:34 +00:00
|
|
|
};// end class class_decl::member_base
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
/// Abstracts a member type declaration.
|
|
|
|
class class_decl::member_type : public member_base, public virtual decl_base
|
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<type_base> type_;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
//Forbidden
|
|
|
|
member_type();
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Hasher.
|
|
|
|
struct hash;
|
|
|
|
|
2013-10-15 08:03:48 +00:00
|
|
|
member_type(shared_ptr<type_base> t, access_specifier access);
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const member_base&) const;
|
|
|
|
|
2013-08-08 02:50:07 +00:00
|
|
|
bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const member_type&) const;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
operator shared_ptr<type_base>() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return type_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
shared_ptr<type_base>
|
|
|
|
as_type() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return type_;}
|
2013-10-04 15:03:34 +00:00
|
|
|
};// end class member_type
|
2013-08-08 02:50:07 +00:00
|
|
|
|
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
|
|
|
bool
|
|
|
|
operator==(class_decl::member_type_sptr l, class_decl::member_type_sptr r);
|
|
|
|
|
2013-08-08 02:50:07 +00:00
|
|
|
/// Abstraction of a base specifier in a class declaration.
|
|
|
|
class class_decl::base_spec : public member_base
|
|
|
|
{
|
|
|
|
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<class_decl> base_class_;
|
|
|
|
long offset_in_bits_;
|
|
|
|
bool is_virtual_;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
// Forbidden
|
|
|
|
base_spec();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
|
|
|
|
|
|
|
base_spec(shared_ptr<class_decl> base, access_specifier a,
|
|
|
|
long offset_in_bits = -1, bool is_virtual = false);
|
|
|
|
|
|
|
|
base_spec(shared_ptr<type_base> base, access_specifier a,
|
|
|
|
long offset_in_bits = -1, bool is_virtual = false);
|
|
|
|
|
|
|
|
const shared_ptr<class_decl>
|
|
|
|
get_base_class() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return base_class_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
get_is_virtual() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return is_virtual_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
long
|
|
|
|
get_offset_in_bits() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return offset_in_bits_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const member_base&) const;
|
|
|
|
};// end class class_decl::base_spec
|
2013-08-08 02:50:07 +00:00
|
|
|
|
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
|
|
|
bool
|
|
|
|
operator==(class_decl::base_spec_sptr l, class_decl::base_spec_sptr r);
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
/// Abstract a data member declaration in a class declaration.
|
2013-10-04 15:03:34 +00:00
|
|
|
class class_decl::data_member : public var_decl, public member_base
|
2013-08-08 02:50:07 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
bool is_laid_out_;
|
|
|
|
size_t offset_in_bits_;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
// Forbidden
|
|
|
|
data_member();
|
|
|
|
|
|
|
|
public:
|
2013-08-27 11:55:45 +00:00
|
|
|
|
2013-08-08 02:50:07 +00:00
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
|
|
|
|
|
|
|
/// Constructor for instances of class_decl::data_member.
|
|
|
|
///
|
|
|
|
/// @param data_member the variable to be used as data member.
|
|
|
|
///
|
|
|
|
/// @param access the access specifier for the data member.
|
|
|
|
///
|
|
|
|
/// @param is_laid_out set to true if the data member has been laid out.
|
|
|
|
///
|
|
|
|
/// @param is_static set ot true if the data member is static.
|
|
|
|
///
|
|
|
|
/// @param offset_in_bits the offset of the data member, expressed in bits.
|
|
|
|
data_member(shared_ptr<var_decl> data_member, access_specifier access,
|
|
|
|
bool is_laid_out, bool is_static, size_t offset_in_bits)
|
|
|
|
: decl_base(data_member->get_name(),
|
|
|
|
data_member->get_location(),
|
|
|
|
data_member->get_mangled_name(),
|
|
|
|
data_member->get_visibility()),
|
|
|
|
var_decl(data_member->get_name(),
|
|
|
|
data_member->get_type(),
|
|
|
|
data_member->get_location(),
|
|
|
|
data_member->get_mangled_name(),
|
|
|
|
data_member->get_visibility(),
|
|
|
|
data_member->get_binding()),
|
|
|
|
member_base(access, is_static),
|
2013-09-26 14:45:00 +00:00
|
|
|
is_laid_out_(is_laid_out),
|
|
|
|
offset_in_bits_(offset_in_bits)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
/// Constructor for instances of class_decl::data_member.
|
|
|
|
///
|
|
|
|
/// @param name the name of the data member.
|
|
|
|
///
|
|
|
|
/// @param type the type of the data member.
|
|
|
|
///
|
|
|
|
/// @param access the access specifier for the data member.
|
|
|
|
///
|
|
|
|
/// @param locus the source location of the data member.
|
|
|
|
///
|
|
|
|
/// @param mangled_name the mangled name of the data member, or an
|
|
|
|
/// empty string if not applicable.
|
|
|
|
///
|
|
|
|
/// @param vis the visibility of the data member.
|
|
|
|
///
|
|
|
|
/// @param bind the binding of the data member.
|
|
|
|
///
|
|
|
|
/// @param is_laid_out set to true if the data member has been laid out.
|
|
|
|
///
|
|
|
|
/// @param is_static set ot true if the data member is static.
|
|
|
|
///
|
|
|
|
/// @param offset_in_bits the offset of the data member, expressed in bits.
|
|
|
|
data_member(const std::string& name,
|
|
|
|
shared_ptr<type_base>& type,
|
|
|
|
access_specifier access,
|
|
|
|
location locus,
|
|
|
|
const std::string& mangled_name,
|
|
|
|
visibility vis,
|
|
|
|
binding bind,
|
|
|
|
bool is_laid_out,
|
|
|
|
bool is_static,
|
|
|
|
size_t offset_in_bits)
|
|
|
|
: decl_base(name, locus, mangled_name, vis),
|
|
|
|
var_decl(name, type, locus, mangled_name, vis, bind),
|
|
|
|
member_base(access, is_static),
|
2013-09-26 14:45:00 +00:00
|
|
|
is_laid_out_(is_laid_out),
|
|
|
|
offset_in_bits_(offset_in_bits)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
is_laid_out() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return is_laid_out_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
size_t
|
|
|
|
get_offset_in_bits() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return offset_in_bits_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const decl_base& other) const;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
/// This implements the traversable_base::traverse pure virtual
|
|
|
|
/// function.
|
|
|
|
///
|
|
|
|
/// @param v the visitor used on the current instance.
|
|
|
|
void
|
|
|
|
traverse(ir_node_visitor&);
|
|
|
|
|
|
|
|
virtual ~data_member();
|
2013-10-04 15:03:34 +00:00
|
|
|
};// end class class_decl::data_member
|
2013-08-08 02:50:07 +00:00
|
|
|
|
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
|
|
|
bool
|
|
|
|
operator==(class_decl::data_member_sptr l, class_decl::data_member_sptr r);
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
/// Abstraction of the declaration of a method. This is an
|
|
|
|
/// implementation detail for class_decl::member_function.
|
|
|
|
class class_decl::method_decl : public function_decl
|
|
|
|
{
|
|
|
|
method_decl();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
method_decl(const std::string& name,
|
|
|
|
const std::vector<shared_ptr<parameter> >& parms,
|
|
|
|
shared_ptr<type_base> return_type,
|
|
|
|
shared_ptr<class_decl> class_type,
|
|
|
|
size_t ftype_size_in_bits,
|
|
|
|
size_t ftype_align_in_bits,
|
|
|
|
bool declared_inline,
|
|
|
|
location locus,
|
|
|
|
const std::string& mangled_name = "",
|
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_GLOBAL);
|
|
|
|
|
|
|
|
method_decl(const std::string& name, shared_ptr<method_type> type,
|
|
|
|
bool declared_inline, location locus,
|
|
|
|
const std::string& mangled_name = "",
|
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_GLOBAL);
|
|
|
|
|
|
|
|
method_decl(const std::string& name,
|
|
|
|
shared_ptr<function_type> type,
|
|
|
|
bool declared_inline,
|
|
|
|
location locus,
|
|
|
|
const std::string& mangled_name = "",
|
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_GLOBAL);
|
|
|
|
|
|
|
|
method_decl(const std::string& name, shared_ptr<type_base> type,
|
|
|
|
bool declared_inline, location locus,
|
|
|
|
const std::string& mangled_name = "",
|
|
|
|
visibility vis = VISIBILITY_DEFAULT,
|
|
|
|
binding bind = BINDING_GLOBAL);
|
|
|
|
|
|
|
|
/// @return the type of the current instance of the
|
|
|
|
/// class_decl::method_decl.
|
|
|
|
const shared_ptr<method_type>
|
|
|
|
get_type() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
set_type(shared_ptr<method_type> fn_type)
|
|
|
|
{ function_decl::set_type(fn_type); }
|
|
|
|
|
|
|
|
virtual ~method_decl();
|
2013-10-04 15:03:34 +00:00
|
|
|
};// end class class_decl::method_decl
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
/// Abstracts a member function declaration in a class declaration.
|
2013-10-04 15:03:34 +00:00
|
|
|
class class_decl::member_function : public method_decl, public member_base
|
2013-08-08 02:50:07 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
size_t vtable_offset_in_bits_;
|
|
|
|
bool is_constructor_;
|
|
|
|
bool is_destructor_;
|
|
|
|
bool is_const_;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
// Forbidden
|
|
|
|
member_function();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
|
|
|
|
|
|
|
member_function(const std::string& name,
|
|
|
|
std::vector<shared_ptr<parameter> > parms,
|
|
|
|
shared_ptr<type_base> return_type,
|
|
|
|
shared_ptr<class_decl> class_type,
|
|
|
|
size_t ftype_size_in_bits,
|
|
|
|
size_t ftype_align_in_bits,
|
|
|
|
access_specifier access,
|
|
|
|
bool declared_inline,
|
2013-10-10 08:11:35 +00:00
|
|
|
location locus,
|
2013-08-08 02:50:07 +00:00
|
|
|
const std::string& mangled_name,
|
|
|
|
visibility vis,
|
2013-10-10 08:11:35 +00:00
|
|
|
binding bind,
|
|
|
|
size_t vtable_offset_in_bits,
|
2013-08-08 02:50:07 +00:00
|
|
|
bool is_static,
|
|
|
|
bool is_constructor,
|
|
|
|
bool is_destructor,
|
|
|
|
bool is_const)
|
|
|
|
: decl_base(name, locus, name, vis),
|
|
|
|
method_decl(name, parms, return_type, class_type,
|
|
|
|
ftype_size_in_bits, ftype_align_in_bits,
|
|
|
|
declared_inline, locus,
|
|
|
|
mangled_name, vis, bind),
|
|
|
|
member_base(access, is_static),
|
2013-09-26 14:45:00 +00:00
|
|
|
vtable_offset_in_bits_(vtable_offset_in_bits),
|
|
|
|
is_constructor_(is_constructor),
|
|
|
|
is_destructor_(is_destructor),
|
|
|
|
is_const_(is_const)
|
2013-08-08 02:50:07 +00:00
|
|
|
{ }
|
|
|
|
|
|
|
|
member_function(shared_ptr<method_decl> fn,
|
|
|
|
access_specifier access,
|
|
|
|
size_t vtable_offset_in_bits,
|
|
|
|
bool is_static,
|
|
|
|
bool is_constructor,
|
|
|
|
bool is_destructor,
|
|
|
|
bool is_const)
|
|
|
|
: decl_base(fn->get_name(), fn->get_location(),
|
|
|
|
fn->get_mangled_name(), fn->get_visibility()),
|
|
|
|
method_decl(fn->get_name(),
|
|
|
|
fn->get_type(),
|
|
|
|
fn->is_declared_inline(),
|
|
|
|
fn->get_location(),
|
|
|
|
fn->get_mangled_name(),
|
|
|
|
fn->get_visibility(),
|
|
|
|
fn->get_binding()),
|
|
|
|
member_base(access, is_static),
|
2013-09-26 14:45:00 +00:00
|
|
|
vtable_offset_in_bits_(vtable_offset_in_bits),
|
|
|
|
is_constructor_(is_constructor),
|
|
|
|
is_destructor_(is_destructor),
|
|
|
|
is_const_(is_const)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
member_function(shared_ptr<function_decl> fn,
|
|
|
|
access_specifier access,
|
|
|
|
size_t vtable_offset_in_bits,
|
|
|
|
bool is_static,
|
|
|
|
bool is_constructor,
|
|
|
|
bool is_destructor,
|
|
|
|
bool is_const);
|
|
|
|
|
|
|
|
size_t
|
|
|
|
get_vtable_offset_in_bits() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return vtable_offset_in_bits_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
is_constructor() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return is_constructor_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
is_destructor() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return is_destructor_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
is_const() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return is_const_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const decl_base&) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const member_base&) const;
|
|
|
|
|
2013-08-08 02:50:07 +00:00
|
|
|
bool
|
2013-10-10 14:58:30 +00:00
|
|
|
operator==(const member_function&) const;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
traverse(ir_node_visitor& v);
|
2013-10-04 15:03:34 +00:00
|
|
|
};// class_decl::member_function
|
2013-08-08 02:50:07 +00:00
|
|
|
|
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
|
|
|
bool
|
|
|
|
operator==(class_decl::member_function_sptr l,
|
|
|
|
class_decl::member_function_sptr r);
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
/// Abstract a member function template.
|
|
|
|
class class_decl::member_function_template
|
2013-08-08 06:54:44 +00:00
|
|
|
: public member_base, public virtual traversable_base
|
2013-08-08 02:50:07 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
bool is_constructor_;
|
|
|
|
bool is_const_;
|
|
|
|
shared_ptr<function_tdecl> fn_tmpl_;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
// Forbiden
|
|
|
|
member_function_template();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
member_function_template(function_tdecl_sptr f,
|
2013-08-08 06:54:44 +00:00
|
|
|
access_specifier access, bool is_static,
|
2013-10-15 12:17:13 +00:00
|
|
|
bool is_constructor, bool is_const)
|
2013-09-26 14:45:00 +00:00
|
|
|
: member_base(access, is_static), is_constructor_(is_constructor),
|
|
|
|
is_const_(is_const), fn_tmpl_(f)
|
2013-10-15 12:17:13 +00:00
|
|
|
{}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
is_constructor() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return is_constructor_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
is_const() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return is_const_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
operator const function_tdecl& () const
|
2013-10-10 08:11:35 +00:00
|
|
|
{return *fn_tmpl_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
function_tdecl_sptr
|
2013-08-08 06:54:44 +00:00
|
|
|
as_function_tdecl() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return fn_tmpl_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const member_base& o) const;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
traverse(ir_node_visitor&);
|
2013-10-04 15:03:34 +00:00
|
|
|
};// end class class_decl::member_function_template
|
2013-08-08 02:50:07 +00:00
|
|
|
|
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
|
|
|
bool
|
|
|
|
operator==(class_decl::member_function_template_sptr l,
|
|
|
|
class_decl::member_function_template_sptr r);
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
/// Abstracts a member class template template
|
2013-08-27 11:55:45 +00:00
|
|
|
class class_decl::member_class_template
|
2013-08-08 06:54:44 +00:00
|
|
|
: public member_base, public virtual traversable_base
|
2013-08-08 02:50:07 +00:00
|
|
|
{
|
2013-09-26 14:45:00 +00:00
|
|
|
shared_ptr<class_tdecl> class_tmpl_;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
// Forbidden
|
|
|
|
member_class_template();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// Hasher.
|
|
|
|
struct hash;
|
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
member_class_template(shared_ptr<class_tdecl> c,
|
2013-08-08 02:50:07 +00:00
|
|
|
access_specifier access, bool is_static)
|
2013-09-26 14:45:00 +00:00
|
|
|
: member_base(access, is_static), class_tmpl_(c)
|
2013-10-10 08:11:35 +00:00
|
|
|
{}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
operator const class_tdecl& () const
|
2013-09-26 14:45:00 +00:00
|
|
|
{ return *class_tmpl_; }
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
shared_ptr<class_tdecl>
|
|
|
|
as_class_tdecl() const
|
2013-09-26 14:45:00 +00:00
|
|
|
{return class_tmpl_;}
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-10-10 14:58:30 +00:00
|
|
|
virtual bool
|
|
|
|
operator==(const member_base& o) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
operator==(const member_class_template&) const;
|
2013-08-08 02:50:07 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
traverse(ir_node_visitor& v);
|
2013-10-04 15:03:34 +00:00
|
|
|
};// end class class_decl::member_class_template
|
2013-08-08 02:50:07 +00:00
|
|
|
|
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
|
|
|
bool
|
|
|
|
operator==(class_decl::member_class_template_sptr l,
|
|
|
|
class_decl::member_class_template_sptr r);
|
2013-08-08 02:50:07 +00:00
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
// Forward declarations for select nested hashers.
|
|
|
|
struct type_base::shared_ptr_hash
|
|
|
|
{
|
|
|
|
size_t
|
|
|
|
operator()(const shared_ptr<type_base> t) const;
|
|
|
|
};
|
2013-08-27 11:55:45 +00:00
|
|
|
|
2013-08-07 09:07:29 +00:00
|
|
|
struct type_base::dynamic_hash
|
|
|
|
{
|
|
|
|
size_t
|
|
|
|
operator()(const type_base* t) const;
|
|
|
|
};
|
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
struct function_tdecl::hash
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
{
|
2013-08-07 09:07:29 +00:00
|
|
|
size_t
|
2013-08-08 06:54:44 +00:00
|
|
|
operator()(const function_tdecl& t) const;
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
Initial support for function templates
* src/abg-ir.h (function_decl::set_return_type): New inline
definition.
(class template_decl, struct template_decl_hash, class
template_parameter, struct template_parameter_hash, struct
dynamic_template_parameter_hash, struct
template_parameter_shared_ptr_hash, class template_type_parameter)
(struct template_type_parameter_hash, class
template_non_type_parameter, struct
template_non_type_parameter_hash, class
template_template_parameter, struct
template_template_parameter_hash, class function_template_decl)
(struct function_template_decl_hash, struct
fn_tmpl_shared_ptr_hash): New declarations.
* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for
template template, and template type parameters.
(template_decl_hash::operator, template_decl::~template_decl)
(template_decl::operator==, template_parameter::operator==)
(template_parameter_hash::operator())
(dynamic_template_parameter_hash::operator())
(template_type_parameter::operator==)
(template_type_parameter::~template_type_parameter)
(template_type_parameter_hash::operator())
(template_non_type_parameter::operator==)
(template_non_type_parameter::~template_non_type_parameter)
(template_non_type_parameter_hash::operator())
(template_template_parameter::operator==)
(template_template_parameter::~template_template_parameter)
(template_template_parameter_hash::operator())
(function_template_decl::operator==)
(function_template_decl_hash::operator())
(fn_tmpl_shared_ptr_hash::operator())
(function_template_decl::~function_template_decl()): New
definitions.
* src/abg-reader.cc (read_context::get_fn_tmpl_decl)
(read_context::key_fn_tmpl_decl): New functions.
(read_context::m_fn_tmpl_map): New data member.
(read_context::key_type_decl): Renamed read_context::add_type_decl
into this.
(read_context::push_decl_to_current_scope): Renamed
read_context::finish_decl_creation into this. Add an assert.
(read_context::push_and_key_type_decl): Renamed
read_context::finish_type_decl_creation into this. Adjust to the
use of push_decl_to_current_scope and key_type_decl.
(build_function_template_decl, build_template_type_parameter)
(build_template_non_type_parameter)
(build_template_template_parameter, build_template_parameter)
(handle_function_template_decl): New functions.
(handle_element): Call handle_function_template_decl.
(build_function_decl): Take a bool parameter to update depth
information in parsing context. Move instantiation of
function_decl before parsing its xml sub-nodes. Update the depth
info in the parsing context if necessary. Push the newly
intantiated decl to scope. And then parse the sub nodes. Do not
forget to add the fn parameters and return type using
function_decl::add_parameter and function_decl::set_return_type.
(build_var_decl, build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_enum_type_decl, build_typedef_decl, handled_type_decl)
(handle_qualified_type_decl, handle_pointer_type_def)
(handle_reference_type_def, handle_enum_type_decl)
(handle_typedef_decl, handle_var_decl, handle_function_decl)
(handle_class_decl): Adjust.
(build_class_decl): Take a bool parameter to update depth
information in parsing context. Add comment. Wait for the class
members to be built, before keying (and thus hashing it) the
class.
(build_type): Fix logic, and adjust.
* src/abg-writer.cc (write_context::type_has_existing_id)
(write_context::get_id_for_fn_tmpl, write_template_type_parameter)
(write_template_non_type_parameter)
(write_template_template_parameter, write_template_parameter)
(write_function_template_decl): New functions.
(write_context::get_id_for_type): Simplify logic.
(write_decl): Support writing function template.
* tests/data/test-read-write/test11.xml: New test input.
* tests/test-read-write.cc (InoutSpec in_out_specs[]):
De-serialize the new test11.xml test, serialize it back and diff
output and input.
* tests/Makefile.am: Add test11.xml to the distribution.
2013-04-23 09:27:32 +00:00
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
struct function_tdecl::shared_ptr_hash
|
2013-08-07 09:07:29 +00:00
|
|
|
{
|
|
|
|
size_t
|
2013-08-08 06:54:44 +00:00
|
|
|
operator()(const shared_ptr<function_tdecl> f) const;
|
2013-08-07 09:07:29 +00:00
|
|
|
};
|
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
struct class_tdecl::hash
|
2013-08-07 09:07:29 +00:00
|
|
|
{
|
|
|
|
size_t
|
2013-08-08 06:54:44 +00:00
|
|
|
operator()(const class_tdecl& t) const;
|
2013-08-07 09:07:29 +00:00
|
|
|
};
|
|
|
|
|
2013-08-08 06:54:44 +00:00
|
|
|
struct class_tdecl::shared_ptr_hash
|
2013-08-07 09:07:29 +00:00
|
|
|
{
|
|
|
|
size_t
|
2013-08-08 06:54:44 +00:00
|
|
|
operator()(const shared_ptr<class_tdecl> t) const;
|
2013-08-07 09:07:29 +00:00
|
|
|
};
|
|
|
|
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
/// The base class for the visitor type hierarchy used for traversing
|
|
|
|
/// a translation unit.
|
|
|
|
///
|
|
|
|
/// Client code willing to get notified for a certain kind of node
|
|
|
|
/// during the IR traversal might want to define a visitor class that
|
2013-08-02 23:30:56 +00:00
|
|
|
/// inherit ir_node_visitor, overload the ir_node_visitor::visit
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
/// method of its choice, and provide and implementation for it. That
|
|
|
|
/// new visitor class would then be passed to e.g,
|
2013-08-02 23:30:56 +00:00
|
|
|
/// translation_unit::traverse or to the traverse method of any type
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
/// where the traversal is supposed to start from.
|
2013-09-26 21:33:23 +00:00
|
|
|
struct ir_node_visitor : public node_visitor_base
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
{
|
|
|
|
virtual void visit(scope_decl&);
|
|
|
|
virtual void visit(type_decl&);
|
|
|
|
virtual void visit(namespace_decl&);
|
|
|
|
virtual void visit(qualified_type_def&);
|
|
|
|
virtual void visit(pointer_type_def&);
|
|
|
|
virtual void visit(reference_type_def&);
|
|
|
|
virtual void visit(enum_type_decl&);
|
|
|
|
virtual void visit(typedef_decl&);
|
|
|
|
virtual void visit(var_decl&);
|
|
|
|
virtual void visit(function_decl&);
|
2013-08-08 06:54:44 +00:00
|
|
|
virtual void visit(function_tdecl&);
|
|
|
|
virtual void visit(class_tdecl&);
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
virtual void visit(class_decl&);
|
|
|
|
virtual void visit(class_decl::data_member&);
|
|
|
|
virtual void visit(class_decl::member_function&);
|
|
|
|
virtual void visit(class_decl::member_function_template&);
|
|
|
|
virtual void visit(class_decl::member_class_template&);
|
|
|
|
};
|
|
|
|
|
2013-02-28 23:38:28 +00:00
|
|
|
} // end namespace abigail
|
2013-03-29 14:30:34 +00:00
|
|
|
#endif // __ABG_IR_H__
|