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/GDBRemoteClientBase.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/GDBRemoteClientBase.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp index c3991a38a7e..4164ea29ddb 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp @@ -216,7 +216,7 @@ GDBRemoteClientBase::SendPacketAndWaitForResponse(llvm::StringRef payload, Strin const Lock &lock) { assert(lock); - PacketResult packet_result = SendPacketNoLock(payload.data(), payload.size()); + PacketResult packet_result = SendPacketNoLock(payload); if (packet_result != PacketResult::Success) return packet_result; @@ -255,7 +255,7 @@ GDBRemoteClientBase::SendvContPacket(llvm::StringRef payload, StringExtractorGDB log->Printf("GDBRemoteCommunicationClient::%s () sending vCont packet: %.*s", __FUNCTION__, int(payload.size()), payload.data()); - if (SendPacketNoLock(payload.data(), payload.size()) != PacketResult::Success) + if (SendPacketNoLock(payload) != PacketResult::Success) return false; OnRunPacketSent(true); @@ -354,8 +354,7 @@ GDBRemoteClientBase::ContinueLock::lock() log->Printf("GDBRemoteClientBase::ContinueLock::%s() cancelled", __FUNCTION__); return LockResult::Cancelled; } - if (m_comm.SendPacketNoLock(m_comm.m_continue_packet.data(), m_comm.m_continue_packet.size()) != - PacketResult::Success) + if (m_comm.SendPacketNoLock(m_comm.m_continue_packet) != PacketResult::Success) return LockResult::Failed; lldbassert(!m_comm.m_is_running); |