Do not use std::move when assigning an anonymous object to a unique_ptr.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 24 Nov 2016 20:01:24 +0000 (12:01 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 24 Nov 2016 20:01:24 +0000 (12:01 -0800)
Using std::move forces an extra copy of the object.  These changes fix
-Wpessimizing-move warnings from clang.

gdb/ChangeLog:

* ada-lang.c (create_excep_cond_exprs): Do not use 'std::move'.
* ax-gdb.c (agent_eval_command_one): Likewise.
(agent_eval_command_one): Likewise.
* breakpoint.c (parse_cond_to_aexpr): Likewise.
(parse_cmd_to_aexpr): Likewise.
* dtrace-probe.c (dtrace_process_dof_probe): Likewise.
* parse.c (parse_expression_for_completion): Likewise.

gdb/ChangeLog
gdb/ada-lang.c
gdb/ax-gdb.c
gdb/breakpoint.c
gdb/dtrace-probe.c
gdb/parse.c

index 9dc2618263858232337f92247bc8adec26cf802b..bceb86230d258b10681f82132d4a37a7b526e334 100644 (file)
@@ -1,3 +1,13 @@
+2016-11-24  John Baldwin  <jhb@FreeBSD.org>
+
+       * ada-lang.c (create_excep_cond_exprs): Do not use 'std::move'.
+       * ax-gdb.c (agent_eval_command_one): Likewise.
+       (agent_eval_command_one): Likewise.
+       * breakpoint.c (parse_cond_to_aexpr): Likewise.
+       (parse_cmd_to_aexpr): Likewise.
+       * dtrace-probe.c (dtrace_process_dof_probe): Likewise.
+       * parse.c (parse_expression_for_completion): Likewise.
+
 2016-11-24  John Baldwin  <jhb@FreeBSD.org>
 
        * common/new-op.c (operator new): Mark 'noexcept'.
index 0647a9b9fe0f4b60be62d78692d712470b3039d7..78c7d6f3f84623e90353da48e599fb0f71830505 100644 (file)
@@ -12343,9 +12343,9 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
          s = cond_string;
          TRY
            {
-             exp = std::move (parse_exp_1 (&s, bl->address,
-                                           block_for_pc (bl->address),
-                                           0));
+             exp = parse_exp_1 (&s, bl->address,
+                                block_for_pc (bl->address),
+                                0);
            }
          CATCH (e, RETURN_MASK_ERROR)
            {
index cd97585d586da3149c7295e6209fc2d05ac2fc9b..49108de1e1ef85114cb500aece271feddab1b0b9 100644 (file)
@@ -2555,8 +2555,8 @@ agent_eval_command_one (const char *exp, int eval, CORE_ADDR pc)
   arg = exp;
   if (!eval && strcmp (arg, "$_ret") == 0)
     {
-      agent = std::move (gen_trace_for_return_address (pc, get_current_arch (),
-                                                      trace_string));
+      agent = gen_trace_for_return_address (pc, get_current_arch (),
+                                           trace_string);
     }
   else
     {
@@ -2565,10 +2565,10 @@ agent_eval_command_one (const char *exp, int eval, CORE_ADDR pc)
       if (eval)
        {
          gdb_assert (trace_string == 0);
-         agent = std::move (gen_eval_for_expr (pc, expr.get ()));
+         agent = gen_eval_for_expr (pc, expr.get ());
        }
       else
-       agent = std::move (gen_trace_for_expr (pc, expr.get (), trace_string));
+       agent = gen_trace_for_expr (pc, expr.get (), trace_string);
     }
 
   ax_reqs (agent.get ());
index 67b610cb37475dacb43f37461cdc0c2d4e56952e..e2fcc082d8fc936d52a9e4d2f00c8312863970f3 100644 (file)
@@ -2268,7 +2268,7 @@ parse_cond_to_aexpr (CORE_ADDR scope, struct expression *cond)
      that may show up.  */
   TRY
     {
-      aexpr = std::move (gen_eval_for_expr (scope, cond));
+      aexpr = gen_eval_for_expr (scope, cond);
     }
 
   CATCH (ex, RETURN_MASK_ERROR)
@@ -2452,9 +2452,9 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
      that may show up.  */
   TRY
     {
-      aexpr = std::move (gen_printf (scope, gdbarch, 0, 0,
-                                    format_start, format_end - format_start,
-                                    fpieces, nargs, argvec));
+      aexpr = gen_printf (scope, gdbarch, 0, 0,
+                         format_start, format_end - format_start,
+                         fpieces, nargs, argvec);
     }
   CATCH (ex, RETURN_MASK_ERROR)
     {
index 38654a4ad2772f14dd435b749d99c3704686ade4..29c2d28b9a78fb6734354c4fa6d8aedeba4b5c9e 100644 (file)
@@ -430,8 +430,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
 
          TRY
            {
-             expr = std::move (parse_expression_with_language (arg.type_str,
-                                                               language_c));
+             expr = parse_expression_with_language (arg.type_str, language_c);
            }
          CATCH (ex, RETURN_MASK_ERROR)
            {
index afafc35cfb8f8e958ba000a863480c999d792c7a..323de7710ed4616d10f3c7297a80baa1063e1391 100644 (file)
@@ -1309,7 +1309,7 @@ parse_expression_for_completion (const char *string, char **name,
   TRY
     {
       parse_completion = 1;
-      exp = std::move (parse_exp_in_context (&string, 0, 0, 0, 0, &subexp));
+      exp = parse_exp_in_context (&string, 0, 0, 0, 0, &subexp);
     }
   CATCH (except, RETURN_MASK_ERROR)
     {