[committed,035/103] gccrs: dump: Dump items within modules

Message ID 20230221120230.596966-36-arthur.cohen@embecosm.com
State Unresolved
Headers
Series [committed,001/103] gccrs: Fix missing dead code analysis ICE on local enum definition |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Arthur Cohen Feb. 21, 2023, 12:01 p.m. UTC
  From: Arthur Cohen <arthur.cohen@embecosm.com>

gcc/rust/ChangeLog:

	* ast/rust-ast-dump.cc (Dump::visit): Dump items in modules properly.
---
 gcc/rust/ast/rust-ast-dump.cc | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index b7557bdee0c..653c1d9ff03 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -809,7 +809,23 @@  Dump::visit (Method &method)
 
 void
 Dump::visit (Module &module)
-{}
+{
+  indentation.increment ();
+
+  stream << indentation;
+  emit_visibility (module.get_visibility ());
+  stream << "mod" << module.get_name () << " {\n";
+
+  for (auto &item : module.get_items ())
+    {
+      stream << indentation;
+      item->accept_vis (*this);
+      stream << '\n';
+    }
+
+  indentation.decrement ();
+  stream << indentation << "}\n";
+}
 
 void
 Dump::visit (ExternCrate &crate)