From a65cfae5f8b268158c23a862e7a996d15bbcef0e Mon Sep 17 00:00:00 2001 From: Artemiy Volkov Date: Mon, 20 Mar 2017 13:47:41 -0700 Subject: 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". --- gdb/c-valprint.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gdb/c-valprint.c') diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 5993195..d29b20e 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -606,10 +606,14 @@ c_value_print (struct value *val, struct ui_file *stream, else if (options->objectprint && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) { - int is_ref = TYPE_CODE (type) == TYPE_CODE_REF; + int is_ref = TYPE_IS_REFERENCE (type); + enum type_code refcode = TYPE_CODE_UNDEF; if (is_ref) - val = value_addr (val); + { + val = value_addr (val); + refcode = TYPE_CODE (type); + } /* Pointer to class, check real type of object. */ fprintf_filtered (stream, "("); @@ -635,7 +639,7 @@ c_value_print (struct value *val, struct ui_file *stream, if (is_ref) { - val = value_ref (value_ind (val)); + val = value_ref (value_ind (val), refcode); type = value_type (val); } -- cgit v1.1