diff options
author | Zachary Turner <zturner@google.com> | 2016-08-27 15:52:29 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-08-27 15:52:29 +0000 |
commit | 26709df81deda2ef4ea143ba51caf9c3bb9b9398 (patch) | |
tree | 8bb811ce94d4a3fbf48204cf95496cc8dc530cdf /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp | |
parent | 56658af2cb2329f5691b4e837b6c06aa3833f81e (diff) | |
download | bcm5719-llvm-26709df81deda2ef4ea143ba51caf9c3bb9b9398.tar.gz bcm5719-llvm-26709df81deda2ef4ea143ba51caf9c3bb9b9398.zip |
Convert some functions to use StringRef instead of c_str, len
This started as an effort to change StringExtractor to store a
StringRef internally instead of a std::string. I got that working
locally with just 1 test failure which I was unable to figure out the
cause of. But it was also a massive changelist due to a trickle
down effect of changes.
So I'm starting over, using what I learned from the first time to
tackle smaller, more isolated changes hopefully leading up to
a full conversion by the end.
At first the changes (such as in this CL) will seem mostly
a matter of preference and pointless otherwise. However, there
are some places in my larger CL where using StringRef turned 20+
lines of code into 2, drastically simplifying logic. Hopefully
once these go in they will illustrate some of the benefits of
thinking in terms of StringRef.
llvm-svn: 279917
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp index 4ee66b84d47..58cb7760cbf 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp @@ -103,7 +103,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServer::SendUnimplementedResponse (const char *) { // TODO: Log the packet we aren't handling... - return SendPacketNoLock ("", 0); + return SendPacketNoLock (""); } @@ -113,7 +113,7 @@ GDBRemoteCommunicationServer::SendErrorResponse (uint8_t err) char packet[16]; int packet_len = ::snprintf (packet, sizeof(packet), "E%2.2x", err); assert (packet_len < (int)sizeof(packet)); - return SendPacketNoLock (packet, packet_len); + return SendPacketNoLock (llvm::StringRef(packet, packet_len)); } GDBRemoteCommunication::PacketResult @@ -128,7 +128,7 @@ GDBRemoteCommunicationServer::SendIllFormedResponse (const StringExtractorGDBRem GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServer::SendOKResponse () { - return SendPacketNoLock ("OK", 2); + return SendPacketNoLock ("OK"); } bool |