Use an enum to represent subclasses of symbol

This changes struct symbol to use an enum to encode the concrete
subclass of a particular symbol.  Note that "enum class" doesn't work
properly with bitfields, so a plain enum is used.

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

	* symtab.h (enum symbol_subclass_kind): New.
	(struct symbol) <is_cplus_template_function, is_rust_vtable>:
	Remove.
	<subclass>: New member.
	(SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION): Update.
	* rust-lang.c (rust_get_trait_object_pointer): Update.
	* dwarf2read.c (read_func_scope): Update.
	(read_variable): Update.
This commit is contained in:
Tom Tromey 2017-11-17 12:05:58 -07:00
parent 68e745e38e
commit cf724bc93e
4 changed files with 32 additions and 11 deletions

View file

@ -421,7 +421,7 @@ rust_get_trait_object_pointer (struct value *value)
CORE_ADDR vtable = value_as_address (value_field (value, vtable_field));
struct symbol *symbol = find_symbol_at_address (vtable);
if (symbol == NULL || !symbol->is_rust_vtable)
if (symbol == NULL || symbol->subclass != SYMBOL_RUST_VTABLE)
return NULL;
struct rust_vtable_symbol *vtable_sym