aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile/compile-internal.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-14 00:03:02 -0600
committerTom Tromey <tom@tromey.com>2017-09-03 13:03:10 -0600
commit8f84fb0ee87e8f149523e13815c58e1b664d184f (patch)
tree24e32c98b3a0c898b7a32bf905b23f4b38f4f79e /gdb/compile/compile-internal.h
parent18e9961f02b326923553f34682f4dcca0f25702e (diff)
downloadbinutils-8f84fb0ee87e8f149523e13815c58e1b664d184f.zip
binutils-8f84fb0ee87e8f149523e13815c58e1b664d184f.tar.gz
binutils-8f84fb0ee87e8f149523e13815c58e1b664d184f.tar.bz2
Use std::string and unique_xmalloc_ptr in compile/ code
Change various things in the compile/ code to use std::string or unique_xmalloc_ptr as appropriate. This allows the removal of some cleanups. ChangeLog 2017-09-03 Tom Tromey <tom@tromey.com> * compile/compile.c (compile_register_name_mangled): Return std::string. * compile/compile-loc2c.c (pushf_register_address): Update. (pushf_register): Update. * compile/compile-c-types.c (convert_array): Update. * compile/compile-c-symbols.c (generate_vla_size): Update. (error_symbol_once): Use a gdb::unique_xmalloc_ptr. (symbol_substitution_name): Return a gdb::unique_xmalloc_ptr. (convert_one_symbol): Update. (generate_c_for_for_one_variable): Update. * compile/compile-c-support.c (c_get_range_decl_name): Return a std::string. (generate_register_struct): Update. * compile/compile-internal.h (c_get_range_decl_name): Return a std::string. (compile_register_name_mangled): Return std::string.
Diffstat (limited to 'gdb/compile/compile-internal.h')
-rw-r--r--gdb/compile/compile-internal.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/gdb/compile/compile-internal.h b/gdb/compile/compile-internal.h
index 0c53f8c..091e654 100644
--- a/gdb/compile/compile-internal.h
+++ b/gdb/compile/compile-internal.h
@@ -95,11 +95,10 @@ struct compile_c_instance
/* Call gdbarch_register_name (GDBARCH, REGNUM) and convert its result
to a form suitable for the compiler source. The register names
- should not clash with inferior defined macros. Returned pointer is
- never NULL. Returned pointer needs to be deallocated by xfree. */
+ should not clash with inferior defined macros. */
-extern char *compile_register_name_mangled (struct gdbarch *gdbarch,
- int regnum);
+extern std::string compile_register_name_mangled (struct gdbarch *gdbarch,
+ int regnum);
/* Convert compiler source register name to register number of
GDBARCH. Returned value is always >= 0, function throws an error
@@ -144,13 +143,12 @@ extern unsigned char *generate_c_for_variable_locations
extern const char *c_get_mode_for_size (int size);
-/* Given a dynamic property, return an xmallocd name that is used to
- represent its size. The result must be freed by the caller. The
- contents of the resulting string will be the same each time for
- each call with the same argument. */
+/* Given a dynamic property, return a name that is used to represent
+ its size. The contents of the resulting string will be the same
+ each time for each call with the same argument. */
struct dynamic_prop;
-extern char *c_get_range_decl_name (const struct dynamic_prop *prop);
+extern std::string c_get_range_decl_name (const struct dynamic_prop *prop);
/* Type used to hold and pass around the source and object file names
to use for compilation. */