2013-07-16 19:58:43 +00:00
|
|
|
// -*- mode: C++ -*-
|
|
|
|
//
|
2015-01-07 12:53:58 +00:00
|
|
|
// Copyright (C) 2013-2015 Red Hat, Inc.
|
2013-04-09 02:25:40 +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-04-09 02:25:40 +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-04-09 02:25:40 +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-04-09 02:25:40 +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
|
|
|
|
|
|
|
#include <tr1/memory>
|
2013-12-11 14:20:42 +00:00
|
|
|
#include <istream>
|
Add --drop/--keep options to bidiff
* include/abg-sptr-utils.h: New file.
* include/Makefile.am: Add abg-sptr-utils. to the build system.
* include/abg-libxml-utils.h (reader_sptr, xml_char_sptr): Remove
these typedefs as there are now in abg-sptr-utils.
(build_sptr): Likewise for this template and its specializations
declarations.
* src/abg-libxml-utils.cc (sptr_utils::build_sptr): Mode the
definition of the specializations for xmlTextReader and xmlChar
into the sptr_utils namespace.
* include/abg-corpus.h
(corpus::{get_regex_patterns_of_fns_to_suppress,
get_regex_patterns_of_vars_to_suppress,
get_regex_patterns_of_fns_to_keep,
get_regex_patterns_of_vars_to_keep}): Declare new member
functions.
* src/abg-comparison.cc (sptr_utils::regex_t_deleter): Define new
functor.
(build_sptr) Define new specialization for regex_t.
(struct array_deleter): Remove unused functor.
(corpus::priv::regex_patterns_{fns,vars}_to_{suppress,keep}): New data
members.
(symtab_build_visitor_type::regex_patterns_{fns,vars}_to_{suppress,keep}):
Likewise.
(symtab_build_visitor_type::r_{fns,vars}_{suppress,keep})):
Likewise.
(symtab_build_visitor_type::symtab_build_visitor_type): Update the
signature of this constructor to take regex patterns for functions
and variables to suppress and to keep. Also, initialize the data
members from these new parameters.
(symtab_build_visitor_type::regex_{fns,vars}_{suppress,keep}): New
member functions.
(symtab_build_visitor_type::{add_fn_to_wip_fns,
add_var_to_wip_vars}): Likewise.
(symtab_build_visitor_type::visit) Use either add_fn_to_wip_fns or
add_var_to_wip_vars depending on the overload of the visit()
member.
(corpus::priv::build_symbol_table): Update for the change of the
symtab_build_visitor_type constructor signature.
(corpus::get_regex_patterns_of_{fns,vars}_to_{suppress,keep}):
Define new member functions.
* tools/bidiff.cc (options::{drop,keep}_{fn,var}_regex_patterns}):
New data member.
(display_usage): Add help strings for --drop, --drop-fn,
--drop-var, --keep, --keep-fn, --keep-var
(parse_command_line): Parse the command lines above.
(set_corpus_keep_drop_regex_patterns): Define new static function.
(main): Use the new set_corpus_keep_drop_regex_patterns.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-28 16:26:18 +00:00
|
|
|
#include <abg-sptr-utils.h>
|
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
|
|
|
|
|
|
|
namespace abigail
|
|
|
|
{
|
Add --drop/--keep options to bidiff
* include/abg-sptr-utils.h: New file.
* include/Makefile.am: Add abg-sptr-utils. to the build system.
* include/abg-libxml-utils.h (reader_sptr, xml_char_sptr): Remove
these typedefs as there are now in abg-sptr-utils.
(build_sptr): Likewise for this template and its specializations
declarations.
* src/abg-libxml-utils.cc (sptr_utils::build_sptr): Mode the
definition of the specializations for xmlTextReader and xmlChar
into the sptr_utils namespace.
* include/abg-corpus.h
(corpus::{get_regex_patterns_of_fns_to_suppress,
get_regex_patterns_of_vars_to_suppress,
get_regex_patterns_of_fns_to_keep,
get_regex_patterns_of_vars_to_keep}): Declare new member
functions.
* src/abg-comparison.cc (sptr_utils::regex_t_deleter): Define new
functor.
(build_sptr) Define new specialization for regex_t.
(struct array_deleter): Remove unused functor.
(corpus::priv::regex_patterns_{fns,vars}_to_{suppress,keep}): New data
members.
(symtab_build_visitor_type::regex_patterns_{fns,vars}_to_{suppress,keep}):
Likewise.
(symtab_build_visitor_type::r_{fns,vars}_{suppress,keep})):
Likewise.
(symtab_build_visitor_type::symtab_build_visitor_type): Update the
signature of this constructor to take regex patterns for functions
and variables to suppress and to keep. Also, initialize the data
members from these new parameters.
(symtab_build_visitor_type::regex_{fns,vars}_{suppress,keep}): New
member functions.
(symtab_build_visitor_type::{add_fn_to_wip_fns,
add_var_to_wip_vars}): Likewise.
(symtab_build_visitor_type::visit) Use either add_fn_to_wip_fns or
add_var_to_wip_vars depending on the overload of the visit()
member.
(corpus::priv::build_symbol_table): Update for the change of the
symtab_build_visitor_type constructor signature.
(corpus::get_regex_patterns_of_{fns,vars}_to_{suppress,keep}):
Define new member functions.
* tools/bidiff.cc (options::{drop,keep}_{fn,var}_regex_patterns}):
New data member.
(display_usage): Add help strings for --drop, --drop-fn,
--drop-var, --keep, --keep-fn, --keep-var
(parse_command_line): Parse the command lines above.
(set_corpus_keep_drop_regex_patterns): Define new static function.
(main): Use the new set_corpus_keep_drop_regex_patterns.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-28 16:26:18 +00:00
|
|
|
|
|
|
|
/// Internal namespace for xml manipulation utilities.
|
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
|
|
|
namespace xml
|
|
|
|
{
|
2013-08-02 23:30:56 +00:00
|
|
|
|
Add --drop/--keep options to bidiff
* include/abg-sptr-utils.h: New file.
* include/Makefile.am: Add abg-sptr-utils. to the build system.
* include/abg-libxml-utils.h (reader_sptr, xml_char_sptr): Remove
these typedefs as there are now in abg-sptr-utils.
(build_sptr): Likewise for this template and its specializations
declarations.
* src/abg-libxml-utils.cc (sptr_utils::build_sptr): Mode the
definition of the specializations for xmlTextReader and xmlChar
into the sptr_utils namespace.
* include/abg-corpus.h
(corpus::{get_regex_patterns_of_fns_to_suppress,
get_regex_patterns_of_vars_to_suppress,
get_regex_patterns_of_fns_to_keep,
get_regex_patterns_of_vars_to_keep}): Declare new member
functions.
* src/abg-comparison.cc (sptr_utils::regex_t_deleter): Define new
functor.
(build_sptr) Define new specialization for regex_t.
(struct array_deleter): Remove unused functor.
(corpus::priv::regex_patterns_{fns,vars}_to_{suppress,keep}): New data
members.
(symtab_build_visitor_type::regex_patterns_{fns,vars}_to_{suppress,keep}):
Likewise.
(symtab_build_visitor_type::r_{fns,vars}_{suppress,keep})):
Likewise.
(symtab_build_visitor_type::symtab_build_visitor_type): Update the
signature of this constructor to take regex patterns for functions
and variables to suppress and to keep. Also, initialize the data
members from these new parameters.
(symtab_build_visitor_type::regex_{fns,vars}_{suppress,keep}): New
member functions.
(symtab_build_visitor_type::{add_fn_to_wip_fns,
add_var_to_wip_vars}): Likewise.
(symtab_build_visitor_type::visit) Use either add_fn_to_wip_fns or
add_var_to_wip_vars depending on the overload of the visit()
member.
(corpus::priv::build_symbol_table): Update for the change of the
symtab_build_visitor_type constructor signature.
(corpus::get_regex_patterns_of_{fns,vars}_to_{suppress,keep}):
Define new member functions.
* tools/bidiff.cc (options::{drop,keep}_{fn,var}_regex_patterns}):
New data member.
(display_usage): Add help strings for --drop, --drop-fn,
--drop-var, --keep, --keep-fn, --keep-var
(parse_command_line): Parse the command lines above.
(set_corpus_keep_drop_regex_patterns): Define new static function.
(main): Use the new set_corpus_keep_drop_regex_patterns.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-28 16:26:18 +00:00
|
|
|
using sptr_utils::build_sptr;
|
2013-08-02 03:16:22 +00:00
|
|
|
using std::tr1::shared_ptr;
|
Add --drop/--keep options to bidiff
* include/abg-sptr-utils.h: New file.
* include/Makefile.am: Add abg-sptr-utils. to the build system.
* include/abg-libxml-utils.h (reader_sptr, xml_char_sptr): Remove
these typedefs as there are now in abg-sptr-utils.
(build_sptr): Likewise for this template and its specializations
declarations.
* src/abg-libxml-utils.cc (sptr_utils::build_sptr): Mode the
definition of the specializations for xmlTextReader and xmlChar
into the sptr_utils namespace.
* include/abg-corpus.h
(corpus::{get_regex_patterns_of_fns_to_suppress,
get_regex_patterns_of_vars_to_suppress,
get_regex_patterns_of_fns_to_keep,
get_regex_patterns_of_vars_to_keep}): Declare new member
functions.
* src/abg-comparison.cc (sptr_utils::regex_t_deleter): Define new
functor.
(build_sptr) Define new specialization for regex_t.
(struct array_deleter): Remove unused functor.
(corpus::priv::regex_patterns_{fns,vars}_to_{suppress,keep}): New data
members.
(symtab_build_visitor_type::regex_patterns_{fns,vars}_to_{suppress,keep}):
Likewise.
(symtab_build_visitor_type::r_{fns,vars}_{suppress,keep})):
Likewise.
(symtab_build_visitor_type::symtab_build_visitor_type): Update the
signature of this constructor to take regex patterns for functions
and variables to suppress and to keep. Also, initialize the data
members from these new parameters.
(symtab_build_visitor_type::regex_{fns,vars}_{suppress,keep}): New
member functions.
(symtab_build_visitor_type::{add_fn_to_wip_fns,
add_var_to_wip_vars}): Likewise.
(symtab_build_visitor_type::visit) Use either add_fn_to_wip_fns or
add_var_to_wip_vars depending on the overload of the visit()
member.
(corpus::priv::build_symbol_table): Update for the change of the
symtab_build_visitor_type constructor signature.
(corpus::get_regex_patterns_of_{fns,vars}_to_{suppress,keep}):
Define new member functions.
* tools/bidiff.cc (options::{drop,keep}_{fn,var}_regex_patterns}):
New data member.
(display_usage): Add help strings for --drop, --drop-fn,
--drop-var, --keep, --keep-fn, --keep-var
(parse_command_line): Parse the command lines above.
(set_corpus_keep_drop_regex_patterns): Define new static function.
(main): Use the new set_corpus_keep_drop_regex_patterns.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-28 16:26:18 +00:00
|
|
|
using sptr_utils::reader_sptr;
|
|
|
|
using sptr_utils::xml_char_sptr;
|
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
|
|
|
|
|
|
|
/// This functor is used to instantiate a shared_ptr for the
|
|
|
|
/// xmlTextReader.
|
|
|
|
struct textReaderDeleter
|
|
|
|
{
|
|
|
|
void
|
|
|
|
operator()(xmlTextReaderPtr reader)
|
Add --drop/--keep options to bidiff
* include/abg-sptr-utils.h: New file.
* include/Makefile.am: Add abg-sptr-utils. to the build system.
* include/abg-libxml-utils.h (reader_sptr, xml_char_sptr): Remove
these typedefs as there are now in abg-sptr-utils.
(build_sptr): Likewise for this template and its specializations
declarations.
* src/abg-libxml-utils.cc (sptr_utils::build_sptr): Mode the
definition of the specializations for xmlTextReader and xmlChar
into the sptr_utils namespace.
* include/abg-corpus.h
(corpus::{get_regex_patterns_of_fns_to_suppress,
get_regex_patterns_of_vars_to_suppress,
get_regex_patterns_of_fns_to_keep,
get_regex_patterns_of_vars_to_keep}): Declare new member
functions.
* src/abg-comparison.cc (sptr_utils::regex_t_deleter): Define new
functor.
(build_sptr) Define new specialization for regex_t.
(struct array_deleter): Remove unused functor.
(corpus::priv::regex_patterns_{fns,vars}_to_{suppress,keep}): New data
members.
(symtab_build_visitor_type::regex_patterns_{fns,vars}_to_{suppress,keep}):
Likewise.
(symtab_build_visitor_type::r_{fns,vars}_{suppress,keep})):
Likewise.
(symtab_build_visitor_type::symtab_build_visitor_type): Update the
signature of this constructor to take regex patterns for functions
and variables to suppress and to keep. Also, initialize the data
members from these new parameters.
(symtab_build_visitor_type::regex_{fns,vars}_{suppress,keep}): New
member functions.
(symtab_build_visitor_type::{add_fn_to_wip_fns,
add_var_to_wip_vars}): Likewise.
(symtab_build_visitor_type::visit) Use either add_fn_to_wip_fns or
add_var_to_wip_vars depending on the overload of the visit()
member.
(corpus::priv::build_symbol_table): Update for the change of the
symtab_build_visitor_type constructor signature.
(corpus::get_regex_patterns_of_{fns,vars}_to_{suppress,keep}):
Define new member functions.
* tools/bidiff.cc (options::{drop,keep}_{fn,var}_regex_patterns}):
New data member.
(display_usage): Add help strings for --drop, --drop-fn,
--drop-var, --keep, --keep-fn, --keep-var
(parse_command_line): Parse the command lines above.
(set_corpus_keep_drop_regex_patterns): Define new static function.
(main): Use the new set_corpus_keep_drop_regex_patterns.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-28 16:26:18 +00:00
|
|
|
{xmlFreeTextReader(reader);}
|
2013-08-02 03:16:22 +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
|
|
|
|
|
|
|
/// This functor is used to instantiate a shared_ptr for xmlChar
|
|
|
|
struct charDeleter
|
|
|
|
{
|
|
|
|
void
|
|
|
|
operator()(xmlChar* str)
|
2013-08-02 23:30:56 +00:00
|
|
|
{ xmlFree(str); }
|
2013-08-02 03:16:22 +00:00
|
|
|
};
|
2013-08-02 23:30:56 +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
|
|
|
reader_sptr new_reader_from_file(const std::string& path);
|
2013-08-27 13:18:59 +00:00
|
|
|
reader_sptr new_reader_from_buffer(const std::string& buffer);
|
2013-12-11 14:20:42 +00:00
|
|
|
reader_sptr new_reader_from_istream(std::istream*);
|
2014-05-14 09:03:42 +00:00
|
|
|
bool xml_char_sptr_to_string(xml_char_sptr, std::string&);
|
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
|
|
|
|
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
|
|
|
int get_xml_node_depth(xmlNodePtr);
|
|
|
|
|
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 the name of the current element node the reader is pointing
|
|
|
|
/// to. Note that this macro returns an instance of
|
|
|
|
/// shared_ptr<xmlChar> so that the caller doesn't have to worry about
|
|
|
|
/// managing memory itself. Also note that the reader is a
|
|
|
|
/// shared_ptr<xmlTextReader>
|
|
|
|
#define XML_READER_GET_NODE_NAME(reader) \
|
|
|
|
xml::build_sptr(xmlTextReaderName(reader.get()))
|
|
|
|
|
|
|
|
/// Get the type of the current node of the shared_ptr<xmlTextReader>
|
|
|
|
/// passed in argument.
|
|
|
|
#define XML_READER_GET_NODE_TYPE(reader) \
|
|
|
|
static_cast<xmlReaderTypes> (xmlTextReaderNodeType(reader.get()))
|
|
|
|
|
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
|
|
|
/// Get the value of attribute 'name' on the current node of 'reader'
|
|
|
|
/// which is an instance of shared_ptr<xmlTextReader>.
|
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
|
|
|
#define XML_READER_GET_ATTRIBUTE(reader, name) \
|
|
|
|
xml::build_sptr(xmlTextReaderGetAttribute(reader.get(), BAD_CAST(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
|
|
|
/// Get the value of attribute 'name' ont the instance of xmlNodePtr
|
|
|
|
/// denoted by 'node'.
|
|
|
|
#define XML_NODE_GET_ATTRIBUTE(node, name) \
|
|
|
|
xml::build_sptr(xmlGetProp(node, BAD_CAST(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
|
|
|
#define CHAR_STR(xml_char_str) \
|
|
|
|
reinterpret_cast<char*>(xml_char_str.get())
|
|
|
|
|
2014-01-13 15:38:57 +00:00
|
|
|
void
|
|
|
|
escape_xml_string(const std::string& str,
|
|
|
|
std::string& escaped);
|
|
|
|
|
|
|
|
std::string
|
|
|
|
escape_xml_string(const std::string& str);
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
unescape_xml_string(const std::string& str,
|
|
|
|
std::string& escaped);
|
|
|
|
|
|
|
|
std::string
|
|
|
|
unescape_xml_string(const std::string& str);
|
|
|
|
|
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
|
|
|
}//end namespace xml
|
|
|
|
}//end namespace abigail
|