From patchwork Wed Oct 26 08:17:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 11120 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp128852wru; Wed, 26 Oct 2022 01:27:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Q9vLilwzrczuZV56dy9+WB1GyevHdwPesKG0m+CnzjBLh1QPaSzTjDmmcz2zCWEl8+di6 X-Received: by 2002:aa7:c14b:0:b0:461:c47d:48cf with SMTP id r11-20020aa7c14b000000b00461c47d48cfmr13526284edp.83.1666772850420; Wed, 26 Oct 2022 01:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666772850; cv=none; d=google.com; s=arc-20160816; b=fraFdcZgHAV6rikgWE2A5xAusXBqpGenS582ZwvUhHpFFeET6QbaB/WBygDZnFpGAH tO+BXhs34/0oLpZ+z9KtzWYI5agJK8dGShpgoyluuRKBWf+i5aeb2cmnzJwYSCeutRaT 8Nl+ws8KV8q7zhfsb9cbmaS/wcsI+JNdDW7Ly2eX5DathIw4XoGIUNqB5UfWlqVNKSYc 7R7fjF4Dl6yiTM78DRF6ttQJPOgMEjETX/WV1yuw4IboLRvg2UBjMgzsnPCtZGSxCZEe hN+x4M8jp++UFUAh7s1YLIvtt900eLlDJsH2uyHum+u6xNuCU38YJuvB1QU2QplbPebx IHOg== 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=NFXDJZ9Ss4NnnqErRu7LCsyFoxtCMlaABsruQ/ABlJE=; b=Y0ovOmbgVhTC0IFyDSIEPQPliTAu+wgqU5X5M9oFkXsLZfJuR7Sjs/lpFc3eZPbpbv y0H5b5nn83fLc5F6yuu9Wf923ebt49WKOgiIGB5V4+EU3ddbWopx3uSFv60AB5BAAmuC PEkX8DApgZCSPzdxXnt4M7jkidaeowXz7rpVeub3OTzm10QX1gyZZHkRQHECFCUIVkfA m5iEXWa3rlv6+gSWjEuC/BNtxJV2dvIp4inXqfJJRFA2mUcpO8T8D4RrLqAjqlY6ABju STy/yo1WLPPWGN6bFBko7R5VjlHfChMGnU4xoMNNucM26ExsMK1OWs/Y0tm9eCFkBXdj gimQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=HLUEYJQW; 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 qa35-20020a17090786a300b007918f4994f4si5982386ejc.15.2022.10.26.01.27.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 01:27:30 -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=@embecosm.com header.s=google header.b=HLUEYJQW; 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 94D4C393BA7E for ; Wed, 26 Oct 2022 08:22:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id D6D5A3856DED for ; Wed, 26 Oct 2022 08:15:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D6D5A3856DED 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-wr1-x433.google.com with SMTP id k8so16389867wrh.1 for ; Wed, 26 Oct 2022 01:15:50 -0700 (PDT) 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=NFXDJZ9Ss4NnnqErRu7LCsyFoxtCMlaABsruQ/ABlJE=; b=HLUEYJQW5PrUx8Bl9JjlN4y/AZL6r1ybH5cN/ou6G03W4nBmuOWYOaLWo/pCIvOsje Ax8WHC48+HJEFmk1TdZAQvmf+LtB8iwXl1IvVCG+CBIE6xERaMqnjb6ewW34P7JSEU8t UwZ+ijWG925d6GKUepGwkAEh+5rjA3aiKs51mw1Th0z/lFgRn711qcMEimCxdUpLBPmR 5UuUoYB5yKJ3V8ErPIdau4Qgbl9nAfOUBxVwUZ8ybVe0F/F97lsUxOO9faiH7hiLcLr8 lG7ObkBoluZCYcwQa9XkFJcjYW+XBlZfvBcAKi/83lYTKbUPGJeYf7k5kg6JbE+vncK2 iIMA== 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=NFXDJZ9Ss4NnnqErRu7LCsyFoxtCMlaABsruQ/ABlJE=; b=3rnr7QJBKl4CX3PdBIg6cqP0VoOawgllaG9uv+XYz6thFtTnLV6KKZK4mqwjkDs1vt BedGgOKOwsiDYD5STKl8pQ2aPinD/j5slNouN5CXBVn4nMoFnc1JNI2Cz7tWEkdtJhXC qAUEwayy/jZCspg6ouwJlumq2KGQXMuLwNvgR9N+sSKgn6vnK3cD2faR6tEEwfNCSS0j SWTKqRiMF6GAexW4U1WgNCluDZ/lNz0jnGfjphTlMF2uIM5L+seP17fZ5a1eRQ2pcr7I QT3YUJhLEZtN+p/fBGRxrVoM7MY6CpnQ7aQbEKASoOJQS9RiG9BZFxBPdUY8h41N6027 NOBQ== X-Gm-Message-State: ACrzQf3a3uELjZW7jPHdxrAgpdP/841RqesIdT0/5iogI8eI8/rb37U/ HABWim8lfYxFYR5xzYpk+h/PauefcseAr8bAKQ== X-Received: by 2002:adf:fccd:0:b0:236:781a:8d73 with SMTP id f13-20020adffccd000000b00236781a8d73mr8349128wrs.31.1666772149341; Wed, 26 Oct 2022 01:15:49 -0700 (PDT) Received: from platypus.lan ([2001:861:5e4c:3bb0:6424:328a:1734:3249]) by smtp.googlemail.com with ESMTPSA id q16-20020a05600c46d000b003c6f426467fsm1134310wmo.40.2022.10.26.01.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 01:15:49 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH Rust front-end v3 20/46] gccrs: Add wrapper for make_unique Date: Wed, 26 Oct 2022 10:17:45 +0200 Message-Id: <20221026081811.602573-21-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221026081811.602573-1-arthur.cohen@embecosm.com> References: <20221026081811.602573-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.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=unavailable 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 Cc: gcc-rust@gcc.gnu.org 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?1747738008400321633?= X-GMAIL-MSGID: =?utf-8?q?1747738008400321633?= 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