diff options
author | Tom Tromey <tom@tromey.com> | 2019-03-31 13:43:54 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-04-04 19:55:11 -0600 |
commit | dac43e327d002107f6bc9481749de039f410df73 (patch) | |
tree | e3f3ae3d7b892d2a68e271127e5b53cf75e2c0d0 /gdb/parser-defs.h | |
parent | 2a61252965c91540133bece7deb92eb22e3cf929 (diff) | |
download | gdb-dac43e327d002107f6bc9481749de039f410df73.zip gdb-dac43e327d002107f6bc9481749de039f410df73.tar.gz gdb-dac43e327d002107f6bc9481749de039f410df73.tar.bz2 |
Move type stack handling to a new class
This introduces a new "type_stack" class, and moves all the parser
type stack handling to this class. Parsers that wish to use this
facility must now instantiate this class somehow. I chose this
approach because a minority of the existing parsers require this.
gdb/ChangeLog
2019-04-04 Tom Tromey <tom@tromey.com>
* type-stack.h: New file.
* type-stack.c: New file.
* parser-defs.h (enum type_pieces, union type_stack_elt): Move to
type-stack.h.
(insert_into_type_stack, insert_type, push_type, push_type_int)
(insert_type_address_space, pop_type, pop_type_int)
(pop_typelist, pop_type_stack, append_type_stack)
(push_type_stack, get_type_stack, push_typelist)
(follow_type_instance_flags, follow_types): Don't declare.
* parse.c (type_stack): Remove global.
(parse_exp_in_context): Update.
(insert_into_type_stack, insert_type, push_type, push_type_int)
(insert_type_address_space, pop_type, pop_type_int)
(pop_typelist, pop_type_stack, append_type_stack)
(push_type_stack, get_type_stack, push_typelist)
(follow_type_instance_flags, follow_types): Remove (moved to
type-stack.c).
* f-exp.y (type_stack): New global.
Update rules.
(push_kind_type, f_parse): Update.
* d-exp.y (type_stack): New global.
Update rules.
(d_parse): Update.
* c-exp.y (struct c_parse_state) <type_stack>: New member.
Update rules.
* Makefile.in (COMMON_SFILES): Add type-stack.c.
(HFILES_NO_SRCDIR): Add type-stack.h.
Diffstat (limited to 'gdb/parser-defs.h')
-rw-r--r-- | gdb/parser-defs.h | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 2c1ea15..edbd3b7 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -299,40 +299,6 @@ struct objc_class_str int theclass; }; -/* For parsing of complicated types. - An array should be preceded in the list by the size of the array. */ -enum type_pieces - { - tp_end = -1, - tp_pointer, - tp_reference, - tp_rvalue_reference, - tp_array, - tp_function, - tp_function_with_arguments, - tp_const, - tp_volatile, - tp_space_identifier, - tp_type_stack, - tp_kind - }; -/* The stack can contain either an enum type_pieces or an int. */ -union type_stack_elt - { - enum type_pieces piece; - int int_val; - struct type_stack *stack_val; - std::vector<struct type *> *typelist_val; - }; - -/* The type stack is an instance of this structure. */ - -struct type_stack -{ - /* Elements on the stack. */ - std::vector<union type_stack_elt> elements; -}; - /* Reverse an expression from suffix form (in which it is constructed) to prefix form (in which we can conveniently print or execute it). Ordinarily this always returns -1. However, if LAST_STRUCT @@ -376,27 +342,6 @@ extern const char *find_template_name_end (const char *); extern char *copy_name (struct stoken); -extern void insert_type (enum type_pieces); - -extern void push_type (enum type_pieces); - -extern void push_type_int (int); - -extern void insert_type_address_space (struct expr_builder *, char *); - -extern enum type_pieces pop_type (void); - -extern int pop_type_int (void); - -extern struct type_stack *get_type_stack (void); - -extern struct type_stack *append_type_stack (struct type_stack *to, - struct type_stack *from); - -extern void push_type_stack (struct type_stack *stack); - -extern void push_typelist (std::vector<struct type *> *typelist); - extern int dump_subexp (struct expression *, struct ui_file *, int); extern int dump_subexp_body_standard (struct expression *, @@ -414,10 +359,6 @@ extern int operator_check_standard (struct expression *exp, int pos, extern const char *op_name_standard (enum exp_opcode); -extern struct type *follow_types (struct type *); - -extern type_instance_flags follow_type_instance_flags (); - extern void null_post_parser (expression_up *, int, int); extern bool parse_float (const char *p, int len, |