'struct expression *' -> gdb::unique_xmalloc_ptr<expression>
[deliverable/binutils-gdb.git] / gdb / ada-lang.c
index be2f47a6bc964d0bda001e57c9e344612055a35e..d1a39bcc4610c4e57028ec9800101e370a31e313 100644 (file)
@@ -4454,17 +4454,10 @@ ada_read_renaming_var_value (struct symbol *renaming_sym,
                             const struct block *block)
 {
   const char *sym_name;
-  struct expression *expr;
-  struct value *value;
-  struct cleanup *old_chain = NULL;
 
   sym_name = SYMBOL_LINKAGE_NAME (renaming_sym);
-  expr = parse_exp_1 (&sym_name, 0, block, 0);
-  old_chain = make_cleanup (free_current_contents, &expr);
-  value = evaluate_expression (expr);
-
-  do_cleanups (old_chain);
-  return value;
+  expression_up expr = parse_exp_1 (&sym_name, 0, block, 0);
+  return evaluate_expression (expr.get ());
 }
 \f
 
@@ -12308,7 +12301,7 @@ struct ada_catchpoint_location
   /* The condition that checks whether the exception that was raised
      is the specific exception the user specified on catchpoint
      creation.  */
-  struct expression *excep_cond_expr;
+  expression_up excep_cond_expr;
 };
 
 /* Implement the DTOR method in the bp_location_ops structure for all
@@ -12319,7 +12312,7 @@ ada_catchpoint_location_dtor (struct bp_location *bl)
 {
   struct ada_catchpoint_location *al = (struct ada_catchpoint_location *) bl;
 
-  xfree (al->excep_cond_expr);
+  al->excep_cond_expr.reset ();
 }
 
 /* The vtable to be used in Ada catchpoint locations.  */
@@ -12371,7 +12364,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
     {
       struct ada_catchpoint_location *ada_loc
        = (struct ada_catchpoint_location *) bl;
-      struct expression *exp = NULL;
+      expression_up exp;
 
       if (!bl->shlib_disabled)
        {
@@ -12380,26 +12373,20 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
          s = cond_string;
          TRY
            {
-             exp = parse_exp_1 (&s, bl->address,
-                                block_for_pc (bl->address), 0);
+             exp = gdb::move (parse_exp_1 (&s, bl->address,
+                                           block_for_pc (bl->address),
+                                           0));
            }
          CATCH (e, RETURN_MASK_ERROR)
            {
              warning (_("failed to reevaluate internal exception condition "
                         "for catchpoint %d: %s"),
                       c->base.number, e.message);
-             /* There is a bug in GCC on sparc-solaris when building with
-                optimization which causes EXP to change unexpectedly
-                (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982).
-                The problem should be fixed starting with GCC 4.9.
-                In the meantime, work around it by forcing EXP back
-                to NULL.  */
-             exp = NULL;
            }
          END_CATCH
        }
 
-      ada_loc->excep_cond_expr = exp;
+      ada_loc->excep_cond_expr = gdb::move (exp);
     }
 
   do_cleanups (old_chain);
@@ -12427,7 +12414,7 @@ allocate_location_exception (enum ada_exception_catchpoint_kind ex,
 {
   struct ada_catchpoint_location *loc;
 
-  loc = XNEW (struct ada_catchpoint_location);
+  loc = new ada_catchpoint_location ();
   init_bp_location (&loc->base, &ada_catchpoint_location_ops, self);
   loc->excep_cond_expr = NULL;
   return &loc->base;
@@ -12479,7 +12466,7 @@ should_stop_exception (const struct bp_location *bl)
       struct value *mark;
 
       mark = value_mark ();
-      stop = value_true (evaluate_expression (ada_loc->excep_cond_expr));
+      stop = value_true (evaluate_expression (ada_loc->excep_cond_expr.get ()));
       value_free_to_mark (mark);
     }
   CATCH (ex, RETURN_MASK_ALL)
@@ -13143,7 +13130,7 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
   struct symtab_and_line sal
     = ada_exception_sal (ex_kind, excep_string, &addr_string, &ops);
 
-  c = XNEW (struct ada_catchpoint);
+  c = new ada_catchpoint ();
   init_ada_exception_breakpoint (&c->base, gdbarch, sal, addr_string,
                                 ops, tempflag, disabled, from_tty);
   c->excep_string = excep_string;
This page took 0.029057 seconds and 4 git commands to generate.