mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-18 16:04:34 +00:00
ddb17eddba
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:#️⃣: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>
47 lines
3.0 KiB
XML
47 lines
3.0 KiB
XML
<abi-instr version='1.0' path='data/test-read-write/test21.xml'>
|
|
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
|
<class-decl name='S' size-in-bits='32' alignment-in-bits='32' visibility='default' filepath='simple-class-0.C' line='5' column='8' id='type-id-2'>
|
|
<member-type access='public'>
|
|
<typedef-decl name='S' type-id='type-id-2' filepath='simple-class-0.C' line='6' column='1' id='type-id-3'/>
|
|
</member-type>
|
|
<data-member access='public' layout-offset-in-bits='0'>
|
|
<var-decl name='m' type-id='type-id-1' visibility='default' filepath='simple-class-0.C' line='7' column='7'/>
|
|
</data-member>
|
|
<member-function access='public' constructor='yes'>
|
|
<function-decl name='__base_ctor ' mangled-name='_ZN1SC2Ev' filepath='simple-class-0.C' line='13' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
|
<parameter type-id='type-id-4'/>
|
|
<return type-id='type-id-5'/>
|
|
</function-decl>
|
|
</member-function>
|
|
<member-function access='public' constructor='yes'>
|
|
<function-decl name='__comp_ctor ' mangled-name='_ZN1SC1Ev' filepath='simple-class-0.C' line='13' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
|
<parameter type-id='type-id-4'/>
|
|
<return type-id='type-id-5'/>
|
|
</function-decl>
|
|
</member-function>
|
|
<member-function access='public' constructor='yes'>
|
|
<function-decl name='__base_ctor ' mangled-name='_ZN1SC2ERKS_' filepath='simple-class-0.C' line='18' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
|
<parameter type-id='type-id-4'/>
|
|
<parameter type-id='type-id-6'/>
|
|
<return type-id='type-id-5'/>
|
|
</function-decl>
|
|
</member-function>
|
|
<member-function access='public' constructor='yes'>
|
|
<function-decl name='__comp_ctor ' mangled-name='_ZN1SC1ERKS_' filepath='simple-class-0.C' line='18' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
|
<parameter type-id='type-id-4'/>
|
|
<parameter type-id='type-id-6'/>
|
|
<return type-id='type-id-5'/>
|
|
</function-decl>
|
|
</member-function>
|
|
</class-decl>
|
|
<pointer-type-def type-id='type-id-2' size-in-bits='64' alignment-in-bits='64' id='type-id-4'/>
|
|
<type-decl name='void' alignment-in-bits='8' id='type-id-5'/>
|
|
<qualified-type-def type-id='type-id-2' const='yes' filepath='simple-class-0.C' line='5' column='8' id='type-id-7'/>
|
|
<reference-type-def kind='lvalue' type-id='type-id-7' size-in-bits='64' alignment-in-bits='64' id='type-id-6'/>
|
|
<reference-type-def kind='lvalue' type-id='type-id-2' size-in-bits='64' alignment-in-bits='64' id='type-id-8'/>
|
|
<function-decl name='foo' mangled-name='_Z3fooR1S' filepath='simple-class-0.C' line='24' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
|
<parameter type-id='type-id-8'/>
|
|
<return type-id='type-id-5'/>
|
|
</function-decl>
|
|
</abi-instr>
|