diff mbox series

[5/5] XML writer: resolve declaration-only enum definitions

Message ID 20211203114622.2944173-6-maennich@google.com
State New
Headers show
Series Improvements for the XML Writer | expand

Commit Message

Matthias Maennich Dec. 3, 2021, 11:46 a.m. UTC
Let the writer look through declaration-only enums for definitions.

This matches what get_preferred_type, write_class_decl and
write_union_decl do. No current test cases are affected.

	* src/abg-writer.cc (write_enum_type_decl): Look through
	declaration-only types the same as for structs and unions.

Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
---
 src/abg-writer.cc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Dodji Seketeli Jan. 19, 2022, 10:38 a.m. UTC | #1
Matthias Maennich <maennich@google.com> a écrit:

> Let the writer look through declaration-only enums for definitions.
>
> This matches what get_preferred_type, write_class_decl and
> write_union_decl do. No current test cases are affected.
>
> 	* src/abg-writer.cc (write_enum_type_decl): Look through
> 	declaration-only types the same as for structs and unions.
>
> Reviewed-by: Giuliano Procida <gprocida@google.com>
> Signed-off-by: Matthias Maennich <maennich@google.com>

Applied to master, thanks!

[...]

Cheers,
diff mbox series

Patch

diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index 76e60eb92347..31667bf7ccea 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -3020,14 +3020,16 @@  write_array_type_def(const array_type_def_sptr& decl,
 ///
 /// @return true upon succesful completion, false otherwise.
 static bool
-write_enum_type_decl(const enum_type_decl_sptr& decl,
-		     const string&		id,
-		     write_context&		ctxt,
-		     unsigned			indent)
+write_enum_type_decl(const enum_type_decl_sptr& d,
+		     const string& id,
+		     write_context& ctxt,
+		     unsigned indent)
 {
-  if (!decl)
+  if (!d)
     return false;
 
+  enum_type_decl_sptr decl = is_enum_type(look_through_decl_only_enum(d));
+
   annotate(decl->get_canonical_type(), ctxt, indent);
 
   ostream& o = ctxt.get_ostream();