[Lldb-commits] [lldb] 6d48e25 - [lldb] Use std::string instead of llvm::Twine in GDBRemoteCommunicationClient

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 5 13:19:09 PDT 2021


Author: Jonas Devlieghere
Date: 2021-11-05T13:19:00-07:00
New Revision: 6d48e2505c7a68a470e75b61ad504d51db0f8a36

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

LOG: [lldb] Use std::string instead of llvm::Twine in GDBRemoteCommunicationClient

>From the documentation:

  A Twine is not intended for use directly and should not be stored, its
  implementation relies on the ability to store pointers to temporary
  stack objects which may be deallocated at the end of a statement.
  Twines should only be used accepted as const references in arguments,
  when an API wishes to accept possibly-concatenated strings.

rdar://84799118

Differential revision: https://reviews.llvm.org/D113314

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 6fd51126762eb..364a37a0cc283 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1109,9 +1109,8 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
 
   if (avail_type != CompressionType::None) {
     StringExtractorGDBRemote response;
-    llvm::Twine packet = "QEnableCompression:type:" + avail_name + ";";
-    if (SendPacketAndWaitForResponse(packet.str(), response) !=
-        PacketResult::Success)
+    std::string packet = "QEnableCompression:type:" + avail_name.str() + ";";
+    if (SendPacketAndWaitForResponse(packet, response) != PacketResult::Success)
       return;
 
     if (response.IsOKResponse()) {


        


More information about the lldb-commits mailing list