Message ID | 20230221120230.596966-18-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 s9csp1830160wrn; Tue, 21 Feb 2023 04:20:34 -0800 (PST) X-Google-Smtp-Source: AK7set+zjbVdfUOcwOxPviCkxVMQmDUGXdpAKK1x5D69Re4HqxYaYreBVxM8n6WwdObTQDl1jS69 X-Received: by 2002:a17:907:80e:b0:7c1:6e08:4c20 with SMTP id wv14-20020a170907080e00b007c16e084c20mr18088223ejb.7.1676982034838; Tue, 21 Feb 2023 04:20:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676982034; cv=none; d=google.com; s=arc-20160816; b=UgmLCbS4fKxst6Us5UfSmc75/hBXXIOmjK3mvnC6QG2Hfsw/h184xkSPx9YmCaFBwy 3+vMeBT4tJnS23EqEzBC33i2ut950Nj4FpN6nOrYZom5h/CX0qVayoeEKmSGudkDhtda ijd5APP2IKJGkgKyYZUDLm8a+mlh1PTwzsqx07oU5iM078GjxPjKdywIYNUj34eMJj4r mGRkts7ksxxtc8wqP256GIK03tcxXAqkiM21SXYWVSORtbHXOfZt1DhvqieyEIjxGNk7 I2Js9uvbxurLduWlScxyobo9pUJ9V5iUbLiSaka3tv6ioMfVLjTkJYBJGY9CEj7bJBkK sMMg== 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=XCfXLfwt/nylHF8oGosbCMkCQaynuY55Hg6q7BdHAtQ=; b=kzjykcDUTW43BCaEklHq9gIOR28zQktROrA/1An2mWVl6kiXJbgSnTV9eMY0v1LbJN dWNlpiK/uQ/V4JQkPLiyUxXf/nrFJBPaXKr4qvj1vz4BEQRdbI60b2stB0vrPXsTaJHg 1tVlVlSQFfNRsYwcfrSx2IO8s4ksfBOdL3Gin2Ad6qI9z8CyuAQpGAv1Dz70vU2xOWTr RjQ/jdZYfGsKWDeijFegSkraiu+MUFKbSvscRZKATuLjezZA9FWRrmVGj5GwUbaceQzQ XGwE6gpI3Ud3fUh1jDtEb0VLCVyUwpApmKqoflOs6XiTbJ64zclu+mulaG7jVrVj3nHe SR4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=W4alW4nW; 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 j19-20020a170906105300b008b14fa7ded2si22982576ejj.777.2023.02.21.04.20.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:20:34 -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=W4alW4nW; 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 164D93898382 for <ouuuleilei@gmail.com>; Tue, 21 Feb 2023 12:08:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id CA4963844745 for <gcc-patches@gcc.gnu.org>; Tue, 21 Feb 2023 12:03:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA4963844745 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-x330.google.com with SMTP id bg37-20020a05600c3ca500b003e21e018039so4144924wmb.3 for <gcc-patches@gcc.gnu.org>; Tue, 21 Feb 2023 04:03:38 -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=XCfXLfwt/nylHF8oGosbCMkCQaynuY55Hg6q7BdHAtQ=; b=W4alW4nWD/WY6ergH1LirkWHZ1gP8frNyi0ensu0fSuLyJkTFE/BLetZmVSQFst866 ZlQB1jWtYCPENDwa+Zhr2Yj7N3UKhMSyAFDuyiXEeXdafX/kmlRWXmIgxfsQBq7B7f44 BT44e1s9X2oOtMDH9Pox3rE4pYNMsD3Wb/YV1AWJknCYJFqFV+jaqVgKCL/4pVULPaUq 6bvaPpWXpCY1zz45arVNcqappNJdqtIS8bjQykr/hmBIAbxJy8nzMaFig0h0ZPRa4uLa 126avKt58hW+imWa+5Voo6khG8/RdBaGLN8yFqNddbihWx8IF5rJJjJr/WFdysRTWkks O0vw== 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=XCfXLfwt/nylHF8oGosbCMkCQaynuY55Hg6q7BdHAtQ=; b=Umfvq/Z1xMbBM3suK98YKtW1zk+mJz6YeEp3Gsalrc7KsuWjb/OA5WuHCTD2SixKhr oIC7/9KyXngibiYLRPK/XjnDdQRjXb7lX96BNvf6TkSiRQZn+8cIom5yt0nMprW6+Rm5 3ZenYzOa4RsgYqIjYS4hA16iDFQns9E8z/H4e2ZKyNMb+OKF1GcjaLnvzWj4DwsrKVSc XyJKNAxD0Nnb8W8Nq+pUDWacvNSy8HmWdBUmbQM2ET8tUV/bPjyD25WEegU4BldEWH3q oUI3R89MPmlO/ipJI3G8SgtmiW/JVppLEv7YlmgfK+2kOADQaZAGHdteR9EaydtWhBkf QEkQ== X-Gm-Message-State: AO0yUKUqBuVBcevguSjYgBoLHXgcpPFvGW70I3l6ij5S2ut8IImEk4+G umcqi/8ZsQPBPQVgqqitviDHNLgvJtYGov8wcg== X-Received: by 2002:a05:600c:2ed3:b0:3dc:2137:d67d with SMTP id q19-20020a05600c2ed300b003dc2137d67dmr3316082wmn.16.1676981017313; Tue, 21 Feb 2023 04:03:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:03:36 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen <arthur.cohen@embecosm.com> Subject: [committed 017/103] gccrs: mappings: Add MacroInvocation -> MacroRulesDef mappings Date: Tue, 21 Feb 2023 13:01:07 +0100 Message-Id: <20230221120230.596966-18-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?1758443113823565873?= X-GMAIL-MSGID: =?utf-8?q?1758443113823565873?= |
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:
* util/rust-hir-map.h: Add new mappings.
* util/rust-hir-map.cc (Mappings::insert_macro_invocation): Add insertion
function into mappings.
(Mappings::lookup_macro_invocation): Add lookup function for mappings.
---
gcc/rust/util/rust-hir-map.cc | 22 ++++++++++++++++++++++
gcc/rust/util/rust-hir-map.h | 6 ++++++
2 files changed, 28 insertions(+)
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index 80434489fcd..7ea782ed4c4 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -866,6 +866,28 @@ Mappings::lookup_macro_def (NodeId id, AST::MacroRulesDefinition **def) return true; } +void +Mappings::insert_macro_invocation (AST::MacroInvocation &invoc, + AST::MacroRulesDefinition *def) +{ + auto it = macroInvocations.find (invoc.get_macro_node_id ()); + rust_assert (it == macroInvocations.end ()); + + macroInvocations[invoc.get_macro_node_id ()] = def; +} + +bool +Mappings::lookup_macro_invocation (AST::MacroInvocation &invoc, + AST::MacroRulesDefinition **def) +{ + auto it = macroInvocations.find (invoc.get_macro_node_id ()); + if (it == macroInvocations.end ()) + return false; + + *def = it->second; + return true; +} + void Mappings::insert_visibility (NodeId id, Privacy::ModuleVisibility visibility) { diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h index 474bd5fa229..addd9efc3b0 100644 --- a/gcc/rust/util/rust-hir-map.h +++ b/gcc/rust/util/rust-hir-map.h @@ -269,6 +269,11 @@ public: bool lookup_macro_def (NodeId id, AST::MacroRulesDefinition **def); + void insert_macro_invocation (AST::MacroInvocation &invoc, + AST::MacroRulesDefinition *def); + bool lookup_macro_invocation (AST::MacroInvocation &invoc, + AST::MacroRulesDefinition **def); + void insert_visibility (NodeId id, Privacy::ModuleVisibility visibility); bool lookup_visibility (NodeId id, Privacy::ModuleVisibility &def); @@ -334,6 +339,7 @@ private: // macros std::map<NodeId, AST::MacroRulesDefinition *> macroMappings; + std::map<NodeId, AST::MacroRulesDefinition *> macroInvocations; // crate names std::map<CrateNum, std::string> crate_names;