mirror of
git://sourceware.org/git/libabigail.git
synced 2025-03-06 14:47:32 +00:00
Skip artificial (member) functions from DWARF
* src/abg-dwarf-reader.cc (die_is_artificial): New static function. (build_class_type_and_add_to_ir, build_ir_node_from_die): Use the die_is_artificial function to test if the function DIE is artificial and then skip it. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
6c34ffd67e
commit
5ff3176ad1
@ -649,6 +649,17 @@ is_declaration_only(Dwarf_Die* die)
|
||||
return is_declaration_only;
|
||||
}
|
||||
|
||||
/// Tests whether a given DIE is artificial.
|
||||
///
|
||||
/// @param die the test to test for.
|
||||
///
|
||||
/// @return true if the DIE is artificial, false otherwise.
|
||||
static bool
|
||||
die_is_artificial(Dwarf_Die* die)
|
||||
{
|
||||
bool is_artificial;
|
||||
return die_flag_attribute(die, DW_AT_artificial, is_artificial);
|
||||
}
|
||||
|
||||
///@return true if a tag represents a type, false otherwise.
|
||||
///
|
||||
@ -2325,6 +2336,14 @@ build_class_type_and_add_to_ir(read_context& ctxt,
|
||||
// Handle member functions;
|
||||
else if (tag == DW_TAG_subprogram)
|
||||
{
|
||||
if (die_is_artificial(&child))
|
||||
// For now, let's not consider artificial functions.
|
||||
// To consider them, we'd need to make the IR now
|
||||
// about artificial functions and the
|
||||
// (de)serialization and comparison machineries to
|
||||
// know how to cope with these.
|
||||
continue;
|
||||
|
||||
function_decl_sptr f =
|
||||
build_function_decl(ctxt, &child, called_from_public_decl);
|
||||
if (!f)
|
||||
@ -3054,7 +3073,8 @@ build_ir_node_from_die(read_context& ctxt,
|
||||
{
|
||||
Dwarf_Die spec_die;
|
||||
scope_decl_sptr scop;
|
||||
if (!is_public_decl(die))
|
||||
if (!die_is_public_decl(die)
|
||||
|| die_is_artificial(die))
|
||||
break;
|
||||
|
||||
if (die_die_attribute(die, DW_AT_specification, spec_die))
|
||||
|
@ -1,92 +1,71 @@
|
||||
<abi-corpus path='data/test-read-dwarf/test1'>
|
||||
<abi-instr version='1.0' address-size='64' path='test1.cc'>
|
||||
<class-decl name='b0' visibility='default' is-declaration-only='yes' id='type-id-1'/>
|
||||
<class-decl name='b0' size-in-bits='128' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='1' column='1' def-of-decl-id='type-id-1' id='type-id-2'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='m0' type-id='type-id-3' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='3' column='1'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='m1' type-id='type-id-4' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='4' column='1'/>
|
||||
</data-member>
|
||||
<member-function access='public' constructor='yes'>
|
||||
<function-decl name='b0' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='64'>
|
||||
<parameter type-id='type-id-5' is-artificial='yes'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
</class-decl>
|
||||
<type-decl name='long long int' size-in-bits='64' alignment-in-bits='64' id='type-id-3'/>
|
||||
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-4'/>
|
||||
<pointer-type-def type-id='type-id-1' size-in-bits='64' alignment-in-bits='64' id='type-id-5'/>
|
||||
<class-decl name='b1' visibility='default' is-declaration-only='yes' id='type-id-6'/>
|
||||
<class-decl name='b1' size-in-bits='128' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='7' column='1' def-of-decl-id='type-id-6' id='type-id-7'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='m0' type-id='type-id-8' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='9' column='1'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='m1' type-id='type-id-4' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='10' column='1'/>
|
||||
</data-member>
|
||||
<member-function access='public' constructor='yes'>
|
||||
<function-decl name='b1' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='64'>
|
||||
<parameter type-id='type-id-9' is-artificial='yes'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
</class-decl>
|
||||
<type-decl name='double' size-in-bits='64' alignment-in-bits='64' id='type-id-8'/>
|
||||
<pointer-type-def type-id='type-id-6' size-in-bits='64' alignment-in-bits='64' id='type-id-9'/>
|
||||
<class-decl name='s0' visibility='default' is-declaration-only='yes' id='type-id-10'/>
|
||||
<class-decl name='s0' size-in-bits='384' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='13' column='1' def-of-decl-id='type-id-10' id='type-id-11'>
|
||||
<base-class access='public' layout-offset-in-bits='24' is-virtual='yes' type-id='type-id-2'/>
|
||||
<base-class access='public' layout-offset-in-bits='32' is-virtual='yes' type-id='type-id-7'/>
|
||||
<class-decl name='s0' visibility='default' is-declaration-only='yes' id='type-id-1'/>
|
||||
<class-decl name='s0' size-in-bits='384' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='13' column='1' def-of-decl-id='type-id-1' id='type-id-2'>
|
||||
<base-class access='public' layout-offset-in-bits='24' is-virtual='yes' type-id='type-id-3'/>
|
||||
<base-class access='public' layout-offset-in-bits='32' is-virtual='yes' type-id='type-id-4'/>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='integer' type-id='type-id-13' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='15' column='1' id='type-id-12'/>
|
||||
<typedef-decl name='integer' type-id='type-id-6' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='15' column='1' id='type-id-5'/>
|
||||
</member-type>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='byte' type-id='type-id-15' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='16' column='1' id='type-id-14'/>
|
||||
<typedef-decl name='byte' type-id='type-id-8' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='16' column='1' id='type-id-7'/>
|
||||
</member-type>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='m0' type-id='type-id-12' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='18' column='1'/>
|
||||
<var-decl name='m0' type-id='type-id-5' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='18' column='1'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='96'>
|
||||
<var-decl name='m1' type-id='type-id-14' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='19' column='1'/>
|
||||
<var-decl name='m1' type-id='type-id-7' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='19' column='1'/>
|
||||
</data-member>
|
||||
<member-function access='public' constructor='yes'>
|
||||
<function-decl name='s0' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='64'>
|
||||
<parameter type-id='type-id-16' is-artificial='yes'/>
|
||||
<parameter type-id='type-id-13' is-artificial='yes'/>
|
||||
<parameter type-id='type-id-17'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' constructor='yes'>
|
||||
<function-decl name='s0' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='21' column='1' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='64'>
|
||||
<parameter type-id='type-id-16' is-artificial='yes'/>
|
||||
<parameter type-id='type-id-13' is-artificial='yes'/>
|
||||
<parameter type-id='type-id-9' is-artificial='yes'/>
|
||||
<parameter type-id='type-id-6' is-artificial='yes'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' destructor='yes'>
|
||||
<function-decl name='~s0' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='27' column='1' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='64'>
|
||||
<parameter type-id='type-id-16' is-artificial='yes'/>
|
||||
<parameter type-id='type-id-13' is-artificial='yes'/>
|
||||
<parameter type-id='type-id-9' is-artificial='yes'/>
|
||||
<parameter type-id='type-id-6' is-artificial='yes'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public'>
|
||||
<function-decl name='mem_fun' mangled-name='_ZN2s07mem_funEv' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='36' column='1' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='64'>
|
||||
<parameter type-id='type-id-16' is-artificial='yes'/>
|
||||
<return type-id='type-id-12'/>
|
||||
<parameter type-id='type-id-9' is-artificial='yes'/>
|
||||
<return type-id='type-id-5'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
</class-decl>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-13'/>
|
||||
<type-decl name='unsigned char' size-in-bits='8' alignment-in-bits='8' id='type-id-15'/>
|
||||
<pointer-type-def type-id='type-id-10' size-in-bits='64' alignment-in-bits='64' id='type-id-16'/>
|
||||
<qualified-type-def type-id='type-id-10' const='yes' id='type-id-18'/>
|
||||
<reference-type-def kind='lvalue' type-id='type-id-18' size-in-bits='64' alignment-in-bits='64' id='type-id-17'/>
|
||||
<reference-type-def kind='lvalue' type-id='type-id-11' size-in-bits='64' alignment-in-bits='64' id='type-id-19'/>
|
||||
<qualified-type-def type-id='type-id-19' const='yes' id='type-id-20'/>
|
||||
<class-decl name='b0' visibility='default' is-declaration-only='yes' id='type-id-10'/>
|
||||
<class-decl name='b0' size-in-bits='128' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='1' column='1' def-of-decl-id='type-id-10' id='type-id-3'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='m0' type-id='type-id-11' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='3' column='1'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='m1' type-id='type-id-12' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='4' column='1'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<type-decl name='long long int' size-in-bits='64' alignment-in-bits='64' id='type-id-11'/>
|
||||
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-12'/>
|
||||
<class-decl name='b1' visibility='default' is-declaration-only='yes' id='type-id-13'/>
|
||||
<class-decl name='b1' size-in-bits='128' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='7' column='1' def-of-decl-id='type-id-13' id='type-id-4'>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='m0' type-id='type-id-14' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='9' column='1'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='m1' type-id='type-id-12' visibility='default' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='10' column='1'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<type-decl name='double' size-in-bits='64' alignment-in-bits='64' id='type-id-14'/>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-6'/>
|
||||
<type-decl name='unsigned char' size-in-bits='8' alignment-in-bits='8' id='type-id-8'/>
|
||||
<pointer-type-def type-id='type-id-1' size-in-bits='64' alignment-in-bits='64' id='type-id-9'/>
|
||||
<reference-type-def kind='lvalue' type-id='type-id-2' size-in-bits='64' alignment-in-bits='64' id='type-id-15'/>
|
||||
<qualified-type-def type-id='type-id-15' const='yes' id='type-id-16'/>
|
||||
<function-decl name='foo' mangled-name='_Z3fooR2s0' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='42' column='1' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='64'>
|
||||
<parameter type-id='type-id-20' name='s' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='42' column='1'/>
|
||||
<parameter type-id='type-id-16' name='s' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='42' column='1'/>
|
||||
</function-decl>
|
||||
<function-decl name='main' filepath='/home/dodji/git/libabigail/dwarf/tests/data/test-read-dwarf/test1.cc' line='48' column='1' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='64'>
|
||||
<return type-id='type-id-13'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</abi-instr>
|
||||
</abi-corpus>
|
||||
|
Loading…
Reference in New Issue
Block a user