Bug PR29443 - Global variables not emitted to abixml in some cases
When a global variable named V has the same name as member variable
that appears in an anonymous scope and if the the abixml writer emits
the member variable V first, it gets confused when comes the time to
emit the global V as it wrongly thinks it's been already emitted.
This is because when emitting the "internal" pretty representation of
the member variable, libabigail fails to consider printing a qualified
name. So the two 'V' wrongly have names that can't be told apart.
For instance consider the testcase example:
struct A {
struct {
int xx; // #0
};
};
The qualified name of xx, for internal purposes (to name things
internally for the purpose of book keeping) would be:
'A::__anonymous_struct__::xx'.
Libabigail wrongly names it 'xx', hence the confusion with the global variable.
Fixed thus.
* src/abg-ir.cc (var_decl::get_pretty_representation): Always use
qualified name of vars in an anonymous scope for internal
purposes.
* tests/data/test-annotate/PR29443-missing-xx.o.annotated.abi: New
reference test output.
* tests/test-annotate.cc (in_out_specs): Add the above to the test
harness.
* tests/data/test-read-dwarf/PR29443-missing-xx.cc: New source
code for the test.
* tests/data/test-read-dwarf/PR29443-missing-xx.o: New test input
binary.
* tests/data/test-read-dwarf/PR29443-missing-xx.o.abi: New test
reference output.
* tests/data/Makefile.am: Add the new test material to source
distribution.
* tests/test-read-dwarf.cc (in_out_specs): Add the above to the
test harness.