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: 61513 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1BCB9383904F for ; Tue, 6 Dec 2022 10:19:00 +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-Google-Smtp-Source: AA0mqf4nmncOcQlVJckQX/bbghbpGzj/6taACS+QIqw1by9OEeDU/x1e0sbY+GGbYVIW0mkCzPt18w== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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