diff options
author | Keith Seitz <keiths@redhat.com> | 2018-08-10 10:48:03 -0700 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2018-08-10 11:14:25 -0700 |
commit | 9cdfd9a26ef63ef2fee58c0e7475b5373b61e5d1 (patch) | |
tree | 65edd204b72edbe64897ffef609af0e566c4db26 /gdb/language.h | |
parent | 18cdc6d8f8e8b55e84783e0a2b5a80b41a0e917b (diff) | |
download | gdb-9cdfd9a26ef63ef2fee58c0e7475b5373b61e5d1.zip gdb-9cdfd9a26ef63ef2fee58c0e7475b5373b61e5d1.tar.gz gdb-9cdfd9a26ef63ef2fee58c0e7475b5373b61e5d1.tar.bz2 |
Change compile_instance/compile_c_instance into classes
This patch changes structs compile_instance and compile_c_instance into
classes.
Because of the nature of the change, there are a number of unavoidably
mechanical changes buried in here, such as turning variable access of the
POD struct into method calls, removing the struct keyword, and changing
access of the plugin from "c_plugin->operation()" to
"plugin ().operation ()".
There is one "non-trivial" change associated with this patch, though.
The type cache and symbol error maps have been moved into the base class,
believing these facilities would be used other language implementations.
[They are indeed re-used by C++.]
gdb/ChangeLog:
* compile/compile-c-support.c (c_get_compile_context): Use `new'
instead of `new_compile_instance'.
* compile/compile-c-symbols.c (compile_instance::insert_symbol_error):
Update description.
If the symbol error map is not initialized, create it.
(generate_c_for_for_one_symbol): Do not check/initialize
the symbol error map.
* compile/compile-c-types.c (compile_c_instance): Make a class.
Update all callers.
(compile_instance::compile_instance): Initialize the type cache.
(get_cached_type): New function.
(insert_type): Update description.
(compile_c_instance::m_default_cflags): Define.
(convert_type): Update description. Use get_cached_type.
(delete_instance): Moved to destructor.
(new_compile_instance): Moved to constructor.
* compile/compile-c.h (compile_c_instance): Make class inheriting
from compile_instance.
<base>: Remove field.
<type_map, symbol_err_map>: Move to base class.
<c_plugin>: Rename to `m_plugin' and remove pointer type.
* compile/compile-internal.h (compile_instance): Make class.
<type_map_t, symbol_err_map_t>: Define.
<fe>: Rename to `m_gcc_fe'.
<scope, block, gcc_target_options>: Add `m_' prefix.
<m_type_map, m_symbol_err_map>: New fields, moved from
compile_c_instance.
<destroy>: Remove.
(convert_type, new_compile_instance): Remove.
* compile/compile.c (cleanup_compile_instance): Remove.
(compile_to_object): Use unique_ptr to eliminate cleanups.
(compile_instance::set_print_callback, compile_instance::version)
(compile_instance::set_verbose)
(compile_instance::set_driver_filename)
(compile_instance::set_triplet_regexp)
(compile_instance::set_arguments)
(compile_instance::set_source_file)
(compile_instance::compile): Define.
Diffstat (limited to 'gdb/language.h')
-rw-r--r-- | gdb/language.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/language.h b/gdb/language.h index c4b7619..02a84ff 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -36,7 +36,7 @@ struct value_print_options; struct type_print_options; struct lang_varobj_ops; struct parser_state; -struct compile_instance; +class compile_instance; struct completion_match_for_lcd; #define MAX_FORTRAN_DIMS 7 /* Maximum number of F77 array dims. */ @@ -424,7 +424,7 @@ struct language_defn instance is owned by its caller and must be deallocated by calling its 'destroy' method. */ - struct compile_instance *(*la_get_compile_instance) (void); + compile_instance *(*la_get_compile_instance) (void); /* This method must be defined if 'la_get_gcc_context' is defined. If 'la_get_gcc_context' is not defined, then this method is @@ -440,7 +440,7 @@ struct language_defn parsed. EXPR_PC is the PC at which the expression is being parsed. */ - std::string (*la_compute_program) (struct compile_instance *inst, + std::string (*la_compute_program) (compile_instance *inst, const char *input, struct gdbarch *gdbarch, const struct block *expr_block, |