Make copy_name return std::string

This changes copy_name to return a std::string, updating all the
callers.  In some cases, an extra copy was removed.  This also
required a little bit of constification.

Tested by the buildbot.

gdb/ChangeLog
2019-04-19  Tom Tromey  <tom@tromey.com>

	* type-stack.h (struct type_stack) <insert>: Constify string.
	* type-stack.c (type_stack::insert): Constify string.
	* gdbtypes.h (lookup_template_type): Update.
	(address_space_name_to_int): Update.
	* gdbtypes.c (address_space_name_to_int): Make space_identifier
	const.
	(lookup_template_type): Make name const.
	* c-exp.y: Update rules.
	(lex_one_token, classify_name, classify_inner_name)
	(c_print_token): Update.
	* p-exp.y: Update rules.
	(yylex): Update.
	* f-exp.y: Update rules.
	(yylex): Update.
	* d-exp.y: Update rules.
	(lex_one_token, classify_name, classify_inner_name): Update.
	* parse.c (write_dollar_variable, copy_name): Return std::string.
	* parser-defs.h (copy_name): Change return type.
	* m2-exp.y: Update rules.
	(yylex): Update.
	* go-exp.y (lex_one_token): Update.
	Update rules.
	(classify_unsafe_function, classify_packaged_name)
	(classify_name, yylex): Update.
This commit is contained in:
Tom Tromey
2019-04-07 15:29:58 -06:00
parent 189b8c2e10
commit 61f4b35041
13 changed files with 195 additions and 176 deletions

View File

@@ -574,7 +574,8 @@ lookup_function_type_with_arguments (struct type *type,
return the integer flag defined in gdbtypes.h. */
int
address_space_name_to_int (struct gdbarch *gdbarch, char *space_identifier)
address_space_name_to_int (struct gdbarch *gdbarch,
const char *space_identifier)
{
int type_flags;
@@ -1618,7 +1619,7 @@ lookup_enum (const char *name, const struct block *block)
visible in lexical block BLOCK. */
struct type *
lookup_template_type (char *name, struct type *type,
lookup_template_type (const char *name, struct type *type,
const struct block *block)
{
struct symbol *sym;