std::string
type_to_string (struct type *type)
{
- std::string s;
- struct ui_file *stb;
- struct cleanup *old_chain;
-
- stb = mem_fileopen ();
- old_chain = make_cleanup_ui_file_delete (stb);
-
TRY
{
- type_print (type, "", stb, -1);
- s = ui_file_as_string (stb);
+ string_file stb;
+
+ type_print (type, "", &stb, -1);
+ return std::move (stb.string ());
}
CATCH (except, RETURN_MASK_ALL)
{
}
END_CATCH
- do_cleanups (old_chain);
-
- return s;
+ return {};
}
/* Print type of EXP, or last thing in value history if EXP == NULL.
get_user_print_options (&opts);
if (opts.objectprint)
{
- if (((TYPE_CODE (type) == TYPE_CODE_PTR)
- || (TYPE_CODE (type) == TYPE_CODE_REF))
+ if (((TYPE_CODE (type) == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
real_type = value_rtti_indirect_type (val, &full, &top, &using_enc);
else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
case TYPE_CODE_METHODPTR:
case TYPE_CODE_METHOD:
case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_NAMESPACE:
error (_("internal error: unhandled type in print_type_scalar"));
break;