[Lldb-commits] [PATCH] D113314: [lldb] Use std::string instead of llvm::Twine

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 5 12:54:11 PDT 2021


JDevlieghere created this revision.
JDevlieghere added a reviewer: mgorny.
JDevlieghere requested review of this revision.

>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


https://reviews.llvm.org/D113314

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


Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1109,9 +1109,9 @@
 
   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:" + std::string(avail_name) + ";";
+    if (SendPacketAndWaitForResponse(packet, response) != PacketResult::Success)
       return;
 
     if (response.IsOKResponse()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113314.385168.patch
Type: text/x-patch
Size: 809 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211105/03cf8638/attachment.bin>


More information about the lldb-commits mailing list