public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applied] dwarf-reader: properly set artificial-ness in opaque types
@ 2021-04-13 14:54 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2021-04-13 14:54 UTC (permalink / raw)
  To: libabigail

Hello,

get_opaque_version_of_type forgets to set the "is-artificial" property
according to the initial type the opaque type is derived from.  This
can lead to some instability in the abixml output.

Fixed thus.

	* src/abg-dwarf-reader.cc (get_opaque_version_of_type): Propagate
	the artificial-ness of the original type here.
	* tests/data/test-read-dwarf/PR27700/test-PR27700.abi: Adjust.

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

Applied to master.

---
 src/abg-dwarf-reader.cc                             | 2 ++
 tests/data/test-read-dwarf/PR27700/test-PR27700.abi | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 604c76e3..dd9d689c 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -14041,6 +14041,7 @@ get_opaque_version_of_type(read_context	&ctxt,
 					       type_location,
 					       decl_base::VISIBILITY_DEFAULT));
 	  klass->set_is_declaration_only(true);
+	  klass->set_is_artificial(die_is_artificial(type_die));
 	  add_decl_to_scope(klass, scope);
 	  ctxt.associate_die_to_type(type_die, klass, where_offset);
 	  ctxt.maybe_schedule_declaration_only_class_for_resolution(klass);
@@ -14069,6 +14070,7 @@ get_opaque_version_of_type(read_context	&ctxt,
 							    underlying_type,
 							    enumeratorz,
 							    linkage_name));
+	  enum_type->set_is_artificial(die_is_artificial(type_die));
 	  add_decl_to_scope(enum_type, scope);
 	  result = enum_type;
 	}
diff --git a/tests/data/test-read-dwarf/PR27700/test-PR27700.abi b/tests/data/test-read-dwarf/PR27700/test-PR27700.abi
index 5c49e369..02bd9e8e 100644
--- a/tests/data/test-read-dwarf/PR27700/test-PR27700.abi
+++ b/tests/data/test-read-dwarf/PR27700/test-PR27700.abi
@@ -5,7 +5,7 @@
   <abi-instr address-size='64' path='test-PR27700.c' comp-dir-path='/home/dodji/git/libabigail/PR27700/tests/data/test-read-dwarf/PR27700' language='LANG_C11'>
     <type-decl name='unnamed-enum-underlying-type-32' is-anonymous='yes' size-in-bits='32' alignment-in-bits='32' id='9cac1fee'/>
     <type-decl name='void' id='48b5725f'/>
-    <enum-decl name='foo' is-artificial='yes' filepath='include-dir/priv.h' line='1' column='1' id='022218d8'>
+    <enum-decl name='foo' filepath='include-dir/priv.h' line='1' column='1' id='022218d8'>
       <underlying-type type-id='9cac1fee'/>
     </enum-decl>
     <pointer-type-def type-id='022218d8' size-in-bits='64' id='8750e847'/>
-- 
2.30.0


-- 
		Dodji


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

only message in thread, other threads:[~2021-04-13 14:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 14:54 [PATCH, applied] dwarf-reader: properly set artificial-ness in opaque 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).