PR exp/9608:

* c-exp.y (%union) <tvec>: Change type.
	(func_mod): Now uses <tvec> type.
	(exp): Update for tvec change.
	(direct_abs_decl): Push the typelist.
	(func_mod): Return a typelist.
	(nonempty_typelist): Update for tvec change.
	* gdbtypes.c (lookup_function_type_with_arguments): New function.
	* gdbtypes.h (lookup_function_type_with_arguments): Declare.
	* parse.c (pop_type_list): New function.
	(push_typelist): New function.
	(follow_types): Handle tp_function_with_arguments.
	* parser-defs.h (type_ptr): New typedef.  Define a VEC.
	(enum type_pieces) <tp_function_with_arguments>: New constant.
	(union type_stack_elt) <typelist_val>: New field.
	(push_typelist): Declare.
testsuite
	* gdb.base/whatis.exp: Add regression test.
This commit is contained in:
Tom Tromey
2012-07-06 14:47:00 +00:00
parent fcde5961eb
commit 71918a863f
8 changed files with 115 additions and 17 deletions

View File

@@ -1483,6 +1483,15 @@ pop_type_int (void)
return 0;
}
/* Pop a type list element from the global type stack. */
static VEC (type_ptr) *
pop_typelist (void)
{
gdb_assert (type_stack.depth);
return type_stack.elements[--type_stack.depth].typelist_val;
}
/* Pop a type_stack element from the global type stack. */
static struct type_stack *
@@ -1545,6 +1554,17 @@ type_stack_cleanup (void *arg)
xfree (stack);
}
/* Push a function type with arguments onto the global type stack.
LIST holds the argument types. */
void
push_typelist (VEC (type_ptr) *list)
{
check_type_stack_depth ();
type_stack.elements[type_stack.depth++].typelist_val = list;
push_type (tp_function_with_arguments);
}
/* Pop the type stack and return the type which corresponds to FOLLOW_TYPE
as modified by all the stuff on the stack. */
struct type *
@@ -1632,6 +1652,19 @@ follow_types (struct type *follow_type)
follow_type = lookup_function_type (follow_type);
break;
case tp_function_with_arguments:
{
VEC (type_ptr) *args = pop_typelist ();
follow_type
= lookup_function_type_with_arguments (follow_type,
VEC_length (type_ptr, args),
VEC_address (type_ptr,
args));
VEC_free (type_ptr, args);
}
break;
case tp_type_stack:
{
struct type_stack *stack = pop_type_stack ();