From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AA6agR4bfNeFA0kME98/9oqpGs/nTjmXOgD4x0I1D6413cSu39YV6EVV59Nr0JuamJtURq0kDg+yww== 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 Cc: gcc-rust@gcc.gnu.org, Philip Herron 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> Reply-To: philip.herron@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: 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 -- 2.25.1