the std::type_info for the exception. Now we find the type from
the type_info and cast the result. */
obj_type = cplus_type_from_type_info (arg1);
- return value_ind (value_cast (make_pointer_type (obj_type, NULL), arg0));
+ return value_ind (value_cast (make_pointer_type (obj_type), arg0));
}
/* Implementation of the '$_exception' variable. */
/* For now, leave the pointer/reference types alone. */
}
-/* Lookup a pointer to a type TYPE. TYPEPTR, if nonzero, points
- to a pointer to memory where the pointer type should be stored.
- If *TYPEPTR is zero, update it to point to the pointer type we return.
- We allocate new memory if needed. */
+/* See gdbtypes.h. */
-struct type *
-make_pointer_type (struct type *type, struct type **typeptr)
+type *
+make_pointer_type (type *type)
{
struct type *ntype; /* New type */
struct type *chain;
ntype = TYPE_POINTER_TYPE (type);
if (ntype)
- {
- if (typeptr == 0)
- return ntype; /* Don't care about alloc,
- and have new type. */
- else if (*typeptr == 0)
- {
- *typeptr = ntype; /* Tracking alloc, and have new type. */
- return ntype;
- }
- }
-
- if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
- {
- ntype = type_allocator (type).new_type ();
- if (typeptr)
- *typeptr = ntype;
- }
- else /* We have storage, but need to reset it. */
- {
- ntype = *typeptr;
- chain = TYPE_CHAIN (ntype);
- smash_type (ntype);
- TYPE_CHAIN (ntype) = chain;
- }
+ return ntype;
+ ntype = type_allocator (type).new_type ();
ntype->set_target_type (type);
TYPE_POINTER_TYPE (type) = ntype;
struct type *
lookup_pointer_type (struct type *type)
{
- return make_pointer_type (type, (struct type **) 0);
+ return make_pointer_type (type);
}
/* Lookup a C++ `reference' to a type TYPE. TYPEPTR, if nonzero,
extern struct type *lookup_struct_elt_type (struct type *, const char *, int);
-extern struct type *make_pointer_type (struct type *, struct type **);
+/* Lookup a pointer to a type TYPE. */
+
+extern type *make_pointer_type (type *type);
extern struct type *lookup_pointer_type (struct type *);
struct type *char_type
= builtin_type (arch)->builtin_char;
struct type *char_ptr_type
- = make_pointer_type (make_cv_type (1, 0, char_type, NULL), NULL);
+ = make_pointer_type (make_cv_type (1, 0, char_type, NULL));
t = type_allocator (arch).new_type (TYPE_CODE_STRUCT, 0, nullptr);
error (_("cannot find typeinfo for object of type '%s'"),
name);
typeinfo_value = value_field (vtable, vtable_field_type_info);
- result = value_ind (value_cast (make_pointer_type (typeinfo_type, NULL),
+ result = value_ind (value_cast (make_pointer_type (typeinfo_type),
typeinfo_value));
}
else