From patchwork Wed Aug 24 11:59:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: herron.philip@googlemail.com X-Patchwork-Id: 715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp1388162wro; Wed, 24 Aug 2022 05:13:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR68nnhCvaM54005FfWV36vzBuGm5HAae25Y/efOejJV4RNMdStU/l2XK2vEbmJ5DBc+JuWu X-Received: by 2002:a05:6402:2547:b0:447:3102:59c3 with SMTP id l7-20020a056402254700b00447310259c3mr4794637edb.44.1661343224765; Wed, 24 Aug 2022 05:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661343224; cv=none; d=google.com; s=arc-20160816; b=wWdT0UYKnh+So5o6HQZb5YqhwX+ElaiLXflgf0CS/wpA4/nACIYk+YnfP9COa8dgyG Uj2SoKsBLemx8k/D5x9r7usMX9RWV8R++oLkkBArfW3M3W9JtMWX5+CFNREg/ZuFS8cO r2KoRM5OtvaE5gSTzB53+9AXABAArLk4aFSwrPpSidWX3zDCoX1VLs8Kk413O8ZQ/eld Hg63w5Jtb6D2JuKgrrvWa9IxaEnfRDV3mosr7FPPmcaFjMkPR3SHK8cmAVPKvmj5kLuX XwF2//SRy6d4Gz3+WYPGxEwRBhXsr6JePf4rz77EBpKhKhDWIdm6SYEjUqR39mpI/Dhm Qcpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from:dkim-signature:dmarc-filter :delivered-to; bh=DM/LY0TkNgOJ4YhoQ6i4iSo2wu9tJhSp7I5HRoVivf4=; b=uD+QFgS4khmiJh01K+ukNAQOnGHvbfDCSt9EuOcDQYh2H/tNeDblom1TS5Wo1C4z2k rxJROoOT9Cq+uNEe8/XpluwK+yaDNtauP35+bh3n0ueZQvQeVP52W41AbbWDbeCMt7V0 DnBl7prdxqyZLigHPfi7myO/7J/tKzasjCo4PXrK6tJ/brjXW/xYV81JnkhizCFbfCjF 0vuSz1agnnFpoZNCEh0u8iMTs2jlsraCiZRXE0/96CmXi8QfhYSaq0Ke1m0tv7zqxM0e 7hxpvyduQDaMhsys1Y6d+WyDcDvmp5vo6c5a/kzypZlfrrCejUcijeHJx7lGftgFyhS5 Dsjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=pG+8NLpW; 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"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f39-20020a05640232a700b004477be72d56si1219374eda.521.2022.08.24.05.13.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 05:13:44 -0700 (PDT) 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=@googlemail.com header.s=20210112 header.b=pG+8NLpW; 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"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C04673881D01 for ; Wed, 24 Aug 2022 12:05:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 7B524388550F; Wed, 24 Aug 2022 12:00:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7B524388550F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=googlemail.com Received: by mail-wr1-x42e.google.com with SMTP id a4so20519639wrq.1; Wed, 24 Aug 2022 05:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc; bh=DM/LY0TkNgOJ4YhoQ6i4iSo2wu9tJhSp7I5HRoVivf4=; b=pG+8NLpWT0waKyLwxCcyjwjjNHMjWAhX8h3bOS85rmHDW/Nio7QuoXcbkp9wRJ1Tj5 DKdmlfzEOgESiRbsILV7y/LNG0aXgAcw4GRUcgk0aMcV8V8INDARCtLmyqyDTzUi0Xz7 z3lKc8v/fwK90/K+2ObUYEVZj0kyh7KR4Rt7sEp6m7+3ZT2YXR0h0XXI+/7QJfywSlOL c6Rb9dhnQFXv+ZwPZqkuNulTRM8FciuRQllSC/bxEgqcXL4mS+4AU0NkPipan2hqb2ly Le1wqNZVYS3DKT/ctc01zXFhfUVp91uFQDETrW3cAO6GbvOlhsP4G9hVI2Vctoguj8Jc pvlw== 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; bh=DM/LY0TkNgOJ4YhoQ6i4iSo2wu9tJhSp7I5HRoVivf4=; b=vYFEaiNOvrgHW8hPj0GCynSeNDeKRQf/jD8zcfMgJGCmba+lbR8llKeYrlPQ4qUiwu EuZ1bB9uMGlVGz/cvEfWBhIXxzcF0zy+0OyvJdEuCKQ552Ovk8aICol73BNHuxaMV1SG uhs4ALbulD69SSBzeTwZC5CbtTjGRY91of7cFSeJD3mwSKD6cFYj/2eKWK0ubm0oAZUM N2Hmp7opHUQoOCb3EiuJ91CJe6+lcgOmCSYQudC/ObfIVmZMHba3zdNNRmc9drzNNSIo SoPEaSh0X0iEKiXAp3cjE/t1EI9QfM3/nCZ+mtkSM1sjGNVsECr/Cb8aUnKtwk8mndsx FjxA== X-Gm-Message-State: ACgBeo2arewPO3eKaoZ9psSzhIvqb5FeyqNGY6FFtP2vhwHhbW8tE65P oO2d3m87ao0MXb08n+VBBxkEqzh/JZA= X-Received: by 2002:a5d:6a50:0:b0:225:5dd6:873f with SMTP id t16-20020a5d6a50000000b002255dd6873fmr6498136wrw.101.1661342451873; Wed, 24 Aug 2022 05:00:51 -0700 (PDT) Received: from localhost.localdomain ([86.14.124.218]) by smtp.gmail.com with ESMTPSA id cc19-20020a5d5c13000000b0022571d43d32sm1697676wrb.21.2022.08.24.05.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 05:00:51 -0700 (PDT) From: herron.philip@googlemail.com X-Google-Original-From: philip.herron@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH Rust front-end v2 15/37] gccrs: Add wrapper for make_unique Date: Wed, 24 Aug 2022 12:59:34 +0100 Message-Id: <20220824115956.737931-16-philip.herron@embecosm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220824115956.737931-1-philip.herron@embecosm.com> References: <20220824115956.737931-1-philip.herron@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: philip.herron@embecosm.com Cc: gcc-rust@gcc.gnu.org, Philip Herron 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?1742044633158716706?= X-GMAIL-MSGID: =?utf-8?q?1742044633158716706?= 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..f33f9125f89 --- /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 + +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