[v2,1/3] Guile: improve rvalue support

Message ID yqkk89qy17ukzhbkx7.c.h48s-fbztd29.h.k7s1k_/q5y0-vzap@mail.bob131.so
State New
Headers show
Series
  • Guile: add value-{reference,const}-value
Related show

Commit Message

Simon Marchi via Gdb-patches April 26, 2021, 7:36 p.m.
Adds a couple of missing bits to the Guile API to make C++11 rvalue
reference values and types usable from Guile scripts.

gdb/ChangeLog:

2021-04-27  George Barrett  <bob@bob131.so>

	* guile/scm-type.c (type_integer_constants): Add binding for
	TYPE_CODE_RVALUE_REF.
	* guile/scm-value.c (gdbscm_value_referenced_value): Handle
	dereferencing of rvalue references.

gdb/doc/ChangeLog:

2021-04-27  George Barrett  <bob@bob131.so>

	* guile.texi (Types In Guile): Add documentation for
	TYPE_CODE_RVALUE_REF.
---
 gdb/doc/guile.texi    | 3 +++
 gdb/guile/scm-type.c  | 1 +
 gdb/guile/scm-value.c | 1 +
 3 files changed, 5 insertions(+)

-- 
2.30.2

Comments

Simon Marchi via Gdb-patches April 27, 2021, 1:58 p.m. | #1
> Date: Tue, 27 Apr 2021 05:36:00 +1000

> From: George Barrett via Gdb-patches <gdb-patches@sourceware.org>

> Cc: George Barrett <bob@bob131.so>

> 

> Adds a couple of missing bits to the Guile API to make C++11 rvalue

> reference values and types usable from Guile scripts.

> 

> gdb/ChangeLog:

> 

> 2021-04-27  George Barrett  <bob@bob131.so>

> 

> 	* guile/scm-type.c (type_integer_constants): Add binding for

> 	TYPE_CODE_RVALUE_REF.

> 	* guile/scm-value.c (gdbscm_value_referenced_value): Handle

> 	dereferencing of rvalue references.

> 

> gdb/doc/ChangeLog:

> 

> 2021-04-27  George Barrett  <bob@bob131.so>

> 

> 	* guile.texi (Types In Guile): Add documentation for

> 	TYPE_CODE_RVALUE_REF.


Thanks, the part for the manual is okay.

Patch

diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index 649dac559ad..7f3aa2df5aa 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -1268,6 +1268,9 @@  A pointer-to-member.
 @item TYPE_CODE_REF
 A reference type.
 
+@item TYPE_CODE_RVALUE_REF
+A C@t{++}11 rvalue reference type.
+
 @item TYPE_CODE_CHAR
 A character type.
 
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 11693844edc..8bb3e06482b 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -1318,6 +1318,7 @@  static const scheme_integer_constant type_integer_constants[] =
   X (TYPE_CODE_METHODPTR),
   X (TYPE_CODE_MEMBERPTR),
   X (TYPE_CODE_REF),
+  X (TYPE_CODE_RVALUE_REF),
   X (TYPE_CODE_CHAR),
   X (TYPE_CODE_BOOL),
   X (TYPE_CODE_COMPLEX),
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 59995169cd0..f50e8b5b46c 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -476,6 +476,7 @@  gdbscm_value_referenced_value (SCM self)
 	  res_val = value_ind (value);
 	  break;
 	case TYPE_CODE_REF:
+	case TYPE_CODE_RVALUE_REF:
 	  res_val = coerce_ref (value);
 	  break;
 	default: