diff options
author | Tom Tromey <tromey@redhat.com> | 2015-02-09 14:59:05 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-02-27 17:19:15 +0000 |
commit | 52059ffd6935427d02ee418be3eceeff6fd5c066 (patch) | |
tree | 5ea61d24cc0cc0bebe9493ba00afe8877a330955 /gdb/dwarf2read.c | |
parent | fe978cb071b460b2d4aed2f9a71d895f84efce0e (diff) | |
download | gdb-52059ffd6935427d02ee418be3eceeff6fd5c066.zip gdb-52059ffd6935427d02ee418be3eceeff6fd5c066.tar.gz gdb-52059ffd6935427d02ee418be3eceeff6fd5c066.tar.bz2 |
Fix struct, union, and enum nesting in C++
In C, an enum or structure defined inside other structure has global
scope just like it had been defined outside the struct in the first
place. However, in C++, such a nested structure is given a name that
is nested inside the structure. This patch moves such affected
structures/enums out to global scope, so that code using them works
the same in C++ as it works today in C.
gdb/ChangeLog:
2015-02-27 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
* dwarf2-frame.c (enum cfa_how_kind, struct
dwarf2_frame_state_reg_info): Move out of struct
dwarf2_frame_state.
* dwarf2read.c (struct tu_stats): Move out of struct
dwarf2_per_objfile.
(struct file_entry): Move out of struct line_header.
(struct nextfield, struct nextfnfield, struct fnfieldlist, struct
typedef_field_list): Move out of struct field_info.
* gdbtypes.h (enum dynamic_prop_kind, union dynamic_prop_data):
Move out of struct dynamic_prop.
(union type_owner, union field_location, struct field, struct
range_bounds, union type_specific): Move out of struct main_type.
(struct fn_fieldlist, struct fn_field, struct typedef_field)
(VOFFSET_STATIC): Move out of struct cplus_struct_type.
(struct call_site_target, union call_site_parameter_u, struct
call_site_parameter): Move out of struct call_site.
* m32c-tdep.c (enum m32c_prologue_kind): Move out of struct
m32c_prologue.
(enum srcdest_kind): Move out of struct srcdest.
* main.c (enum cmdarg_kind): Move out of struct cmdarg.
* prologue-value.h (enum prologue_value_kind): Move out of struct
prologue_value.
* s390-linux-tdep.c (enum s390_abi_kind): Move out of struct
gdbarch_tdep.
* stabsread.c (struct nextfield, struct next_fnfieldlist): Move
out of struct field_info.
* symfile.h (struct other_sections): Move out of struct
section_addr_info.
* symtab.c (struct symbol_cache_slot): Move out struct
block_symbol_cache.
* target-descriptions.c (enum tdesc_type_kind): Move out of
typedef struct tdesc_type.
* tui/tui-data.h (enum tui_line_or_address_kind): Move out of
struct tui_line_or_address.
* value.c (enum internalvar_kind, union internalvar_data): Move
out of struct internalvar.
* xtensa-tdep.h (struct ctype_cache): Move out of struct
gdbarch_tdep.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 96 |
1 files changed, 52 insertions, 44 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 30abef5..071f97b 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -199,6 +199,15 @@ struct mapped_index typedef struct dwarf2_per_cu_data *dwarf2_per_cu_ptr; DEF_VEC_P (dwarf2_per_cu_ptr); +struct tu_stats +{ + int nr_uniq_abbrev_tables; + int nr_symtabs; + int nr_symtab_sharers; + int nr_stmt_less_type_units; + int nr_all_type_units_reallocs; +}; + /* Collection of data recorded per objfile. This hangs off of dwarf2_objfile_data_key. */ @@ -250,14 +259,7 @@ struct dwarf2_per_objfile /* Type unit statistics, to see how well the scaling improvements are doing. */ - struct tu_stats - { - int nr_uniq_abbrev_tables; - int nr_symtabs; - int nr_symtab_sharers; - int nr_stmt_less_type_units; - int nr_all_type_units_reallocs; - } tu_stats; + struct tu_stats tu_stats; /* A chain of compilation units that are currently read in, so that they can be freed later. */ @@ -1022,6 +1024,16 @@ typedef void (die_reader_func_ftype) (const struct die_reader_specs *reader, int has_children, void *data); +struct file_entry +{ + const char *name; + unsigned int dir_index; + unsigned int mod_time; + unsigned int length; + int included_p; /* Non-zero if referenced by the Line Number Program. */ + struct symtab *symtab; /* The associated symbol table, if any. */ +}; + /* The line number information for a compilation unit (found in the .debug_line section) begins with a "statement program header", which contains the following information. */ @@ -1060,15 +1072,7 @@ struct line_header with xmalloc; instead, they are pointers into debug_line_buffer. Don't try to free them directly. */ unsigned int num_file_names, file_names_size; - struct file_entry - { - const char *name; - unsigned int dir_index; - unsigned int mod_time; - unsigned int length; - int included_p; /* Non-zero if referenced by the Line Number Program. */ - struct symtab *symtab; /* The associated symbol table, if any. */ - } *file_names; + struct file_entry *file_names; /* The start and end of the statement program following this header. These point into dwarf2_per_objfile->line_buffer. */ @@ -1285,20 +1289,40 @@ struct dwarf_block and friends. */ static int bits_per_byte = 8; +struct nextfield +{ + struct nextfield *next; + int accessibility; + int virtuality; + struct field field; +}; + +struct nextfnfield +{ + struct nextfnfield *next; + struct fn_field fnfield; +}; + +struct fnfieldlist +{ + const char *name; + int length; + struct nextfnfield *head; +}; + +struct typedef_field_list +{ + struct typedef_field field; + struct typedef_field_list *next; +}; + /* The routines that read and process dies for a C struct or C++ class pass lists of data member fields and lists of member function fields in an instance of a field_info structure, as defined below. */ struct field_info { /* List of data member and baseclasses fields. */ - struct nextfield - { - struct nextfield *next; - int accessibility; - int virtuality; - struct field field; - } - *fields, *baseclasses; + struct nextfield *fields, *baseclasses; /* Number of fields (including baseclasses). */ int nfields; @@ -1311,35 +1335,19 @@ struct field_info /* Member function fields array, entries are allocated in the order they are encountered in the object file. */ - struct nextfnfield - { - struct nextfnfield *next; - struct fn_field fnfield; - } - *fnfields; + struct nextfnfield *fnfields; /* Member function fieldlist array, contains name of possibly overloaded member function, number of overloaded member functions and a pointer to the head of the member function field chain. */ - struct fnfieldlist - { - const char *name; - int length; - struct nextfnfield *head; - } - *fnfieldlists; + struct fnfieldlist *fnfieldlists; /* Number of entries in the fnfieldlists array. */ int nfnfields; /* typedefs defined inside this class. TYPEDEF_FIELD_LIST contains head of a NULL terminated list of TYPEDEF_FIELD_LIST_COUNT elements. */ - struct typedef_field_list - { - struct typedef_field field; - struct typedef_field_list *next; - } - *typedef_field_list; + struct typedef_field_list *typedef_field_list; unsigned typedef_field_list_count; }; |