* include/abg-comparison.h (class base_diff): New.
* include/abg-ir.h (function_decl::get_first_non_implicit_parm):
New member function.
(function_type::get_first_non_implicit_parm): Likewise.
* src/abg-comparison.cc (base_has_changed): Change parm to take
class_decl::base_spec_sptr.
(class_diff::ensure_lookup_tables_populated): Compare the base
specs not just the base classes.
(class_diff::report): Adjust. Report sub-type changes in the
member functions.
(base_diff::*): Define member functions.
(compute_diff): Define an overload for base_diff_sptr.
* src/abg-hash.cc ({function_type,
method_type}:#️⃣:operator()): Do not hash the implicit parm of
member functions.
(class_decl:#️⃣:operator()): Do not hash member types.
* src/abg-ir.cc (decl_base::decl_base): Initialize the
hashing_started_ member that got moved here from class_decl.
(decl_base::get_hash): Do not set the hash if it's being set b/c
we are in a class_decl.
(decl_base::operator==) Do not compare hashes for now. Two decls
can have different hashes and compare equal; think about an
incomplete type foo, that compares equal with a complete foo.
Their hashes will be different though. So for now, just avoid
comparing these.
(compare_function_types): Avoid comparing the implicit parameter
for member functions.
({function, method}_type::get_first_non_implicit_parm): New
definition.
* tests/data/test-read-write/test20.xml: Update.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Do not
declare classes before defining them because both the declaration
and the definition now compare equal.
* tests/data/test-read-dwarf/test1.abi: Update test.
* tests/data/test-read-write/test20.xml: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-reader.h (read_corpus_from_native_xml)
(read_corpus_from_native_xml_file): Declare new entry points.
* include/abg-writer.h (write_corpus_to_native_xml)
(write_corpus_to_native_xml_file): Likewise.
* src/abg-reader.cc (read_translation_unit_from_input): Renamed
read_input into this. Support new 'path' attribute for
'abi-instr' XML element.
(read_corpus_from_input): New static function.
(read_translation_unit_from_file)
(read_translation_unit_from_buffer)
(read_translation_unit_from_istream): Update wrt read_input ->
read_translation_unit_from_input.
(read_corpus_from_native_xml, read_corpus_from_native_xml)
(read_corpus_from_native_xml_file): Define new entry points.
* src/abg-writer.cc (write_translation_unit): Write 'path'
attribute into the 'abi-instr' xml element.
(write_corpus_to_native_xml, write_corpus_to_native_xml_file):
Define new entry points.
* tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS,
FILE_TYPE_ZIP_CORPUS}): New enumerators.
* tools/abg-tools-utils.cc (guess_file_type): Support detection of
the new xml file format containing a document root 'abi-corpus'
root element.
* tools/bidiff.cc (main): Support diffing xml corpus-es and zip
corpus-es.
* tools/bidw.cc (main): Recognize elf files before reading them.
* tools/bilint.cc (main): Support reading xml/zip corpus-es too.
* tests/data/test-read-write/test[0-23].xml: Update 'path'
attribute.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-ir.h (class_decl::base_spec::base_spec): Take an offset
and a is_virtual flag.
(class_decl::base_spec::{get_is_virtual, get_offset_in_bits}): New
methods.
(class_decl::has_no_base_nor_member): New method declaration..
* src/abg-ir.cc (class_decl::base_spec::base_spec): Take an offset
and a is_virtual flag
(class_decl::has_no_base_nor_member): Define it.
* src/abg-reader.cc (read_offset_in_bits): Renamed
read_var_offset_in_bits into this.
(read_is_virtual): New static function.
(build_class_decl): Read the 'layout-offset-in-bits' and the
'is-virtual' of the base class specifier. Adjust for the
read_var_offset_in_bits -> read_offset_in_bits rename.
* src/abg-writer.cc (write_layout_offset): New overload for the
base class specifiers.
(write_class_decl): If the class has no member or base class, make
it a proper empty xml element. Write the offset and the
is-virtual attribute.
* tests/data/test-read-write/test20.xml: New test input data.
* tests/test-read-write.cc: De-serialize the test above, serialize
it back and compare that both versions are the same.