From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway22.websitewelcome.com (gateway22.websitewelcome.com [192.185.47.129]) by sourceware.org (Postfix) with ESMTPS id 76C5539C0016 for ; Wed, 28 Apr 2021 01:01:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 76C5539C0016 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 23BD16FD5B for ; Tue, 27 Apr 2021 20:01:45 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id bYaHly6TcMGeEbYaHlEeaH; Tue, 27 Apr 2021 20:01:45 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=gz0C7wa2+4alozDJrGEMloI5TX3FlnrZVrAH1YrlC2M=; b=p/hETj5zqa2KycmahtgKzvfIZG UypIJSS37Qa35QgTFA1JE/v9U26u1bo4U0pHdkIUkXTN3lEnGYBMAOqctSxkVk3FHjsJ4coqLY7GH JSXXsGwi1wfBNQYNbq7R6N3im; Received: from 97-122-70-176.hlrn.qwest.net ([97.122.70.176]:32966 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lbYaG-003tiR-Pp; Tue, 27 Apr 2021 19:01:44 -0600 From: Tom Tromey To: gcc-patches@gcc.gnu.org Cc: Tom Tromey Subject: [PATCH v2 20/21] libcc1: avoid extra string copies Date: Tue, 27 Apr 2021 19:01:18 -0600 Message-Id: <20210428010119.806184-21-tom@tromey.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210428010119.806184-1-tom@tromey.com> References: <20210428010119.806184-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.70.176 X-Source-L: No X-Exim-ID: 1lbYaG-003tiR-Pp X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-70-176.hlrn.qwest.net (localhost.localdomain) [97.122.70.176]:32966 X-Source-Auth: tom+tromey.com X-Email-Count: 21 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3031.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, URIBL_CSS, URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-List-Received-Date: Wed, 28 Apr 2021 01:01:48 -0000 PR c/94669 points out that a couple of spots in libcc1 take a std::string where a reference would do. This changes these spots to take a const char *, to reduce the number of copies. libcc1/ChangeLog 2021-04-27 Tom Tromey PR c/94669: * compiler.hh (compiler_driver_filename): Take const char *. (compiler_triplet_regexp): Likewise. --- libcc1/ChangeLog | 6 ++++++ libcc1/compiler.hh | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libcc1/compiler.hh b/libcc1/compiler.hh index 638f7c09f634..d10d409f9d35 100644 --- a/libcc1/compiler.hh +++ b/libcc1/compiler.hh @@ -58,7 +58,7 @@ namespace cc1_plugin char *find (const char *base, std::string &compiler) const override; - compiler_triplet_regexp (bool v, std::string triplet_regexp) + compiler_triplet_regexp (bool v, const char *triplet_regexp) : compiler (v), triplet_regexp_ (triplet_regexp) { } @@ -72,7 +72,7 @@ namespace cc1_plugin public: char *find (const char *base, std::string &compiler) const override; - compiler_driver_filename (bool v, std::string driver_filename) + compiler_driver_filename (bool v, const char *driver_filename) : compiler (v), driver_filename_ (driver_filename) { } -- 2.26.2