public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] Bug PR26739 - Handle qualified typedef array types
@ 2020-11-09 10:13 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2020-11-09 10:13 UTC (permalink / raw)
  To: libabigail

[-- Attachment #1: Type: text/plain, Size: 4826 bytes --]

[I am reposting this as it seems it didn't reach the mailing list last
time]

Hello Giuliano,

After your spot-on comment about maybe_strip_qualification editing type
IR nodes that might be shared, I am following up with this updated
version of the patch.  It's a little bit more involved, but I hope it
addresses the main concern of editing shared type nodes.  Thanks for the
first round of review!

CV-qualifiers of a typedef of an array type apply to the elements of
the array.  So this can be transformed into a typedef of array type
which element type is similarly CV-qualified.

That transformation helps avoiding spurious changes that might occur
when comparing the latter form against the former even though both are
equivalent.

This patch performs that transformation, just like we already do for
CV-qualified array types which are transformed into an array of
similarly CV-qualified elements.

Performing that transformation amounts to editing the type of the
array elements.  As those types might be used by other parts of the
type graph (type node sharing), the patch "clones" the type sub-tree
of interest and edits the cloned version.  That way, the shared type
nodes are not edited.  It appears that in the existing version of
maybe_strip_qualification, the transformation of CV-qualified arrays
into arrays of CV-qualified elements was unfortunately editing shared
type nodes.  The patch fixes that and re-works the logic of*
maybe_strip_qualification to make it handle this new case and the
previous one in a somewhat generic manner.

	* include/abg-fwd.h (is_typedef_of_array, clone_array)
	(clone_typedef, clone_qualified_type, clone_array_tree): Declare
	new functions.
	(peel_qualified_or_typedef_type): Declare new overload.
	(is_array_of_qualified_element): Constify the parameter.
	* include/abg-ir.h ({qualified_type,
	typedef}_def::set_underlying_type): Add new member functions.
	(array_type_def::subrange_type::subrange_type): Make constify the
	reference to the underlying type parameter.
	* src/abg-ir.cc (is_array_of_qualified_element): Constify the
	parameter.
	(peel_qualified_or_typedef_type): Define new
	overload for type_base_sptr.
	(clone_typedef_array_qualified_type): Define static function.
	(clone_array clone_typedef, clone_qualified_type)
	(clone_array_tree, is_typedef_of_array): Define new functions.
	(qualified_type_def::get_underlying_type): Rename the return type
	shared_ptr<type_base> into type_base_sptr.
	({typedef, qualified_type}_def::set_underlying_type): Define new
	member function.
	(array_type_def::subrange_type::priv::priv): Initialize the
	'infinite_' data member.
	* src/abg-dwarf-reader.cc (maybe_strip_qualification): Handle
	qualified typedef of arrays.  Merge this with the handling of
	qualified arrays.  Note that before editing the elements of the
	array to make the array (or typedef) qualifier apply to the
	element the sub-tree is cloned to make its type nodes be
	'un-shared'.  This prevents us from editing type nodes that are
	shared by other type expressions.
	* tests/data/test-diff-filter/test-PR26739-report-0.txt: New
	reference test output.
	* tests/data/test-diff-filter/test-PR26739-2-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test-PR26739-v{0,1}.c: Source code
	of new binary test input.
	* tests/data/test-diff-filter/test-PR26739-2-v{0,1}.c: Likewise.
	* tests/data/test-diff-filter/test-PR26739-v{0,1}.o: New binary
	test inputs.
	* tests/data/test-diff-filter/test-PR26739-2-v{0,1}.o: Likewise.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-filter.cc (in_out_specs): Add the test inputs
	above to this harness.
	* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
	* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

The patch itself is super big, so it's gzip'ed here.

You can browse it only from the git repository at
https://sourceware.org/git/?p=libabigail.git;a=commit;h=41de17ce91ec3c657490022dbbcd22f8c57acbf3.
It's in the dodji/PR26739 branch of the git repository, at https://sourceware.org/git/?p=libabigail.git;a=shortlog;h=refs/heads/dodji/PR26739.



[-- Attachment #2: Patch compressed with gzip --]
[-- Type: application/gzip, Size: 1150960 bytes --]

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
		Dodji

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-09 10:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09 10:13 [PATCH v2] Bug PR26739 - Handle qualified typedef array types Dodji Seketeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).