Message ID | 20230221120230.596966-13-arthur.cohen@embecosm.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1826109wrn; Tue, 21 Feb 2023 04:10:46 -0800 (PST) X-Google-Smtp-Source: AK7set/KislAF5JZDbiLehU0+NYfAL1L7kjFcGb7AQ0BH7p/4fgc8zD0PZjcIZJU/ia766oKtYbr X-Received: by 2002:a17:906:4550:b0:8b1:7ae8:ba6f with SMTP id s16-20020a170906455000b008b17ae8ba6fmr15096387ejq.16.1676981445979; Tue, 21 Feb 2023 04:10:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676981445; cv=none; d=google.com; s=arc-20160816; b=GHZz4vGOax6bcFgTpOdl3bhVEGzZuaoKUGkwMtIlrcSeR0kloV5QWIGZfsXVFJJBU9 AAhnv4PwFZn4uNV37gpCxLDaTcnfhuVEMKc70h9ZzT7giapVnX8NhmUarbmmnliAfu9h fR5VhJ34JBz8TIbWUiLU+Fhzgk10Zb+7y2JzYH2xpKDry6Zyl9jIenroY7qC95NkJh+r x/kg3/zwIq3n41qysFa9ZrVeU2W7JeqV4F4ZxsuzYGzH4AAg6EOXfF10WAGJTAxr00ZJ PwSpanNaB+EnQoFGHXsWah/h+Xx4aj2gOQklEfH/9rzfXfBhJUMDNEpcYVcL4BBoF+9l aH/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dmarc-filter :delivered-to; bh=g35FVS5hWKiVZYjGcvh/C4yA17IWzOjf0SOlF8H+5Y4=; b=XmUGPgDAkrgc8e/EOLlU5pxq3Fzq7XbFl+N/bs5MA/ybDozWS55KLT23C0w1eyJQzX 4bQoh3dOaYkqtfijeERrineHOeckzGjC1Q96IvEMLR3IO6F2hyTwnte33Mn4Ycihiavh g+UOAa1iKEAguivv3O6v+Q9YRprPBcLzNqpIb85lOTLyyTpP3UVC9qQsjOLM8nFBx1e9 /u2fueNNJJt03klUdtsjAcTa60E0A/l66g5xzGJCPrxI8C0sCvwkOvhgkAcMwBbYnXfN zX1Yjl9e9L4n3dMAN8YYfbF+J1BhMMJi9EUdrAqVGsx+OfQDQhf6jQT06h8y9GTh9LXI NH7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=dSGbsPjT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 18-20020a170906209200b008dc4d55dda4si5250867ejq.705.2023.02.21.04.10.45 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:10:45 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=dSGbsPjT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7A63C3947408 for <ouuuleilei@gmail.com>; Tue, 21 Feb 2023 12:05:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id F3B6738493D9 for <gcc-patches@gcc.gnu.org>; Tue, 21 Feb 2023 12:03:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F3B6738493D9 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-wm1-x32d.google.com with SMTP id o4-20020a05600c4fc400b003e1f5f2a29cso3397334wmq.4 for <gcc-patches@gcc.gnu.org>; Tue, 21 Feb 2023 04:03:34 -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=g35FVS5hWKiVZYjGcvh/C4yA17IWzOjf0SOlF8H+5Y4=; b=dSGbsPjT2PqFPw56Xbysha0ndwFCKVqFYxwB/clzG27VLRg476ag72MmYM6pc4qMPA ON2g5T2LclWwIJuJtzQv6dDSjclE52r+s9RPxL5uosNxmn6tMLlrEq+mDMyzZDijs04b Wtef5jtm4Conygfrb+uMMG+r0AH/YLIu4796VtuEJtRH+jaB8sAW724imYRDAaImnWuP XCPv3laNLWG7a5CwfdDmAMJIlkEHnlq3ndAGSZQ2s4yiu/ggLT3VA8nJb4qr3GHXmeep WAeVESgzqwyckWTzGUS8xwd8wgtY86jxkjUQ3GpMIZx3Nc5gvmCGUN8I4K6FRDlLFL7S 6jjw== 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=g35FVS5hWKiVZYjGcvh/C4yA17IWzOjf0SOlF8H+5Y4=; b=IbsWU0C3DjCKze1VnFp43NnJ2Z4m1llPa+4ArO12vLd+Ao0ZVHfv0cl/49NlBHhBZX JyCVrQ2N7G7mbo4q0D+2zP7DHOLtQHtvApiu4B4gai6ijM7tICMFNf/MiEger3r+IvW0 XPfY47KpgJdN/T1XmCQK8ve9fYItqYQFdYcyHfAp661X0t4Qof763SvCKmbFO3oS7aGK FPFDiS5tAb4m+omuQn9vcBRjM3bxcVUsrUkPRj+qmcIE3SFKcwKt1JRsldVKAWWzSkVX ug5NERwFQb37+MS5BsPFiLlELl+jCPhybfO92Zf7861yk4gmASIxgZRB4MbuC/d5N/D6 RnMA== X-Gm-Message-State: AO0yUKUsy4rLMKEZS+7n0tYtXpXPcf7pgvLnuwPpGHC+9n1cz50BlWXS JIbIo5lU8Cy3Ivh11UzDUvudI0ppIkI/FGY0PQ== X-Received: by 2002:a05:600c:2b45:b0:3e0:c5e:ad52 with SMTP id e5-20020a05600c2b4500b003e00c5ead52mr3374671wmf.6.1676981013506; Tue, 21 Feb 2023 04:03:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:03:32 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, David Faust <david.faust@oracle.com> Subject: [committed 012/103] gccrs: ast: dump: add emit_generic_params helper Date: Tue, 21 Feb 2023 13:01:02 +0100 Message-Id: <20230221120230.596966-13-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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.9 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=ham 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758442496379809008?= X-GMAIL-MSGID: =?utf-8?q?1758442496379809008?= |
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: David Faust <david.faust@oracle.com>
gcc/rust/ChangeLog:
* ast/rust-ast-dump.cc (Dump::visit): move generic params dump ...
(Dump::emit_generic_params): ... here.
* ast/rust-ast-dump.h (emit_generic_params): New.
---
gcc/rust/ast/rust-ast-dump.cc | 30 +++++++++++++++++-------------
gcc/rust/ast/rust-ast-dump.h | 3 +++
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index bc4f7a3a5c1..b192556647c 100644 --- a/gcc/rust/ast/rust-ast-dump.cc +++ b/gcc/rust/ast/rust-ast-dump.cc @@ -140,6 +140,22 @@ Dump::emit_indented_string (const std::string &value, return stream << indentation << value << comment; } +void +Dump::emit_generic_params (std::vector<std::unique_ptr<GenericParam>> ¶ms) +{ + stream << "<"; + for (size_t i = 0; i < params.size (); i++) + { + auto ¶m = params.at (i); + param->accept_vis (*this); + + bool has_next = (i + 1) < params.size (); + if (has_next) + stream << ", "; + } + stream << ">"; +} + void Dump::visit (Token &tok) {} @@ -679,19 +695,7 @@ Dump::visit (Function &function) stream << "fn " << function.get_function_name (); if (function.has_generics ()) - { - stream << "<"; - for (size_t i = 0; i < function.get_generic_params ().size (); i++) - { - auto ¶m = function.get_generic_params ().at (i); - param->accept_vis (*this); - - bool has_next = (i + 1) < function.get_generic_params ().size (); - if (has_next) - stream << ", "; - } - stream << ">"; - } + emit_generic_params (function.get_generic_params ()); stream << '('; auto ¶ms = function.get_function_params (); diff --git a/gcc/rust/ast/rust-ast-dump.h b/gcc/rust/ast/rust-ast-dump.h index a5a99f2b03e..1bbefb38454 100644 --- a/gcc/rust/ast/rust-ast-dump.h +++ b/gcc/rust/ast/rust-ast-dump.h @@ -97,6 +97,9 @@ private: std::ostream &emit_indented_string (const std::string &value, const std::string &comment = ""); + // Emit formatted string for generic parameters. + void emit_generic_params (std::vector<std::unique_ptr<GenericParam>> ¶ms); + // rust-ast.h void visit (Token &tok); void visit (DelimTokenTree &delim_tok_tree);