mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 01:07:52 +00:00
Return unique_ptr from language_defn::get_compile_context
This changes language_defn::get_compile_context to return a unique_ptr. This makes the ownership transfer clear. gdb/ChangeLog 2021-02-05 Tom Tromey <tom@tromey.com> * compile/compile-c-support.c (get_compile_context) (c_get_compile_context, cplus_get_compile_context): Change return type. * language.c (language_defn::get_compile_instance): New method. * language.h (language_defn::get_compile_instance): Change return type. No longer inline. * c-lang.c (c_language::get_compile_instance): Change return type. (cplus_language::get_compile_instance): Change return type. * c-lang.h (c_get_compile_context, cplus_get_compile_context): Change return type. * compile/compile.c (compile_to_object): Update.
This commit is contained in:
18
gdb/c-lang.h
18
gdb/c-lang.h
@@ -147,21 +147,19 @@ extern bool c_is_string_type_p (struct type *type);
|
||||
|
||||
extern int c_textual_element_type (struct type *, char);
|
||||
|
||||
/* Create a new instance of the C compiler and return it. The new
|
||||
compiler is owned by the caller and must be freed using the destroy
|
||||
method. This function never returns NULL, but rather throws an
|
||||
exception on failure. This is suitable for use as the
|
||||
/* Create a new instance of the C compiler and return it. This
|
||||
function never returns NULL, but rather throws an exception on
|
||||
failure. This is suitable for use as the
|
||||
language_defn::get_compile_instance method. */
|
||||
|
||||
extern compile_instance *c_get_compile_context (void);
|
||||
extern std::unique_ptr<compile_instance> c_get_compile_context ();
|
||||
|
||||
/* Create a new instance of the C++ compiler and return it. The new
|
||||
compiler is owned by the caller and must be freed using the destroy
|
||||
method. This function never returns NULL, but rather throws an
|
||||
exception on failure. This is suitable for use as the
|
||||
/* Create a new instance of the C++ compiler and return it. This
|
||||
function never returns NULL, but rather throws an exception on
|
||||
failure. This is suitable for use as the
|
||||
language_defn::get_compile_instance method. */
|
||||
|
||||
extern compile_instance *cplus_get_compile_context ();
|
||||
extern std::unique_ptr<compile_instance> cplus_get_compile_context ();
|
||||
|
||||
/* This takes the user-supplied text and returns a new bit of code to
|
||||
compile.
|
||||
|
||||
Reference in New Issue
Block a user