1
0
mirror of git://sourceware.org/git/libabigail.git synced 2024-12-22 17:52:16 +00:00
Commit Graph

948 Commits

Author SHA1 Message Date
Dodji Seketeli
723c74b5a7 Mangled name of a scope_decl is its name
* src/abg-ir.h (scope_decl::scope_decl): The mangled name is the name.
2013-07-23 23:13:50 +02:00
Dodji Seketeli
a76076c904 Update scope when adding class members
* src/abg-ir.h (class_decl::add_member_type)
	(class_decl::add_data_member, class_decl::add_member_function):
	Move the inline implementation of these functions ...
	* src:abg-ir.cc (class_decl::add_member_type)
	(class_decl::add_data_member, class_decl::add_member_function):
	... here.  Augment their implementation to properly update the
	scope of the member.
2013-07-23 23:13:50 +02:00
Dodji Seketeli
ed33523dd6 Rename class_decl::member_type::get_type into as_type
* src/abg-ir.h (class_decl::member_type::get_type): Rename this
	into class_decl::member_type::as_type.
	* src/abg-writer.cc (write_class_decl): Adjust.
2013-07-23 23:13:50 +02:00
Dodji Seketeli
80d0e29f69 Avoid having multiple sub-objects of base classes
* src/abg-ir.cc (decl_base::decl_base): Remove useless definition.
	(type_base::type_base): Remove default arguments from parameters.
	(scope_type_decl::scope_type_decl)
	(namespace_decl::namespace_decl): Call the constructors for the
	virtual bases explicitly.
	* src/abg-ir.h (class scope_decl): Perform virtual inheritance of
	decl_base.
	(global_scope::global_scope): Call virtual base decl_base's
	constructor directly.
	(class type_decl): Inherit from decl_base and type_base
	virtually.
	(class scope_type_decl): Inherit from type_base virtually.
	(class qualified_type_def, pointer_type_def, reference_type_def)
	(class enum_type_decl, typedef_decl): Inherit from type_base and
	decl_base virtually.
	(class var_decl, function_decl): Inherit from decl_base virtually.
	(class class_decl::member): Don't inherit from anything and adjust
	constructor's mem-initializer accordingly.
	(class class_decl::member_type): Inherit from decl_base virtually
	and adjust constructor's mem-initializer accordingly.
	(class_decl::{data_member::data_member,member_function::member_function)
	(class_decl::class_decl): Call virtual base's constructor
	explicitly.
2013-07-23 23:13:50 +02:00
Dodji Seketeli
04ad3184ba Move inline hashing functions out of line
* src/abg-ir.h (decl_base_hash::operator())
	(type_base_hash::operator(), type_decl_hash::operator())
	(scope_type_decl_hash::operator())
	(qualified_type_def_hash::operator())
	(pointer_type_def_hash::operator())
	(reference_type_def_hash::operator())
	(enum_type_decl_hash::operator(), typedef_decl_hash::operator())
	(var_decl_hash::operator(), function_decl_hash::operator())
	(class_decl::member_type_hash::operator())
	(class_decl::base_spec_hash::operator())
	(class_decl::data_member_hash::operator())
	(class_decl::member_function_hash::operator()): Move these inline
	definition ...
	* src/abg-ir.cc: ... here.
2013-07-23 23:13:50 +02:00
Dodji Seketeli
bfd352e5da Various style nit fixes
* src/abg-ir.cc: Move the emacs mode specifier for the file to the
	top of the file, otherwise, it's not effective.
	(struct location_manager::priv): Add end of struct comment.
	(class_decl_hash::operator()): Add fn comment.
	* src/abg-ir.h: Move the emacs mode specifier for the file to the
	top of the file, otherwise, it's not effective.
	(class scope_decl): Add end of class comment.
	* src/abg-reader.cc: Move the emacs mode specifier for the file to the
	top of the file, otherwise, it's not effective.
	(read_context::{get_type_decl,add_type_decl): Add comment.
	(handle_namespace_decl): Fix indent.
	* src/abg-writer.cc: Move the emacs mode specifier for the file to
	the top of the file, otherwise, it's not effective.
2013-07-23 23:13:50 +02:00
Dodji Seketeli
ef642f44b6 Remove .gitignore from VCS
* .gitignore: Remove from revision control as different
	programmers might want to ignore different things.
2013-07-23 23:13:50 +02:00
Benjamin Kosnik
dd66cc548b Add license
* src/abg-*: Add license.
	* tests/test-*: Same.
2013-07-23 23:13:49 +02:00
Dodji Seketeli
ee19845a94 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-07-23 23:13:49 +02:00
Dodji Seketeli
827f0fe6af Update enum decl representation as per the schema
* src/abg-reader.cc (handle_enum_type_decl): The name of the
	element holding the underlying type is now "underlying-type", no
	more "base".
	* src/abg-writer.cc (write_enum_type_decl): Likewise.
	* tests/data/test-read-write/test6.xml: Likewise.
2013-07-23 23:13:49 +02:00
Dodji Seketeli
43ce2becb1 Add tests/data/test-read-write/test9.xml
* tests/data/test-read-write/test9.xml: (Forgot to) Add this new
	test file.
2013-07-23 23:13:49 +02:00
Dodji Seketeli
816eb4999c Support function declarations
* src/abg-ir.h (class function_decl): New declaration & inline
	definitions.
	* src/abg-ir.cc (function_decl::~function_decl): New definition.
	* src/abg-reader.cc (read_location): New overload to read location
	from an xmlNodePtr.
	(build_function_parameter, handle_function_decl):
	New definitions.
	(handle_element): Support "function-decl" elements.
	* src/abg-writer.cc (write_location): New overload to write a
	location directly, not from a decl.
	(write_function_decl): New definition.
	(write_binding): Support writing the binding attribute from a
	function_decl instance.
	(write_decl): support serializing function
	* tests/data/test-read-write/test9.xml: New test input file.
	* tests/Makefile.am: Add data/test-read-write/test9.xml to the
	build system.
	* tests/test-read-write.cc: De-serialize
	data/test-read-write/test9.xml, serialize it back and diff the
	output from the input.
2013-07-23 23:13:49 +02:00
Dodji Seketeli
189fc9cd14 Update in-vcs configure and docs/Makefile.in to recent configure
* configure: Updated as re-generated by autoconf 2.69.
	* doc/Makefile.in: Updated as re-generated by automake 1.12.2.
2013-07-23 23:13:49 +02:00
Benjamin Kosnik
43a83cf453 Add doc dir. Add Doxgen api generation rules.
2013-04-02  Benjamin Kosnik  <bkoz@redhat.com>

	* doc: Add.
	* doc/Makefile.am (html, install-html): Add.
	* doc/Makefile.in: Add.
	* doc/api/libabigail.doxy: Add doxygen config.
	* src/abg-*: Add @file markup.
2013-04-03 15:21:33 +02:00
Dodji Seketeli
270fd9d10c 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 15:05:07 +02:00
Dodji Seketeli
760248d26b 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 16:51:59 +02:00
Dodji Seketeli
b4882b76ed Don't forget to init context & visibility in decl_base
* src/abg-ir.cc (decl_base::decl_base): Initialize context and
	visibility on all the overloads of the constructor.
2013-04-02 16:51:58 +02:00
Dodji Seketeli
a1bf41d07f Fix some style
* src/abg-ir.h (decl_base::get_scope): Really re-style.
2013-04-02 16:51:12 +02:00
Dodji Seketeli
56821b2e4b Fix some style
* src/abg-ir.h (decl_base::{get_location, set_location, get_name,
	set_name}): Re-style.
2013-03-31 20:09:52 +02:00
Dodji Seketeli
7513a91ff0 Basic support for type/decl visibility
* src/abg-ir.h (enum decl_base::visibility)
	(decl_base::get_visibility, decl_base::set_visibility)
	(decl_base::m_visibility): New.
	(decl_base::decl_base, scope_decl::scope_decl)
	(type_decl::type_decl, enum_type_decl::enum_type_decl)
	(typedef_decl::typedef_decl): Pass visibility.
	* src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl)
	(type_decl::type_decl, enum_type_decl::enum_type_decl)
	(typedef_decl::typedef_decl): Pass visibility.
	(qualified_type_def::qualified_type_def)
	(pointer_type_def::pointer_type_def)
	(reference_type_def::reference_type_def): Initialize visibility.
2013-03-31 20:04:17 +02:00
Dodji Seketeli
dedb3c0d78 A type/decl shouldn't hold a reference on its scope
* src/abg-ir.h (decl_base::m_context): Make this a naked pointer.
	(decl_base::set_scope, add_decl_to_scope): Pass the
	scope as a naked pointer.
	* src/abg-ir.cc (decl_base::decl_base): Initialize the context to
	0.
	(decl_base::set_scope, add_decl_to_scope): Pass the scope as a
	naked pointer.
	* src/abg-reader.cc (read_context::get_cur_scope): Return a naked
	pointer.
	(handle_namespace_decl): Adjust accordingly.
2013-03-31 20:01:24 +02:00
Dodji Seketeli
a5a6fd8fce Support typedef declarations
* src/abg-ir.cc (dynamic_type_hash::operator()): Handle hashing of
	a pointer to an instance of typedef_decl.
	(typedef_decl::typedef_decl, typedef_decl::operator==)
	(typedef_decl::operator==, typedef_decl::get_underlying_type)
	(typedef_decl::~typedef_decl): New definitions.
	* src/abg-ir.h (class typedef_decl, struct typedef_decl_hash): New
	declarations.
	* src/abg-reader.cc (handle_typedef_decl): New definition.
	(handle_element): Handle de-serialization of typedef-decl element.
	* src/abg-writer.cc (write_typedef_decl): New definition.
	(write_decl): Handle serialization of an instance of typedef_decl.
	* tests/data/test-read-write/test7.xml: New test.
	* tests/Makefile.am: Add it to the distribution.
	* tests/test-read-write.cc: De-serialize the content of the new
	test, serialize it back and diff both.
2013-03-30 21:59:19 +01:00
Dodji Seketeli
77ade2bde1 Remove useless static_cast from hashing code
* src/abg-ir.h (scope_type_decl_hash::operator())
	(qualified_type_def_hash::operator())
	(pointer_type_def_hash::operator())
	(reference_type_def_hash::operator()): Remove useless static_cast.
2013-03-30 21:48:46 +01:00
Dodji Seketeli
946c2628d4 Simplify equality operators
* src/abg-ir.cc (qualified_type_def::operator==)
	(pointer_type_def::operator==, reference_type_def::operator==)
	(enum_type_decl::operator==): Simplify the code by safely assuming
	the underlying type is non-null.
2013-03-30 21:45:29 +01:00
Dodji Seketeli
170885cfcc Support enum type declarations
* src/abg-ir.h (class enum_type_decl, struct enum_type_decl_hash):
	New declarations.
	* src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing
	support for enum_type_decl.
	(enum_type_decl::enum_type_decl)
	(enum_type_decl::get_underlying_type)
	(enum_type_decl::get_enumerators, enum_type_decl::~enum_type_decl)
	(enum_type_decl::operator==): New definitions.
	* src/abg-reader.cc (handle_enum_type_decl): New definition.
	(handle_element): Handle "enum-decl" element.
	* src/abg-writer.cc (write_enum_type_decl): New.
	(write_decl): Add support to serialize enum_type_decl.
	* tests/test-read-write.cc: De-serialize and serialize
	data/test-read-write/test6.xml back.
	* tests/data/test-read-write/test6.xml: New test input.
	* tests/Makefile.am: Add it to the distribution.
2013-03-30 19:33:05 +01:00
Dodji Seketeli
69dd490ca4 Fix reference-type-def serialization
* tests/test-read-write.cc: Really de-serialize and then serialize
	back data/test-read-write/test5.xml, not test4.xml.  Sigh.
	* src/abg-writer.cc (write_reference_type_def): As a result of
	really trying to serialize reference type definitions fix the
	serialization code here.
2013-03-30 18:40:26 +01:00
Dodji Seketeli
0951049924 Support reference types
* src/abg-ir.h (class reference_type_def, struct pointer_type_def)
	(struct reference_type_def): New declaration.
	(type_base_hash::operator(), type_decl_hash::operator())
	(scope_type_decl_hash::operator())
	(qualified_type_def_hash::operator()): Include the typeid name in
	the hash.
	* src/abg-ir.cc (reference_type_def::reference_type_def)
	(reference_type_def::operator==)
	(reference_type_def::get_pointed_to_type)
	(reference_type_def::is_lvalue)
	(reference_type_def::~reference_type_def): New definitions.
	(dynamic_type_hash::operator): Hash pointer_type_def and
	reference_type_def instances.
	* src/abg-reader.cc (read_context::finish_decl_creation)
	(read_context::finish_type_decl_creation)
	(handle_reference_type_def): New definitions.
	(read_file): Handle "reference-type-def" elements.
	(handle_type_decl, handle_namespace_decl)
	(handle_qualified_type_decl, handle_pointer_type_def): Use the new
	read_context::finish_type_decl_creation or
	read_context::finish_decl_creation.
	* src/abg-writer.cc (write_reference_type_def): New definition.
	(write_decl): Supporting writing a pointer to an instance of
	reference_type_def.
	* tests/data/test-read-write/test5.xml: New test file.
	* tests/test-read-write.cc: (De)Serialize it.
	* tests/Makefile.am: Add it to the build system.
2013-03-29 16:44:08 +01:00
Dodji Seketeli
d418d5198f Support pointer types & Fix IR types equality
* src/abg-ir.h (location::{operator==, operator<})
	(decl_base::operator==, scope_decl::operator==)
	(type_base::operator==, struct type_shared_ptr_equal)
	(type_decl::operator==, scope_type::operator==)
	(qualified_type_def::operator==, class pointer_type_def): New
	declarations..
	* src/abg-ir.cc (decl_base::operator==, scope_decl::operator==)
	(type_base::operator==, type_decl::operator==)
	(scope_type_decl::operator==, namespace_decl::operator==)
	(qualified_type_def::operator==)
	(pointer_type_def::pointer_type_def, pointer_type_def::operator==)
	(pointer_type_def::get_pointed_to_type)
	(pointer_type_def::~pointer_type_def): New definitions.
	* src/abg-reader.cc (handle_pointer_type_def): New definition.
	(read_input): Handle pointer-type-def
	elements.
	* src/abg-writer.cc (type_shared_ptr_map):  Make this map use the
	use type_shared_ptr_equal predicate.
	(write_pointer_type_def): New definition.
	(write_decl): Improve logic.  Support serializing a pointer to
	pointer_type_def.
	* tests/data/test-read-write/test4.xml: New test input file.
	* tests/Makefile.am: Add tests/data/test-read-write/test4.xml to
	the build system.
	* tests/test-read-write.cc: (De)serialize the new test file.
2013-03-28 15:42:12 +01:00
Dodji Seketeli
57d8b7da41 Support qualified types & Misc ancillary fixes
* src/abg-ir.h (struct type_base_hash, struct dynamic_type_hash)
	(struct type_shared_ptr_hash, struct scope_type_decl_hash, class
	qualified_type_def, struct qualified_type_def_hash): New.
	(decl_base_hash::operator()): Constify. Don't crash if the scope
	of the decl we are hashing is null.
	(class type_decl): Add comment at the end.
	(type_decl_hash::operator()): Constify.  Reuse the new
	type_base_hash hasher.
	(class namespace_decl): Add comment.
	* src/abg-ir.cc (qualified_type_def::qualified_type_def)
	(qualified_type_def::~qualified_type_def)
	(qualified_type_def::get_cv_quals)
	(qualified_type_def::set_cv_quals)
	(qualified_type_def::get_underlying_type)
	(dynamic_type_hash::operator()): New function definitions.
	* src/abg-reader.cc (handle_qualified_type_decl): New.
	(read_file): Handle elements named "qualified-type-def".
	(read::context::add_type_decl): Assert that
	the type being associated to the unique ID is non-null.
	(handle_type_decl): Fix this in the process; don't crash if some
	attributes are not present.  Associate the unique id present in
	the xml document with the type we just parsed.
	(handle_namespace_decl): Add some comments.  Don't crash if the
	name attribute is not present.
	* src/abg-writer.cc (write_context::get_id_for_type)
	(write_context::m_type_id_map, write_decl_location)
	(write_qualified_type_def): New.
	(write_decl): Handle instances of qualified_type_def.
	(write_type_decl): Use the new write_decl_location and
	write_context::get_id_for_type.
	* tests/data/test-read-write/test0.xml: Update id format since we
	are now using the new write_context::get_id_for_type to generate
	it.
	* tests/data/test-read-write/test1.xml: Likewise.
	* tests/data/test-read-write/test2.xml: Likewise.
	* tests/data/test-read-write/test3.xml: New test.
	* tests/test-read-write.cc: Test De-serializing
	tests/data/test-read-write/test3.xml and serializing it back.
	Also don't bail out if we fail on one input.
	* tests/Makefile.am: Add tests/data/test-read-write/test3.xml to the
	distribution.
2013-03-27 23:59:16 +01:00
Benjamin Kosnik
342b932d54 Various autotool adjustments
* configure: Add.
	* configure.ac (AM_INIT_AUTOMAKE): Use gcc versions.
        (PKG_CHECK_MODULES): Re-use libjava/classpath solution, naming.
	* m4/pkg.m4: Add, take from classpath.
	* src/Makefile.am: Adjust names.
2013-03-27 21:01:54 +01:00
Dodji Seketeli
bde5ab9c40 Remove the 'm_kind' member from the IR
* src/abg-ir.{h,cc}: Remove use of the m_kind field.  We are using
	full blown rtti so this uselessly just clutter the code.
2013-03-26 13:06:47 +01:00
Dodji Seketeli
90930a5716 Fix parallel build
* tests/Makefile.am: Remove useless absolute reference to the
	current directory.
2013-03-26 12:22:28 +01:00
Dodji Seketeli
1c1532d60d Fix depth handling during the parsing
* src/abg-reader.cc (read_context::get_cur_scope): Remove useless
	const overload.  Don't make this rely on m_cur_scope.  Rather, use
	the path to the current decl (from the root element) to compute
	the cur scope.
	(read_context::m_cur_scope, read_context::set_cur_scope): Remove
	these.
	(update_read_context): Re-think logic.
	* tests/data/test-read-write/test2.xml: Add new test input.
	* tests/Makefile.am: Add data/test-read-write/test2.xml to the
	distribution.
	* tests/test-read-write.cc: Add data/test-read-write/test2.xml to
	the harness.
2013-03-26 11:43:59 +01:00
Dodji Seketeli
4ef7b34387 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 16:56:00 +01:00
Dodji Seketeli
298f19389d Update tests/data/test-read-write/input0.xml
* tests/data/test-read-write/input0.xml: Make this identical to
	how it would look like when serialized.
2013-03-22 17:17:57 +01:00
Dodji Seketeli
e25159b4b9 Debug type-decl serialization
* 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.
2013-03-22 16:53:26 +01:00
Dodji Seketeli
fc27d10cee Debugged type-decl de-serialization
* 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.
2013-03-21 23:57:22 +01:00
Dodji Seketeli
a80b09f912 Initial implementation of serialization of basic types and namespaces.
* 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.
2013-03-21 14:43:30 +01:00
Dodji Seketeli
8e225db39a 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 14:31:37 +01:00
Dodji Seketeli
e20615bf9f Updated hierarchy up to namespace_decl
* 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.
2013-03-04 16:29:31 +01:00
Dodji Seketeli
19cde0efb7 Add missing autoconfiscation files into version control
* config.guess: Added to VCS.
	* config.sub: Likewise.
	* depcomp: Likewise.
	* install-sh: Likewise.
	* ltmain.sh: Likewise.
	* missing: Likewise
2013-03-01 00:47:49 +01:00
Dodji Seketeli
52864a54da Upload m4 file
* m4/: Import this directory into version control.
2013-03-01 00:44:18 +01:00
Dodji Seketeli
010f88d199 Create and expand locations
* src/abg-ir.h (class {location, location_manager, decl,
	scoped_decl, type_base, type_decl, scope_type_decl): Declare new
	types.
	* src/abg-ir.cc (class {location, location_manager}): Define new types.
2013-03-01 00:38:28 +01:00
Dodji Seketeli
b9ca3b4411 Adjust src/Makefile.am after some file rename
* src/Makefile.am: Update build system for renaming files from
	abgl-* into abg-*.
2013-03-01 00:36:17 +01:00
Dodji Seketeli
b8035bdf11 Update the README file
* README: Update.
2013-03-01 00:35:20 +01:00
Dodji Seketeli
6358c74a65 Initial AUTHORS and README 2013-02-28 13:25:20 +01:00
Dodji Seketeli
c822ae122f Leave license stuff for later 2013-02-28 13:20:19 +01:00
Dodji Seketeli
d7d371a742 Initial import Abigail
This is the initial Import of the

    ABI Generic Analysis and Instrumentation Library
2013-02-28 11:42:57 +01:00