libabigail/tests/data/test-read-write/test18.xml

30 lines
1.9 KiB
XML
Raw Normal View History

Support new 'abi-corpus' native XML format (.abi) * 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>
2014-01-07 13:12:26 +00:00
<abi-instr version='1.0' path='data/test-read-write/test18.xml'>
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-1'/>
Hash a class declaration the same as its definition A class declaration hashes differently from its definition. Since the abixml format can now use a class element id before defining it, it's more consistent to stop representing class declarations in the abixml format, when the class is actually defined in the corpus. So this patch now hashes a class declaration the same as its definition, when the definition is present. If the definition is not present then the hash value of the declaration is just zero. This is consistent with what is done elsewhere in the code as a hash value of zero means the hash could not be computed, somehow, as the type comparison code knows that a type with hash value zero can be equal to a type with a hash value that is different from zero. As a result, many tests which use the abixml format have been adjusted to reflect the new form of abixml where class declarations are now omitted when these declarations are accompanied with their definition. I made sure that abidiff reports that former abixml output and the new one are equivalent. After this change abixml outputs should contain less redundant type declarations. This is another step toward normalizing the abixml output. * src/abg-hash.cc (class_decl::hash::operator()(const class_decl&)): If the class declaration has a definition, hash its definition instead. Otherwise, if the class declaration has no definition, just return a zero hash, like what we were doing before. * src/abg-reader.cc (read_context::maybe_canonicalize_type): Do not early canonicalize method types because most of the time, when this function is called, the method hasn't been added to its parent class yet. So wait until late before canonicalizing. * src/abg-writer.cc (write_class_is_declaration_only): Do not emit the "is-declaration-only" property if the declaration has a definition. (write_class_decl): If the class declaration has a definition, emit the definition instead. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-write/test18.xml: Likewise. * tests/data/test-read-write/test20.xml: Likewise. * tests/data/test-read-write/test21.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-21 09:22:30 +00:00
<class-decl name='S' size-in-bits='8' alignment-in-bits='8' visibility='default' filepath='../../prtests/test8.cc' line='1' column='8' id='type-id-2'>
<data-member access='public' layout-offset-in-bits='0'>
<var-decl name='a' type-id='type-id-1' visibility='default' filepath='../../prtests/test8.cc' line='3' column='8'/>
</data-member>
<member-function access='public'>
<function-decl name='operator 1' mangled-name='_ZN1ScvcEv' filepath='../../prtests/test8.cc' line='15' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
<parameter type-id='type-id-3'/>
<return type-id='type-id-1'/>
</function-decl>
</member-function>
<member-function access='public'>
<function-decl name='set' mangled-name='_ZN1S3setEc' filepath='../../prtests/test8.cc' line='21' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
<parameter type-id='type-id-3'/>
<parameter type-id='type-id-1'/>
<return type-id='type-id-4'/>
</function-decl>
</member-function>
</class-decl>
Hash a class declaration the same as its definition A class declaration hashes differently from its definition. Since the abixml format can now use a class element id before defining it, it's more consistent to stop representing class declarations in the abixml format, when the class is actually defined in the corpus. So this patch now hashes a class declaration the same as its definition, when the definition is present. If the definition is not present then the hash value of the declaration is just zero. This is consistent with what is done elsewhere in the code as a hash value of zero means the hash could not be computed, somehow, as the type comparison code knows that a type with hash value zero can be equal to a type with a hash value that is different from zero. As a result, many tests which use the abixml format have been adjusted to reflect the new form of abixml where class declarations are now omitted when these declarations are accompanied with their definition. I made sure that abidiff reports that former abixml output and the new one are equivalent. After this change abixml outputs should contain less redundant type declarations. This is another step toward normalizing the abixml output. * src/abg-hash.cc (class_decl::hash::operator()(const class_decl&)): If the class declaration has a definition, hash its definition instead. Otherwise, if the class declaration has no definition, just return a zero hash, like what we were doing before. * src/abg-reader.cc (read_context::maybe_canonicalize_type): Do not early canonicalize method types because most of the time, when this function is called, the method hasn't been added to its parent class yet. So wait until late before canonicalizing. * src/abg-writer.cc (write_class_is_declaration_only): Do not emit the "is-declaration-only" property if the declaration has a definition. (write_class_decl): If the class declaration has a definition, emit the definition instead. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-write/test18.xml: Likewise. * tests/data/test-read-write/test20.xml: Likewise. * tests/data/test-read-write/test21.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-21 09:22:30 +00:00
<pointer-type-def type-id='type-id-2' size-in-bits='64' alignment-in-bits='64' id='type-id-3'/>
<type-decl name='void' alignment-in-bits='8' id='type-id-4'/>
<typedef-decl name='stype' type-id='type-id-2' filepath='../../prtests/test8.cc' line='26' column='11' id='type-id-5'/>
<reference-type-def kind='lvalue' type-id='type-id-5' size-in-bits='64' alignment-in-bits='64' id='type-id-6'/>
<function-decl name='foo' mangled-name='_Z3fooR1S' filepath='../../prtests/test8.cc' line='29' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
Hash a class declaration the same as its definition A class declaration hashes differently from its definition. Since the abixml format can now use a class element id before defining it, it's more consistent to stop representing class declarations in the abixml format, when the class is actually defined in the corpus. So this patch now hashes a class declaration the same as its definition, when the definition is present. If the definition is not present then the hash value of the declaration is just zero. This is consistent with what is done elsewhere in the code as a hash value of zero means the hash could not be computed, somehow, as the type comparison code knows that a type with hash value zero can be equal to a type with a hash value that is different from zero. As a result, many tests which use the abixml format have been adjusted to reflect the new form of abixml where class declarations are now omitted when these declarations are accompanied with their definition. I made sure that abidiff reports that former abixml output and the new one are equivalent. After this change abixml outputs should contain less redundant type declarations. This is another step toward normalizing the abixml output. * src/abg-hash.cc (class_decl::hash::operator()(const class_decl&)): If the class declaration has a definition, hash its definition instead. Otherwise, if the class declaration has no definition, just return a zero hash, like what we were doing before. * src/abg-reader.cc (read_context::maybe_canonicalize_type): Do not early canonicalize method types because most of the time, when this function is called, the method hasn't been added to its parent class yet. So wait until late before canonicalizing. * src/abg-writer.cc (write_class_is_declaration_only): Do not emit the "is-declaration-only" property if the declaration has a definition. (write_class_decl): If the class declaration has a definition, emit the definition instead. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-write/test18.xml: Likewise. * tests/data/test-read-write/test20.xml: Likewise. * tests/data/test-read-write/test21.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-21 09:22:30 +00:00
<parameter type-id='type-id-6'/>
<return type-id='type-id-1'/>
</function-decl>
</abi-instr>