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

@ -1859,7 +1859,7 @@ extern struct type *make_atomic_type (struct type *);
extern void replace_type (struct type *, struct type *);
extern int address_space_name_to_int (struct gdbarch *, char *);
extern int address_space_name_to_int (struct gdbarch *, const char *);
extern const char *address_space_int_to_name (struct gdbarch *, int);
@ -2005,7 +2005,7 @@ extern struct type *lookup_typename (const struct language_defn *,
struct gdbarch *, const char *,
const struct block *, int);
extern struct type *lookup_template_type (char *, struct type *,
extern struct type *lookup_template_type (const char *, struct type *,
const struct block *);
extern int get_vptr_fieldno (struct type *, struct type **);