summaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorArtemiy Volkov <artemiyv@acm.org>2017-03-20 13:47:41 -0700
committerKeith Seitz <keiths@redhat.com>2017-03-20 13:47:41 -0700
commita65cfae5f8b268158c23a862e7a996d15bbcef0e (patch)
tree1caa41d0a85a2a4e47a358e28b3958299580331b /gdb/python
parent3b22433085e4cfee83f5c52f3baa8fb9bc67f8dd (diff)
downloadbinutils-gdb-a65cfae5f8b268158c23a862e7a996d15bbcef0e.tar.gz
Add ability to return rvalue reference values from value_ref
Parameterize value_ref() by the kind of reference type the value of which is requested. Change all callers to use the new API. gdb/ChangeLog PR gdb/14441 * ada-lang.c (ada_evaluate_subexp): Adhere to the new value_ref() interface. * c-valprint.c (c_value_print): Likewise. * infcall.c (value_arg_coerce): Likewise. * python/py-value.c (valpy_reference_value): Likewise. * valops.c (value_cast, value_reinterpret_cast) (value_dynamic_cast, typecmp): Likewise. (value_ref): Parameterize by kind of return value reference type. * value.h (value_ref): Add new parameter "refcode".
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-value.c2
-rw-r--r--gdb/python/py-xmethods.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index a56e555d47f..c848f0f65d5 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -248,7 +248,7 @@ valpy_reference_value (PyObject *self, PyObject *args)
scoped_value_mark free_values;
self_val = ((value_object *) self)->value;
- result = value_to_value_object (value_ref (self_val));
+ result = value_to_value_object (value_ref (self_val, TYPE_CODE_REF));
}
CATCH (except, RETURN_MASK_ALL)
{
diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c
index 8a9bb9b1c96..d01488fc744 100644
--- a/gdb/python/py-xmethods.c
+++ b/gdb/python/py-xmethods.c
@@ -552,9 +552,10 @@ gdbpy_invoke_xmethod (const struct extension_language_defn *extlang,
if (!types_equal (obj_type, this_ptr))
obj = value_cast (this_ptr, obj);
}
- else if (TYPE_CODE (obj_type) == TYPE_CODE_REF)
+ else if (TYPE_IS_REFERENCE (obj_type))
{
- struct type *this_ref = lookup_lvalue_reference_type (this_type);
+ struct type *this_ref
+ = lookup_reference_type (this_type, TYPE_CODE (obj_type));
if (!types_equal (obj_type, this_ref))
obj = value_cast (this_ref, obj);