aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.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/valops.c
parent66644cd32ba63e7fda70e455766b438631ec0b61 (diff)
downloadgdb-06d3e5b0046d69e3da3450d2eb07c29f0c1a189a.zip
gdb-06d3e5b0046d69e3da3450d2eb07c29f0c1a189a.tar.gz
gdb-06d3e5b0046d69e3da3450d2eb07c29f0c1a189a.tar.bz2
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/valops.c')
-rw-r--r--gdb/valops.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index caf3162..1a9d6a6 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -2520,6 +2520,7 @@ find_overload_match (gdb::array_view<value *> args,
const char *obj_type_name = NULL;
const char *func_name = NULL;
+ gdb::unique_xmalloc_ptr<char> temp_func;
enum oload_classification match_quality;
enum oload_classification method_match_quality = INCOMPATIBLE;
enum oload_classification src_method_match_quality = INCOMPATIBLE;
@@ -2666,20 +2667,17 @@ find_overload_match (gdb::array_view<value *> args,
&& TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym)))
== TYPE_CODE_FUNC)
{
- char *temp_func;
-
temp_func = cp_func_name (qualified_name);
/* If cp_func_name did not remove anything, the name of the
symbol did not include scope or argument types - it was
probably a C-style function. */
- if (temp_func)
+ if (temp_func != nullptr)
{
- make_cleanup (xfree, temp_func);
- if (strcmp (temp_func, qualified_name) == 0)
+ if (strcmp (temp_func.get (), qualified_name) == 0)
func_name = NULL;
else
- func_name = temp_func;
+ func_name = temp_func.get ();
}
}
}