From patchwork Tue Feb 21 12:01:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1745560 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=e6VlhmSF; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PLdTV0xfqz240n for ; Tue, 21 Feb 2023 23:12:46 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 427B5394652A for ; Tue, 21 Feb 2023 12:11:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 710CD3844053 for ; Tue, 21 Feb 2023 12:03:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 710CD3844053 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42c.google.com with SMTP id bo30so3602097wrb.0 for ; Tue, 21 Feb 2023 04:03:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=9RyVPYw0UdE+p1GAb/kq+6qEzPD+D/YtLlfHnIbSjfM=; b=e6VlhmSFgbmr9Pph0bEOM+I91XvRYENqKsqyDd77rEiEtpTjkfbFpJTuRmrCRuXgxQ 4/48aQoXSweUVcGCMvCNz9BL/cc9tF5MzullJ5u3e2K0ckMFugjIvuQTr2gmiNBnVepC Gkb0GyioEp6V3F9ZIp+QFzHQ/FTC4jtP9JeiP9UWcVw9twsYBBPD0nzuGG5RzLkHjxV6 anJqAGK4z4OMQOiq+A7udWacMScGdTn8p3FP8+O211gwi1DmGZrZ4JCGX2D9tbOCduYO VZWTsEqnxXmwlEe3wGYp7xg2DKrj8oB3j7fgZz2MsOMr12kovn6b+qC9ON+wEJGe9C+I IRBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9RyVPYw0UdE+p1GAb/kq+6qEzPD+D/YtLlfHnIbSjfM=; b=Yn7+uVGm+x70XPsyigHJdRX2nsN7thB520cg/EyWqEfNXRZdf2f1X9I0hE2l/YZdYQ pdxsw0dwcyzsN5Nc4SvYIhh9KdEQuJ8Imck9nSW0fzSNSPVY+RQvO9GBn7Bn298vG5li vCs8GvZrZ/94bZsXAiPBc/wDIsr/MsJ7p7W8gt0Rxb6ZdVYy4jM8HOeVmbk8eU67kFgu /zQHH0Hi6GUXA9UP9BTfsRdFaqBdVJES1mMwjeKo0W+IlJraegBw+Ue67lw9MW8mvH/u CQ/z7wCtfELl9SDwNSOXoBveLlsFi7K1+31hft/ih70GdbbOzjCcPKhanutOvADSjbkW aaoA== X-Gm-Message-State: AO0yUKUw77X7Szgh0pEDzFXiBlSQaE6QEoMpK0kLaAdO0UeX6ldF2O5O oB5Zdne9vnViyrrV7gXdTf9Un1q2oD0+/cvYiA== X-Google-Smtp-Source: AK7set+NaWJ6PvybCcNGsESG+US13YDut9Z24c3Q1b5V3u8wYBWjE446ul8SEAy1VUvr3W6/OUBRzw== X-Received: by 2002:adf:f108:0:b0:2c5:561e:809b with SMTP id r8-20020adff108000000b002c5561e809bmr4365668wro.66.1676981030809; Tue, 21 Feb 2023 04:03:50 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id c15-20020adffb4f000000b002c55b0e6ef1sm5013811wrs.4.2023.02.21.04.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:03:50 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen Subject: [committed 035/103] gccrs: dump: Dump items within modules Date: Tue, 21 Feb 2023 13:01:25 +0100 Message-Id: <20230221120230.596966-36-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230221120230.596966-1-arthur.cohen@embecosm.com> References: <20230221120230.596966-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Arthur Cohen 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(-) 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)