gdb: remove unnecessary call to std::string constructor
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 11 May 2023 17:33:51 +0000 (13:33 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 12 May 2023 18:50:09 +0000 (14:50 -0400)
I spotted this explicit call to std::string, which creates an
unnecessary temporary extra std::string, while calling emplace_back.
I'm not sure if it has any impact in an optimized build, maybe the
compiler elides it.  But still, it's unnecessary.

Change-Id: I873337ea91db29ac06267aff8fc12dcf52824cac
Approved-By: Tom Tromey <tom@tromey.com>
gdb/cli/cli-decode.c

index 948592a6f6211fa7508154a2da629520f32af91f..b84ce8375fb74a78445b1d8611499a46faa50f58 100644 (file)
@@ -155,7 +155,7 @@ cmd_list_element::command_components () const
   if (this->prefix != nullptr)
     result = this->prefix->command_components ();
 
-  result.emplace_back (std::string (this->name));
+  result.emplace_back (this->name);
   return result;
 }