From bdfea17ea9bbd9f92ad19a70d770af42473d9c07 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 5 Feb 2021 07:17:11 -0700 Subject: 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 * 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. --- gdb/c-lang.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gdb/c-lang.c') diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 626dbc4..16ff3c7 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -36,8 +36,7 @@ #include #include "gdbcore.h" #include "gdbarch.h" - -class compile_instance; +#include "compile/compile-internal.h" /* Given a C string type, STR_TYPE, return the corresponding target character set name. */ @@ -888,7 +887,7 @@ public: } /* See language.h. */ - compile_instance *get_compile_instance () const override + std::unique_ptr get_compile_instance () const override { return c_get_compile_context (); } @@ -1021,7 +1020,7 @@ public: } /* See language.h. */ - compile_instance *get_compile_instance () const override + std::unique_ptr get_compile_instance () const override { return cplus_get_compile_context (); } -- cgit v1.1