* src/abg-writer.cc (do_indent): New function.
(write_corpus&): Use do_indent. Don't forget to close the
abi-instr tag.
(write_type_decl): Use do_indent. Handle null decls pointers.
Emit the id at the end of the element.
(write_namespace_decl): Use do_indent. Handle null decls
pointers.
* tests/test-utils.{h,cc} (get_src_dir,get_build_dir): Constify
the returned reference to string.
(is_dir, ensure_dir_path_created, ensure_parent_dir_created): New
function definitions.
* tests/test-read-write.cc (main): Augment the test to serialize
the corpus too.
* src/abg-ir.cc (namespace_decl::~namespace_decl): Add this
missing virtual constructor definition.
* src/abg-reader.cc (read_context::{get_cur_decl,pop_decl}):
Return a null pointer when the decls stack is empty.
(update_read_context): Don't try to de-reference a NULL cur_decl.
(read_input): Don't try to poke at file validity here. What was I
thinking. Really test for advance_cursor to return 1, expressing
success.
* src/abg-reader.h (read_file): Fix style.
* Makefile.am: Add tests sub-directory.
* configure.ac: Build with debugging-friendly options if the
ABIGAIL_DEBUG env variable is set. Generate tests/Makefile.
* tests/Makefile.am: New file.
* tests/test-read-write.cc: Likewise.
* tests/test-utils.{h,cc}: Likewise.
* tests/data/test-read-write/input0.xml: Likewise.
* src/Makefile.am: Add abg-writer.{h,cc} and abg-config.{h,cc}.
* src/abg-config.{h,cc}: New files.
* src/abg-corpus.h (abi_corpus::decls_type): New typedef.
(abi_corpus::{add,get_decls,get_loc_mgr}): Fix style.
(abi_corpus::is_empty): Declare new function.
* src/abg-corpus.cc (abi_corpus::add): really add the declaration
to the corpus.
(abi_corpus::is_empty): Define new function.
* src/abg-ir.{h,cc} (location_manager::expand_location): Consti-fy
this function.
* src/abg-reader.cc (read_file): Add a corpus parameter.
* src/abg-serialize.cc: Delete this file.
* src/abg-writer.h (write_to_ostream): Rename write into this.
Make it take a corpus and an ostream as parameters.
* abg-writer.cc: New file.
* 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.
* src/abg-ir.h (location): Make the default ctor public.
(class decl): Declare data member and proper constructors. Make the
context be a shared_ptr. Add a kind data member to avoid RTTI for
now.
(class scope_decl): Added protected constructor to handle the kind data
member.
(class type_base): Add data members proper and clean the iface up.
(class type_decl, scope_type_decl, namespace_decl): Iron out
constructors.
* src/abg-ir.cc (class location): Fix style.
(class decl, scope_decl, type_base, type_decl, scope_type_decl)
(namespace_decl): Define these types.