aboutsummaryrefslogtreecommitdiff
path: root/gdb/d-exp.y
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-13 10:38:53 -0600
committerTom Tromey <tom@tromey.com>2017-09-06 15:49:31 -0600
commit5613c5857a020ca5189a73df7b58a234d0311bfb (patch)
tree721574de51dc03d6ab5a6120ff5aee7e4caf773d /gdb/d-exp.y
parenteae49211e13efa075d57ab354ea4207666eadc96 (diff)
downloadbinutils-5613c5857a020ca5189a73df7b58a234d0311bfb.zip
binutils-5613c5857a020ca5189a73df7b58a234d0311bfb.tar.gz
binutils-5613c5857a020ca5189a73df7b58a234d0311bfb.tar.bz2
Remove last cleanups from d-exp.y
This removes the last remaining cleanups from d-exp.y. 2017-09-05 Tom Tromey <tom@tromey.com> * d-exp.y (PrimaryExpression): Use std::string. (d_parse): Don't create a cleanup.
Diffstat (limited to 'gdb/d-exp.y')
-rw-r--r--gdb/d-exp.y25
1 files changed, 8 insertions, 17 deletions
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index 9b773c6..00c9676 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -470,15 +470,14 @@ PrimaryExpression:
struct block_symbol sym;
const char *type_name = TYPE_SAFE_NAME (type);
int type_name_len = strlen (type_name);
- char *name;
-
- name = xstrprintf ("%.*s.%.*s",
+ std::string name
+ = string_printf ("%.*s.%.*s",
type_name_len, type_name,
$3.length, $3.ptr);
- make_cleanup (xfree, name);
sym =
- lookup_symbol (name, (const struct block *) NULL,
+ lookup_symbol (name.c_str (),
+ (const struct block *) NULL,
VAR_DOMAIN, NULL);
if (sym.symbol)
{
@@ -489,13 +488,14 @@ PrimaryExpression:
break;
}
- msymbol = lookup_bound_minimal_symbol (name);
+ msymbol = lookup_bound_minimal_symbol (name.c_str ());
if (msymbol.minsym != NULL)
write_exp_msymbol (pstate, msymbol);
else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command."));
else
- error (_("No symbol \"%s\" in current context."), name);
+ error (_("No symbol \"%s\" in current context."),
+ name.c_str ());
}
/* Check if the qualified name resolves as a member
@@ -1620,18 +1620,11 @@ yylex (void)
int
d_parse (struct parser_state *par_state)
{
- int result;
- struct cleanup *back_to;
-
/* Setting up the parser state. */
scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
- /* Note that parsing (within yyparse) freely installs cleanups
- assuming they're run here (below). */
- back_to = make_cleanup (null_cleanup, NULL);
-
scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
parser_debug);
@@ -1643,9 +1636,7 @@ d_parse (struct parser_state *par_state)
popping = 0;
name_obstack.clear ();
- result = yyparse ();
- do_cleanups (back_to);
- return result;
+ return yyparse ();
}
void