dwarf-reader: Avoid duplicating union members

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>
This commit is contained in:
Dodji Seketeli 2024-01-12 12:57:24 +01:00
parent a13e387f23
commit 28c17a4239

View File

@ -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);