diff mbox series

[libcody] Remove some std::move [PR 98368]

Message ID e49752d4-6b95-2339-8684-61e4ce504d86@acm.org
State New
Headers show
Series [libcody] Remove some std::move [PR 98368] | expand

Commit Message

Nathan Sidwell Jan. 4, 2021, 2:41 p.m. UTC
Compiling on clang showed a couple of pessimizations.  Fixed thusly.

	libcody/
         * client.cc (Client::ProcessResponse): Remove std::move
         inside ?:
         c++tools/
	* resolver.cc (module_resolver::cmi_response): Remove
         std::move of temporary.
diff mbox series

Patch

diff --git i/c++tools/resolver.cc w/c++tools/resolver.cc
index c8d31153574..ef08de53072 100644
--- i/c++tools/resolver.cc
+++ w/c++tools/resolver.cc
@@ -226,9 +226,7 @@  module_resolver::cmi_response (Cody::Server *s, std::string &module)
   auto iter = map.find (module);
   if (iter == map.end ())
     {
-      std::string file;
-      if (default_map)
-	file = std::move (GetCMIName (module));
+      std::string file = default_map ? GetCMIName (module) : std::string ();
       auto res = map.emplace (module, file);
       iter = res.first;
     }
diff --git i/libcody/client.cc w/libcody/client.cc
index edfe44d34b2..ae69d190cb7 100644
--- i/libcody/client.cc
+++ w/libcody/client.cc
@@ -122,8 +122,7 @@  Packet Client::ProcessResponse (std::vector<std::string> &words,
   Assert (!words.empty ());
   if (words[0] == u8"ERROR")
     return Packet (Client::PC_ERROR,
-		  std::move (words.size () == 2 ? words[1]
-			     : u8"malformed error response"));
+		   words.size () == 2 ? words[1]: u8"malformed error response");
 
   if (isLast && !read.IsAtEnd ())
     return Packet (Client::PC_ERROR,