[Lldb-commits] [lldb] ac312a9 - [lldb] Silence compiler warnings from 37cbd817d3e2b8c673862e2eb262cad6dd3dd244

Benjamin Kramer via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 6 04:08:28 PDT 2021


Author: Benjamin Kramer
Date: 2021-09-06T13:04:21+02:00
New Revision: ac312a9d7c03f0be53834d3f295f1971aaf54649

URL: https://github.com/llvm/llvm-project/commit/ac312a9d7c03f0be53834d3f295f1971aaf54649
DIFF: https://github.com/llvm/llvm-project/commit/ac312a9d7c03f0be53834d3f295f1971aaf54649.diff

LOG: [lldb] Silence compiler warnings from 37cbd817d3e2b8c673862e2eb262cad6dd3dd244

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:3638:30: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
    return SendErrorResponse(std::move(ret.takeError()));
                             ^
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:3638:30: note: remove std::move call here
    return SendErrorResponse(std::move(ret.takeError()));
                             ^~~~~~~~~~               ~
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:3622:8: error: unused variable 'cf' [-Werror,-Wunused-variable]
  bool cf = packet_str.consume_front("qSaveCore");

Added: 
    

Modified: 
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 5d0ce3a6ef85..d40e5eb631e9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -3619,9 +3619,8 @@ GDBRemoteCommunicationServerLLGS::Handle_qSaveCore(
   std::string path_hint;
 
   StringRef packet_str{packet.GetStringRef()};
-  bool cf = packet_str.consume_front("qSaveCore");
-  assert(cf);
-  if (packet_str.consume_front(";")) {
+  assert(packet_str.startswith("qSaveCore"));
+  if (packet_str.consume_front("qSaveCore;")) {
     llvm::SmallVector<llvm::StringRef, 2> fields;
     packet_str.split(fields, ';');
 
@@ -3635,7 +3634,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qSaveCore(
 
   llvm::Expected<std::string> ret = m_current_process->SaveCore(path_hint);
   if (!ret)
-    return SendErrorResponse(std::move(ret.takeError()));
+    return SendErrorResponse(ret.takeError());
 
   StreamString response;
   response.PutCString("core-path:");


        


More information about the lldb-commits mailing list