[v4,1/3] Guile: improved rvalue reference support

Message ID ci3kfqvwi0&bhdkxx3wvd/ro5v4vy/jvo0b1bp6gmn9qpgcy32l5@mail.bob131.so
State New
Headers show
Series
  • Guile: add value-{reference,const}-value
Related show

Commit Message

Simon Marchi via Gdb-patches April 28, 2021, 5:32 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-29  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.
	* NEWS (Guile API): Note improvements in rvalue reference
	support.

gdb/doc/ChangeLog:

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

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

-- 
2.30.2

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index 6550ea352ac..9c76df8b6d5 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -185,6 +185,13 @@  QMemTags
   Request the remote to store the specified allocation tags to the requested
   memory range.
 
+* Guile API
+
+  ** Improved support for rvalue reference values:
+     TYPE_CODE_RVALUE_REF is now exported as part of the API and the
+     value-referenced-value procedure now handles rvalue reference
+     values.
+
 *** Changes in GDB 10
 
 * There are new feature names for ARC targets: "org.gnu.gdb.arc.core"
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index 762a82a08c5..c7904574002 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 8d9c2c5f9a4..d65102b01c7 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: