2013-03-21 22:42:41 +00:00
|
|
|
h=$(abs_srcdir)
|
|
|
|
|
|
|
|
TESTS=runtestreadwrite
|
|
|
|
|
|
|
|
noinst_PROGRAMS= $(TESTS)
|
|
|
|
|
|
|
|
noinst_LTLIBRARIES = libtestutils.la
|
|
|
|
|
|
|
|
libtestutils_la_SOURCES=\
|
|
|
|
$(h)/test-utils.h \
|
|
|
|
$(h)/test-utils.cc
|
|
|
|
|
|
|
|
libtestutils_la_CXXFLAGS= \
|
|
|
|
-DABIGAIL_SRC_DIR=\"${top_srcdir}\" \
|
|
|
|
-DABIGAIL_BUILD_DIR=\"${top_builddir}\"
|
|
|
|
|
|
|
|
runtestreadwrite_SOURCES=$(h)/test-read-write.cc
|
2013-03-26 11:22:28 +00:00
|
|
|
runtestreadwrite_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
|
2013-03-21 22:42:41 +00:00
|
|
|
|
|
|
|
AM_CPPFLAGS=-I${top_srcdir}/src
|
|
|
|
|
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
|
|
|
EXTRA_DIST= \
|
|
|
|
$(h)/data/test-read-write/test0.xml \
|
2013-03-26 10:16:10 +00:00
|
|
|
$(h)/data/test-read-write/test1.xml \
|
2013-03-27 22:34:07 +00:00
|
|
|
$(h)/data/test-read-write/test2.xml \
|
2013-03-28 14:27:15 +00:00
|
|
|
$(h)/data/test-read-write/test3.xml \
|
2013-03-29 14:30:34 +00:00
|
|
|
$(h)/data/test-read-write/test4.xml \
|
2013-03-30 18:02:51 +00:00
|
|
|
$(h)/data/test-read-write/test5.xml \
|
2013-03-30 20:51:43 +00:00
|
|
|
$(h)/data/test-read-write/test6.xml \
|
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
|
|
|
$(h)/data/test-read-write/test7.xml \
|
2013-04-03 22:16:29 +00:00
|
|
|
$(h)/data/test-read-write/test8.xml \
|
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
|
|
|
$(h)/data/test-read-write/test9.xml \
|
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
|
|
|
$(h)/data/test-read-write/test10.xml \
|
|
|
|
$(h)/data/test-read-write/test11.xml
|