diff mbox series

[applied] dwarf-reader: properly set artificial-ness in opaque types

Message ID 87sg3utetu.fsf@redhat.com
State New
Headers show
Series [applied] dwarf-reader: properly set artificial-ness in opaque types | expand

Commit Message

Dodji Seketeli April 13, 2021, 2:54 p.m. UTC
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 mbox series

Patch

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'/>