return ntype;
}
-/* Given a type TYPE, return a type of functions that return that type.
- May need to construct such a type if this is the first use. */
-
-struct type *
-lookup_function_type (struct type *type)
-{
- return make_function_type (type, (struct type **) 0);
-}
-
-/* Given a type TYPE and argument types, return the appropriate
- function type. If the final type in PARAM_TYPES is NULL, make a
- varargs function. */
+/* See gdbtypes.h. */
struct type *
-lookup_function_type_with_arguments (struct type *type,
- int nparams,
- struct type **param_types)
+create_function_type (type_allocator &alloc,
+ struct type *return_type,
+ int nparams,
+ struct type **param_types)
{
- struct type *fn = make_function_type (type, (struct type **) 0);
+ struct type *fn = alloc.new_type ();
int i;
+ make_function_type (return_type, &fn);
+
if (nparams > 0)
{
if (param_types[nparams - 1] == NULL)
return fn;
}
+/* See gdbtypes.h. */
+
+struct type *
+lookup_function_type (struct type *return_type)
+{
+ type_allocator alloc (return_type);
+ return create_function_type (alloc, return_type, 0, nullptr);
+}
+
+/* See gdbtypes.h. */
+
+struct type *
+lookup_function_type_with_arguments (struct type *return_type,
+ int nparams,
+ struct type **param_types)
+{
+ type_allocator alloc (return_type);
+ return create_function_type (alloc, return_type, nparams, param_types);
+}
+
/* Identify address space identifier by name -- return a
type_instance_flags. */
extern struct type *make_function_type (struct type *, struct type **);
-extern struct type *lookup_function_type (struct type *);
-
-extern struct type *lookup_function_type_with_arguments (struct type *,
- int,
- struct type **);
+/* Given a return type and argument types, create new function type.
+ If the final type in PARAM_TYPES is NULL, create a varargs function.
+ New type is allocated using ALLOC. */
+extern struct type *create_function_type (type_allocator &alloc,
+ struct type *return_type,
+ int nparams,
+ struct type **param_types);
+
+/* Like create_function_type, but allocate the new function type at
+ the same obstack as RETURN_TYPE and with unspecified number of
+ parameters and their types. */
+extern struct type *lookup_function_type (struct type *return_type);
+
+/* Like create_function_type, but allocate the new function type at
+ the same obstack as RETURN_TYPE. */
+extern struct type *lookup_function_type_with_arguments
+ (struct type *return_type,
+ int nparams,
+ struct type **param_types);
/* Create a range type using ALLOC.