/* Python interface to types.
- Copyright (C) 2008-2017 Free Software Foundation, Inc.
+ Copyright (C) 2008-2018 Free Software Foundation, Inc.
This file is part of GDB.
ENTRY (TYPE_CODE_METHODPTR),
ENTRY (TYPE_CODE_MEMBERPTR),
ENTRY (TYPE_CODE_REF),
+ ENTRY (TYPE_CODE_RVALUE_REF),
ENTRY (TYPE_CODE_CHAR),
ENTRY (TYPE_CODE_BOOL),
ENTRY (TYPE_CODE_COMPLEX),
}
END_CATCH
- if (TYPE_CODE (type) != TYPE_CODE_PTR
- && TYPE_CODE (type) != TYPE_CODE_REF)
+ if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
break;
type = TYPE_TARGET_TYPE (type);
}
const struct block *block)
{
struct type *type, *rtype = NULL;
- char *type_name = NULL;
enum demangle_component_type demangled_type;
/* Save the type: typy_lookup_type() may (indirectly) overwrite
if (demangled_type == DEMANGLE_COMPONENT_POINTER
|| demangled_type == DEMANGLE_COMPONENT_REFERENCE
+ || demangled_type == DEMANGLE_COMPONENT_RVALUE_REFERENCE
|| demangled_type == DEMANGLE_COMPONENT_CONST
|| demangled_type == DEMANGLE_COMPONENT_VOLATILE)
{
case DEMANGLE_COMPONENT_REFERENCE:
rtype = lookup_lvalue_reference_type (type);
break;
+ case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
+ rtype = lookup_rvalue_reference_type (type);
+ break;
case DEMANGLE_COMPONENT_POINTER:
rtype = lookup_pointer_type (type);
break;
return rtype;
/* We don't have a type, so lookup the type. */
- type_name = cp_comp_to_string (demangled, 10);
- type = typy_lookup_typename (type_name, block);
- xfree (type_name);
-
- return type;
+ gdb::unique_xmalloc_ptr<char> type_name = cp_comp_to_string (demangled, 10);
+ return typy_lookup_typename (type_name.get (), block);
}
/* This is a helper function for typy_template_argument that is used
TRY
{
type = check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_REF)
+ if (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type));
}
CATCH (except, RETURN_MASK_ALL)
typy_str (PyObject *self)
{
string_file thetype;
- PyObject *result;
TRY
{
PyObject *
gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw)
{
- static char *keywords[] = { "name", "block", NULL };
+ static const char *keywords[] = { "name", "block", NULL };
const char *type_name = NULL;
struct type *type = NULL;
PyObject *block_obj = NULL;
const struct block *block = NULL;
- if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O", keywords,
- &type_name, &block_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O", keywords,
+ &type_name, &block_obj))
return NULL;
if (block_obj)
\f
-static PyGetSetDef type_object_getset[] =
+static gdb_PyGetSetDef type_object_getset[] =
{
{ "code", typy_get_code, NULL,
"The code for this type.", NULL },
0, /* tp_new */
};
-static PyGetSetDef field_object_getset[] =
+static gdb_PyGetSetDef field_object_getset[] =
{
{ "__dict__", gdb_py_generic_dict, NULL,
"The __dict__ for this field.", &field_object_type },