[binutils-gdb] gdb/record-full: make record_full_arch_list_add take an rvalue ref

Simon Marchi via Gdb-cvs <[email protected]> Tue, 7 Jul 2026 18:55:30 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cfeb2a52e3bac0d917be91a9f3a747f2284a7de1

commit cfeb2a52e3bac0d917be91a9f3a747f2284a7de1
Author: Simon Marchi <[email protected]>
Date:   Mon Jul 6 12:40:09 2026 -0400

    gdb/record-full: make record_full_arch_list_add take an rvalue ref
    
    record_full_arch_list_add moves its `rec` argument, so it should take an
    rvalue ref to reflect that.  Otherwise the fact that the object is moved
    from can be a "surprise" to the callers.
    
    Change-Id: Ibeb56b1523ad8aee077d3bc3cad1f00d6b47ea2f
    Approved-By: Guinevere Larsen <[email protected]>

Diff:
---
 gdb/record-full.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/record-full.c b/gdb/record-full.c
index 1392510a175..aa451c05a5d 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -735,7 +735,7 @@ record_full_log_release_first (void)
 /* Add a struct record_full_entry to record_full_arch_list.  */
 
 static void
-record_full_arch_list_add (record_full_entry &rec)
+record_full_arch_list_add (record_full_entry &&rec)
 {
   record_full_incomplete_instruction.effects.push_back (std::move (rec));
 }
@@ -758,7 +758,7 @@ record_full_arch_list_add_reg (struct regcache *regcache, int regnum)
   if (regnum == gdbarch_pc_regnum (regcache->arch ()))
       record_full_incomplete_instruction.pc = std::move (rec.reg ());
   else
-      record_full_arch_list_add (rec);
+      record_full_arch_list_add (std::move (rec));
 
   return 0;
 }
@@ -784,7 +784,7 @@ record_full_arch_list_add_mem (CORE_ADDR addr, int len)
 			  rec.get_loc (), len))
     return -1;
 
-  record_full_arch_list_add (rec);
+  record_full_arch_list_add (std::move (rec));
 
   return 0;
 }
@@ -2399,7 +2399,7 @@ record_full_entry::from_bfd (bfd *cbfd, asection *osec, int *bfd_offset)
 			    bfd_get_filename (cbfd)));
       break;
     }
-  record_full_arch_list_add (rec);
+  record_full_arch_list_add (std::move (rec));
 }
 
 void