summaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-06 14:46:59 +0000
committerTom Tromey <tromey@redhat.com>2012-07-06 14:46:59 +0000
commit484118c3151e97ad0207fe6a6f35438e64d3c65a (patch)
tree9f4e448882ab439f6697f88df2aac4581de4579f /gdb/parse.c
parent42ad8e35a1273caaefa962edf8324845445218c1 (diff)
downloadgdb-484118c3151e97ad0207fe6a6f35438e64d3c65a.tar.gz
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.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index b1ad8320b9a..897002d9115 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -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 ();