public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applying to mainline] dwarf-reader: Avoid duplicating union members
@ 2024-02-12 21:24 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2024-02-12 21:24 UTC (permalink / raw)
  To: libabigail

Hello,

The DWARF from some C++ binaries represents unions in a "piece wise"
fashion.  When dealing with those unions, we need to avoid adding the
same member twice, just like what we do for classes.

	* src/abg-dwarf-reader.cc (add_or_update_union_type): Do not add
	an union member that already exists in the union.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applying to the master branch.
---
 src/abg-dwarf-reader.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 735f0342..8c624d48 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -13582,6 +13582,9 @@ add_or_update_union_type(reader&	 rdr,
 	      if (n.empty() && result->find_data_member(dm))
 		continue;
 
+	      if (!n.empty() && lookup_var_decl_in_scope(n, result))
+		continue;
+
 	      result->add_data_member(dm, access, /*is_laid_out=*/true,
 				      /*is_static=*/false,
 				      offset_in_bits);
-- 
2.39.3


-- 
		Dodji


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

only message in thread, other threads:[~2024-02-12 21:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 21:24 [PATCH, applying to mainline] dwarf-reader: Avoid duplicating union members 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).