From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id p5uoIlD8DWVGDBsAWB0awg (envelope-from ) for ; Fri, 22 Sep 2023 16:42:56 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=pulFt/B7; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8320D1E0C3; Fri, 22 Sep 2023 16:42:56 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6FF2A1E028 for ; Fri, 22 Sep 2023 16:42:54 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C30A73858D28 for ; Fri, 22 Sep 2023 20:42:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C30A73858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695415373; bh=xbzGWdKNeFV9Pmyz7JFyiVlNx2MUZ8rTdYWjtduUIEk=; h=References:In-Reply-To:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=pulFt/B7UuWGwVRK92ny5R3H434a8d7HnafHww/QpNCVvKLXtqBREX2PM/Miixi5Q YovBeDyBgDha6HRV/+GP5UoKnTakXroq07XaJIlQEK4QpP2mvy0ZcZs9b2emOOLdF3 82cGy0eBCAzOwQp1C8di6aAw/MJJ5RCXu5ChcPFo= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 4C34F3858D28 for ; Fri, 22 Sep 2023 20:42:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4C34F3858D28 Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-28-19jetXG7MAuCmlxKGptRjQ-1; Fri, 22 Sep 2023 16:42:33 -0400 X-MC-Unique: 19jetXG7MAuCmlxKGptRjQ-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-59c07ca1b44so41635767b3.3 for ; Fri, 22 Sep 2023 13:42:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695415353; x=1696020153; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xbzGWdKNeFV9Pmyz7JFyiVlNx2MUZ8rTdYWjtduUIEk=; b=ZYylhMK3ru1bKdOKlKafdahRUpnjHDD39O42L/1AU7Bt4J0MSjZoHEZvC3MDdJyUQu qFFDKtBYmrT0rKLQclDOBZWMfJbdWLWLwwipHuWxnjxw+J6im5FA0bzB/jRLW97g1sWK fNidSMzIeqjtk/C3iFYG7NqaJr3HAihxRjW1iP2hfLC1GpC+O43Bj5Qrl95fcN2GjeoV 2vPJw6Da6mJa++VA8+p9nva7aPaN0IvEyiWDCmPqDV0jn7ww8RR4Uxnb2uDp5E7SQZl6 SJk3pv0yPm6Fj0pIug7hT/F0kE6P2fHF9dQwohXB8g3+Qrv5w9rmQhBmWF5PmIYg4US+ 3E9w== X-Gm-Message-State: AOJu0YwaGNbh4+P8g+V5+D6bz9AhAji9PtbTuk7Fo5xlPbIK878HOtma kPF/LnvrPifN8Nr4HrcFHdkYPU1t3oQwXQ5d0P9lsgAQUHuMkUz2FwmiBLPxcZOYOB0LUxPglaG CqBvPC0Z0RW20Jt9U4w58LBo2TlLf11bEY9GV3A== X-Received: by 2002:a0d:dec6:0:b0:59b:a2a:2131 with SMTP id h189-20020a0ddec6000000b0059b0a2a2131mr671029ywe.31.1695415353206; Fri, 22 Sep 2023 13:42:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1PFPDPt4bf9pdSiJmy0eGAGqyrpDT8AdAuMGz61twX4OxBW5O4JwTa7+ET75Y1sOhox+4Q5fyQQx5Tagib+c= X-Received: by 2002:a0d:dec6:0:b0:59b:a2a:2131 with SMTP id h189-20020a0ddec6000000b0059b0a2a2131mr671021ywe.31.1695415352954; Fri, 22 Sep 2023 13:42:32 -0700 (PDT) MIME-Version: 1.0 References: <20230921194207.2401885-1-tromey@adacore.com> In-Reply-To: <20230921194207.2401885-1-tromey@adacore.com> Date: Fri, 22 Sep 2023 13:42:22 -0700 Message-ID: Subject: Re: [PATCH] Use string_file::release in some places To: Tom Tromey Cc: gdb-patches@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Keith Seitz via Gdb-patches Reply-To: Keith Seitz Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On Thu, Sep 21, 2023 at 12:42=E2=80=AFPM Tom Tromey via Gdb-patches wrote: > > I found a few spots like: > > string_file f; > std::string x =3D f.string (); > > However, string_file::string returns a 'const std::string &'... so it > seems to me that this must be copying the string (? I find it hard to > reason about this in C++). I admit, you now have me doubting everything I thought I remembered on this subject! [TODO: reread the standard literature] As far as I can tell, your assessment is at least consistent with what is done elsewhere, e.g., location.c, ada-lang,c, and just about everywhere else except the two locations you've identified in this patch. Would symtab.c's symbol_to_info_string and valops.c:incomplete_type_hint also qualify for similar treatment? They use addition assignment, so maybe that alters the analogy? In any case: Reviewed-by: Keith Seitz Keith