Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb/record-full: make record_full_arch_list_add take an rvalue ref
@ 2026-07-06 16:40 Simon Marchi
  2026-07-07 18:54 ` Guinevere Larsen
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2026-07-06 16:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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
---
 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 1392510a175c..aa451c05a5d9 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

base-commit: abcf25501f986df152581faeff08419c198a7ec3
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb/record-full: make record_full_arch_list_add take an rvalue ref
  2026-07-06 16:40 [PATCH] gdb/record-full: make record_full_arch_list_add take an rvalue ref Simon Marchi
@ 2026-07-07 18:54 ` Guinevere Larsen
  2026-07-07 18:56   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Guinevere Larsen @ 2026-07-07 18:54 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 7/6/26 1:40 PM, Simon Marchi wrote:
> 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
> ---

Yeah, this makes sense, and feels pretty straightforward

Approved-By: Guinevere Larsen <guinevere@redhat.com>

>   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 1392510a175c..aa451c05a5d9 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
>
> base-commit: abcf25501f986df152581faeff08419c198a7ec3


-- 
Cheers,
Guinevere Larsen
it/its
she/her (deprecated)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb/record-full: make record_full_arch_list_add take an rvalue ref
  2026-07-07 18:54 ` Guinevere Larsen
@ 2026-07-07 18:56   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2026-07-07 18:56 UTC (permalink / raw)
  To: Guinevere Larsen, gdb-patches

On 7/7/26 2:54 PM, Guinevere Larsen wrote:
> On 7/6/26 1:40 PM, Simon Marchi wrote:
>> 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
>> ---
> 
> Yeah, this makes sense, and feels pretty straightforward
> 
> Approved-By: Guinevere Larsen <guinevere@redhat.com>

Thanks, pushed.

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-07 18:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-06 16:40 [PATCH] gdb/record-full: make record_full_arch_list_add take an rvalue ref Simon Marchi
2026-07-07 18:54 ` Guinevere Larsen
2026-07-07 18:56   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox