From patchwork Tue Dec 6 10:13:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 30203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2739970wrr; Tue, 6 Dec 2022 02:25:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Kjxv1isyt6gPzymu4LIrTiot9p4YezCrzvFWTQ5a4iRaCgd7RLUtHrVwYhFVCJtTN7Jbo X-Received: by 2002:a17:907:a4c3:b0:7c0:7c22:d70d with SMTP id vq3-20020a170907a4c300b007c07c22d70dmr31819250ejc.707.1670322345237; Tue, 06 Dec 2022 02:25:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670322345; cv=none; d=google.com; s=arc-20160816; b=hN8Fok1Xd7Elv2yA5PtdiE1R9wC8L7NnJ9MzrEwMEIGVQnu4Ne26zyd7V83kLzTxor 2tH6j+CLysNsTfuU4CHVBGK23ylU+Ctn4l6ERvqyF8Ea3Zy44C26iaBNmMDtWbvuvd/y 6LHIOGpdzqudXPqc2/eKPl3lYaZPfoBMrzNz2ICV+xn0ZAV/Za8vE0giXN8BORhBr5x6 g82hRwf+duO3mj5cETeycwYmYhiGoBgBtYAnOfCzTKrpa4PRq5ahB+23ayzXvYwAPIme KvCreEMyr+bUKDyLTGQjARu0PrFUaHwbyxSwuUuXKXjmwawmTNn0Ea3fALikVfeVkTOP Un5g== 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=IuV2N2C/O2ZBvGnnkHlfssoyPAALzTgbFtL58hfr22g=; b=y47XBJsjz97mIoyUSAo1BVKtaRs3BU113rsA+ZHK3T6KSYAvnWtFTfFUvSci0uD0GR VhldyYPhix7kzgiOcEG8s+XBh7qC+ZsxWOoEihyK3Xqf+5lf41oUGoFeOXXPLMLs+pbD Ngm5duaLksj35JaSm2l8nKr6xD9bEIqxXnyYFIOBDUuO42qFiqgYiOzTBYwTLWt2b2Tp i6eugcgtvlyOLy/dLna8akmrBn0+JB7or4lI+78LkPqmU9bDKtFajC5HR/Bzw1mmnIdR Rpq5QeffA2/QT5xIDrtLguXidtT0wGChVm86IS7QtLfHUeH8uzB4fAHD2bhsXvE8andx NJAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=dEz6Y1oy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ae14-20020a17090725ce00b007ae1d040bffsi2477320ejc.223.2022.12.06.02.25.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 02:25:45 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=dEz6Y1oy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 262A3395C061 for ; Tue, 6 Dec 2022 10:19:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id F33AE395B07B for ; Tue, 6 Dec 2022 10:12:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F33AE395B07B 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-x329.google.com with SMTP id v124-20020a1cac82000000b003cf7a4ea2caso13893460wme.5 for ; Tue, 06 Dec 2022 02:12:18 -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=IuV2N2C/O2ZBvGnnkHlfssoyPAALzTgbFtL58hfr22g=; b=dEz6Y1oyAwJrsfgR/7NlsTNRD9/lQ3Z1oYYET2GFWxgMRVkuD1khMh7XkFA2uH8mVg 6xZjphhCk72lKigupxuQ2MmqXZ68Js65V4OXupSpUAGIQHfV39wvEOYW1sDcL8DypVmO MNq7oIDzf2BQE5HKaLJ2eOFWoHWePoiKIsaHbMUpbAy+D/K1lPKFOdno5mVbrf8VPZ9E l6HljNTKvcgzUB99YIKC5O2vDrPpx3Vm3J+yCckbO3hDW9oEeNiKwFqzg2KQ5yD62bTQ ioNFduhoKR4uIr7lbhq3G3p3l5UZnWKNjI/svUE4L+6uqjrkNAOaS6alVoOgL8KFUD80 L77w== 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=IuV2N2C/O2ZBvGnnkHlfssoyPAALzTgbFtL58hfr22g=; b=5WuD805ZfM0BE5BwCOh+MKV701yGZlNMJLI3Fo41YiYVE8wnEWUFNHCV+csUxsC5ru 6VMFaT6NIHrTPiexKJvDkMVYpSYTMuk36d7y8VR8vgaCbmjh/CpaPpsOwhchezLIFtSc JCBIh4va440fm6nUrqoG0KXnUOkIgKdGTPCOp3Ll51bM9NNPrjUBK21xx1c7g+n7gD2/ SVOI4o2MTN9z05ndCMxmRuoIJlovGGFVknaWnUN/WjVhavfV2v4BeNOAet/+KkADBBIQ u6eBFhqqHt2bFPunHbkOu8Q31z/niGjaNu1/0DDqcUH8SbSKU5WG5GFKtKbknQgbe6QC 5SYQ== X-Gm-Message-State: ANoB5pk7dhF2uEOnDxYwg5CxIssIKpp8+2xUfvScodAXz3NHoI2Ua55h XNozCSUMBMHc+kvVKB17PIR2RroubYyT61eniw== X-Received: by 2002:a05:600c:348d:b0:3cf:88d3:5685 with SMTP id a13-20020a05600c348d00b003cf88d35685mr56257925wmq.38.1670321538312; Tue, 06 Dec 2022 02:12:18 -0800 (PST) Received: from platypus.lan ([2001:861:5e4c:3bb0:6424:328a:1734:3249]) by smtp.googlemail.com with ESMTPSA id r10-20020a05600c458a00b003cfd4a50d5asm27052699wmo.34.2022.12.06.02.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 02:12:17 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Philip Herron Subject: [PATCH Rust front-end v4 20/46] gccrs: Add wrapper for make_unique Date: Tue, 6 Dec 2022 11:13:52 +0100 Message-Id: <20221206101417.778807-21-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206101417.778807-1-arthur.cohen@embecosm.com> References: <20221206101417.778807-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-21.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751459923317046394?= X-GMAIL-MSGID: =?utf-8?q?1751459923317046394?= From: Philip Herron This is a wrapper for make_unique. We can likely get rid of this, as there are other implementations available, or simply keep using the unique_ptr constructor. --- gcc/rust/util/rust-make-unique.h | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 gcc/rust/util/rust-make-unique.h diff --git a/gcc/rust/util/rust-make-unique.h b/gcc/rust/util/rust-make-unique.h new file mode 100644 index 00000000000..7b79e625ff1 --- /dev/null +++ b/gcc/rust/util/rust-make-unique.h @@ -0,0 +1,35 @@ +// Copyright (C) 2020-2022 Free Software Foundation, Inc. + +// This file is part of GCC. + +// GCC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 3, or (at your option) any later +// version. + +// GCC is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. + +// You should have received a copy of the GNU General Public License +// along with GCC; see the file COPYING3. If not see +// . + +#ifndef RUST_MAKE_UNIQUE_H +#define RUST_MAKE_UNIQUE_H + +#include "rust-system.h" + +namespace Rust { + +template +std::unique_ptr +make_unique (Ts &&...params) +{ + return std::unique_ptr (new T (std::forward (params)...)); +} + +} // namespace Rust + +#endif // RUST_MAKE_UNIQUE_H