public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applied] dwarf-reader,ir: Improve detection of method types & implicit parms
@ 2024-05-06 16:44 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2024-05-06 16:44 UTC (permalink / raw)
  To: libabigail

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

Hello,

There is a confusion in the DWARF reader about static member functions
and non-static member functions.  With recent versions of DWARF, a
member function with the DW_AT_object_pointer attribute is known to
have a this-pointer and thus designates a non-static member function.
DWARF emitted by gcc 4.4.x and previous compilers didn't emit the
DW_AT_object_pointer so we need to look at the first parameter of the
member function, make sure it's artificial and points to a pointer
to the same class as the class of the current member function.

This patch avoids confusing static and non-static member functions by
telling apart types of static member functions, non-static member
functions and non member functions. This fixes the representation of
several method types and function declaration signatures across the
test suite.

	* include/abg-ir.h (method_type::get_is_for_static_method): Add
	new method.
	* src/abg-dwarf-reader.cc (fn_die_first_parameter_die)
	(member_fn_die_has_this_pointer, die_peel_typedef): Define new
	static functions.
	(die_this_pointer_is_const): Make this support DIEs representing
	const pointers.
	(die_function_type_is_method_type): Use the new
	member_fn_die_has_this_pointer function rather than (wrongly) open
	coding its functionality.  If the (member) function DIE has no
	this pointer DIE and if the function is at class scope, then we
	are looking a static member function.
	(finish_member_function_reading): Use the new
	method::get_is_for_static_method method rather than open-coding
	its functionality.
	* src/abg-ir.cc (method_type::get_is_for_static_method): Define
	new method.
	(type_topo_comp::operator()): In this comparison
	operator for types, if two method types have the same string
	representation then if one method type is for a static method,
	then make the non-static method type come first.
	(function_type::get_first_non_implicit_parm): The first parameter
	of a function can only carry the "this pointer" if it's
	artificial.
	* tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-1.txt:
	Adjust.
	* tests/data/test-abidiff/test-struct1-report.txt: Likewise.
	* tests/data/test-abidiff/test-struct1-v0.cc.bi: Likewise.
	* tests/data/test-abidiff/test-struct1-v1.cc.bi: Likewise.
	* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi:
	Likewise.
	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
	Likewise.
	* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
	Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt:
	Likewise.
	* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
	* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to the master branch.
---
 include/abg-ir.h                              |    2 +
 src/abg-dwarf-reader.cc                       |  283 +-
 src/abg-ir.cc                                 |   48 +-
 .../reported/PR31513-reported-report-1.txt    |   18 +-
 .../data/test-abidiff/test-struct1-report.txt |    2 +-
 tests/data/test-abidiff/test-struct1-v0.cc.bi |    6 +-
 tests/data/test-abidiff/test-struct1-v1.cc.bi |   10 +-
 .../data/test-annotate/test14-pr18893.so.abi  |    8 +-
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi |   30 +-
 ...19-pr19023-libtcmalloc_and_profiler.so.abi |    2 +-
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi |   44 +-
 .../PR25409-librte_bus_dpaa.so.20.0.abi       |   85 +-
 .../test0-pr19026-libvtkIOSQL-6.1.so.1.abi    | 7924 ++++++++++-------
 .../test42-PR21296-clanggcc-report0.txt       |    8 +-
 .../test30-pr18904-rvalueref-report0.txt      |  260 +-
 .../test30-pr18904-rvalueref-report1.txt      |  260 +-
 .../test30-pr18904-rvalueref-report2.txt      |  260 +-
 .../test35-pr18754-no-added-syms-report-0.txt |    2 +-
 .../test35-pr18754-no-added-syms-report-1.txt |    2 +-
 .../data/test-diff-filter/test41-report-0.txt |    9 +-
 .../PR22015-libboost_iostreams.so.abi         |   32 +-
 .../test-read-dwarf/PR22122-libftdc.so.abi    |    6 +-
 .../test-read-dwarf/test-libandroid.so.abi    |   72 +-
 .../test-read-dwarf/test11-pr18828.so.abi     |   12 +-
 .../test-read-dwarf/test12-pr18844.so.abi     | 6371 +++++++------
 .../test-read-dwarf/test14-pr18893.so.abi     |    2 +-
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi |   30 +-
 ...19-pr19023-libtcmalloc_and_profiler.so.abi |    2 +-
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi |   44 +-
 .../test9-pr18818-clang.so.abi                |  144 +-
 30 files changed, 8963 insertions(+), 7015 deletions(-)

The patch is rather big so I am attaching it gzipped.



[-- Attachment #2: 0002-dwarf-reader-ir-Improve-detection-of-method-types-im.patch.gz --]
[-- Type: application/gzip, Size: 208268 bytes --]

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



-- 
		Dodji

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

only message in thread, other threads:[~2024-05-06 16:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06 16:44 [PATCH, applied] dwarf-reader,ir: Improve detection of method types & implicit parms 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).