summaryrefslogtreecommitdiff
path: root/gdb/cp-support.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2018-12-31 17:41:38 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-01-03 21:24:00 +0000
commit06d3e5b0046d69e3da3450d2eb07c29f0c1a189a (patch)
treee0b86260f64d08ee047298504ee0b3228c1081f8 /gdb/cp-support.c
parent66644cd32ba63e7fda70e455766b438631ec0b61 (diff)
downloadbinutils-gdb-06d3e5b0046d69e3da3450d2eb07c29f0c1a189a.tar.gz
gdb: Remove a cleanup from find_overload_match
This patch changes cp-support.c:cp_func_name to return a 'gdb::unique_xmalloc_ptr<char>' instead of a 'char *'. This allows a cleanup to be removed from valops.c:find_overload_match. gdb/ChangeLog: * compile/compile-cplus-types.c (compile_cplus_instance::decl_name): Handle changes to cp_func_name. * cp-support.c (cp_func_name): Update header comment, update return type. * cp-support.h (cp_func_name): Update return type in declaration. * valops.c (find_overload_match): Move temp_func local to top level of function and change its type. Use temp_func to hold and delete temporary string obtained from cp_func_name.
Diffstat (limited to 'gdb/cp-support.c')
-rw-r--r--gdb/cp-support.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 2024f87c44d..489bcca2b8d 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -808,10 +808,9 @@ method_name_from_physname (const char *physname)
/* If FULL_NAME is the demangled name of a C++ function (including an
arg list, possibly including namespace/class qualifications),
return a new string containing only the function name (without the
- arg list/class qualifications). Otherwise, return NULL. The
- caller is responsible for freeing the memory in question. */
+ arg list/class qualifications). Otherwise, return NULL. */
-char *
+gdb::unique_xmalloc_ptr<char>
cp_func_name (const char *full_name)
{
gdb::unique_xmalloc_ptr<char> ret;
@@ -820,14 +819,14 @@ cp_func_name (const char *full_name)
info = cp_demangled_name_to_comp (full_name, NULL);
if (!info)
- return NULL;
+ return nullptr;
ret_comp = unqualified_name_from_comp (info->tree);
if (ret_comp != NULL)
ret = cp_comp_to_string (ret_comp, 10);
- return ret.release ();
+ return ret;
}
/* Helper for cp_remove_params. DEMANGLED_NAME is the name of a