]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Make template_symbol derive from symbol
authorTom Tromey <tom@tromey.com>
Fri, 17 Nov 2017 18:55:38 +0000 (11:55 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 17 Nov 2017 21:34:14 +0000 (14:34 -0700)
This changes template_symbol to derive from symbol, which seems a bit
cleaner; and also more consistent with rust_vtable_symbol.

2017-11-17  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (read_func_scope): Update.
* symtab.h (struct template_symbol): Derive from symbol.
<base>: Remove.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/symtab.c
gdb/symtab.h

index b7ee8693a92488a4f9737fc0db61365d914785bd..5aecd43182a7254842d583f97635651dbd319f74 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-17  Tom Tromey  <tom@tromey.com>
+
+       * dwarf2read.c (read_func_scope): Update.
+       * symtab.h (struct template_symbol): Derive from symbol.
+       <base>: Remove.
+
 2017-11-17  Tom Tromey  <tom@tromey.com>
 
        * symtab.h (struct symbol) <is_rust_vtable>: New member.
index 828334522f8f0d164cf2cda9bef0f4ed405c3a7f..86b699671ac90a38a7b8f3044f0c5b422019828a 100644 (file)
@@ -12263,7 +12263,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
          || child_die->tag == DW_TAG_template_value_param)
        {
          templ_func = allocate_template_symbol (objfile);
-         templ_func->base.is_cplus_template_function = 1;
+         templ_func->is_cplus_template_function = 1;
          break;
        }
     }
index 38bc7136c2aa7b2fc5d6a8466128f40b7f16a42e..3d5936774db49931d4e66848cc5d361ccf45361c 100644 (file)
@@ -5800,7 +5800,7 @@ allocate_template_symbol (struct objfile *objfile)
   struct template_symbol *result;
 
   result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct template_symbol);
-  initialize_objfile_symbol_1 (&result->base);
+  initialize_objfile_symbol_1 (result);
 
   return result;
 }
index 9466f29d0ff5160a776cd27c6ff3df0150c3b990..83d0ff256967a3c51a79c87a292a1318dbc076db 100644 (file)
@@ -1167,16 +1167,11 @@ extern struct symtab *symbol_symtab (const struct symbol *symbol);
 extern void symbol_set_symtab (struct symbol *symbol, struct symtab *symtab);
 
 /* An instance of this type is used to represent a C++ template
-   function.  It includes a "struct symbol" as a kind of base class;
-   users downcast to "struct template_symbol *" when needed.  A symbol
-   is really of this type iff SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION is
-   true.  */
+   function.  A symbol is really of this type iff
+   SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION is true.  */
 
-struct template_symbol
+struct template_symbol : public symbol
 {
-  /* The base class.  */
-  struct symbol base;
-
   /* The number of template arguments.  */
   int n_template_arguments;